@wix/cli-app 1.1.28 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/CreateVersionCommand-NFKBKYN5.js +4 -0
- package/build/CreateVersionCommand-NFKBKYN5.js.map +1 -0
- package/build/DevCommand-CSOEONPY.js +4 -0
- package/build/DevCommand-CSOEONPY.js.map +1 -0
- package/build/GenerateCommand-LHTPLGNF.js +99 -0
- package/build/GenerateCommand-LHTPLGNF.js.map +1 -0
- package/build/LogsCommand-GUWLKR7V.js +4 -0
- package/build/{LogsCommand-EQAEPQSZ.js.map → LogsCommand-GUWLKR7V.js.map} +1 -1
- package/build/PreviewCommand-QAYLTUIX.js +4 -0
- package/build/ServeCommand-PHOYGKPH.js +4 -0
- package/build/{ServeCommand-CERFKHB5.js.map → ServeCommand-PHOYGKPH.js.map} +1 -1
- package/build/build-N3GC2AJW.js +4 -0
- package/build/build-N3GC2AJW.js.map +1 -0
- package/build/chunk-25SA6SIS.js +4 -0
- package/build/chunk-25SA6SIS.js.map +1 -0
- package/build/chunk-2T5VKPKE.js +4 -0
- package/build/chunk-2T5VKPKE.js.map +1 -0
- package/build/chunk-5CHNGZ6H.js +87 -0
- package/build/chunk-5CHNGZ6H.js.map +1 -0
- package/build/{chunk-VZGLJSBQ.js → chunk-5QLZSP2U.js} +3 -3
- package/build/{chunk-VZGLJSBQ.js.map → chunk-5QLZSP2U.js.map} +1 -1
- package/build/chunk-AS45KVJN.js +4 -0
- package/build/chunk-AS45KVJN.js.map +1 -0
- package/build/chunk-BD6TU75M.js +11 -0
- package/build/{chunk-CU75PFHB.js.map → chunk-BD6TU75M.js.map} +1 -1
- package/build/chunk-C47JQ5AQ.js +4 -0
- package/build/{chunk-PDISMWAG.js.map → chunk-C47JQ5AQ.js.map} +1 -1
- package/build/{chunk-3ZWMQHFG.js → chunk-E74YEX6I.js} +2 -2
- package/build/chunk-E74YEX6I.js.map +1 -0
- package/build/chunk-EF6HOPCP.js +4 -0
- package/build/chunk-EF6HOPCP.js.map +1 -0
- package/build/chunk-GFH6QCDG.js +4 -0
- package/build/{chunk-EUCZHHS6.js.map → chunk-GFH6QCDG.js.map} +1 -1
- package/build/chunk-GRIMGGL3.js +4 -0
- package/build/chunk-H6SYLT4B.js +4 -0
- package/build/chunk-H6SYLT4B.js.map +1 -0
- package/build/chunk-JUS465G2.js +19 -0
- package/build/chunk-JUS465G2.js.map +1 -0
- package/build/chunk-L3HVHNTA.js +4 -0
- package/build/{chunk-VDBUFPPQ.js.map → chunk-L3HVHNTA.js.map} +1 -1
- package/build/chunk-OR2CAHGP.js +4 -0
- package/build/{chunk-ME4U7FVN.js.map → chunk-OR2CAHGP.js.map} +1 -1
- package/build/chunk-PEDWEHXR.js +99 -0
- package/build/chunk-PEDWEHXR.js.map +1 -0
- package/build/{chunk-4VHD7OBV.js → chunk-Q5WWBUFO.js} +2 -2
- package/build/{chunk-RXKVYQVC.js → chunk-SQZ5XNZ2.js} +2 -2
- package/build/chunk-SQZ5XNZ2.js.map +1 -0
- package/build/{chunk-FKNQBY7X.js → chunk-TTWJWXLR.js} +2 -2
- package/build/{chunk-YF675DKE.js → chunk-VH4K3U5M.js} +2 -2
- package/build/chunk-WZE4EKUX.js +4 -0
- package/build/{chunk-2V3FQGOH.js.map → chunk-WZE4EKUX.js.map} +1 -1
- package/build/chunk-XQLBMLA6.js +10 -0
- package/build/chunk-XQLBMLA6.js.map +1 -0
- package/build/chunk-YLBOH353.js +21 -0
- package/build/chunk-YLBOH353.js.map +1 -0
- package/build/chunk-ZFOHUOI6.js +4 -0
- package/build/{chunk-ZTBNOJP4.js.map → chunk-ZFOHUOI6.js.map} +1 -1
- package/build/index.js +12 -12
- package/build/index.js.map +1 -1
- package/build/preview-QZCCFP23.js +4 -0
- package/build/preview-QZCCFP23.js.map +1 -0
- package/build/render-command-AOEWP2JP.js +4 -0
- package/build/{render-command-QZNKMGV3.js.map → render-command-AOEWP2JP.js.map} +1 -1
- package/package.json +11 -10
- package/templates/custom-element/dependencies.json +1 -1
- package/templates/dashboard-modal/dependencies.json +2 -1
- package/templates/dashboard-modal/files/modal.tsx.ejs +4 -2
- package/templates/dashboard-page/dependencies.json +3 -1
- package/templates/dashboard-page/files/page.tsx.ejs +9 -3
- package/templates/dashboard-plugin/dependencies.json +2 -1
- package/templates/dashboard-plugin/files/plugin.tsx.ejs +5 -2
- package/build/CreateVersionCommand-HYIOMYPS.js +0 -4
- package/build/CreateVersionCommand-HYIOMYPS.js.map +0 -1
- package/build/DevCommand-NXVNR5O7.js +0 -4
- package/build/DevCommand-NXVNR5O7.js.map +0 -1
- package/build/GenerateCommand-QZE7QTNX.js +0 -99
- package/build/GenerateCommand-QZE7QTNX.js.map +0 -1
- package/build/LogsCommand-EQAEPQSZ.js +0 -4
- package/build/PreviewCommand-DCQC2ZG7.js +0 -4
- package/build/ServeCommand-CERFKHB5.js +0 -4
- package/build/build-NH7ZWZTO.js +0 -4
- package/build/build-NH7ZWZTO.js.map +0 -1
- package/build/chunk-2V3FQGOH.js +0 -4
- package/build/chunk-3ZWMQHFG.js.map +0 -1
- package/build/chunk-5IJKDSHA.js +0 -4
- package/build/chunk-AHUF5IOW.js +0 -4
- package/build/chunk-AHUF5IOW.js.map +0 -1
- package/build/chunk-BSR2JA4S.js +0 -4
- package/build/chunk-BSR2JA4S.js.map +0 -1
- package/build/chunk-CGSGJIBN.js +0 -10
- package/build/chunk-CGSGJIBN.js.map +0 -1
- package/build/chunk-CU75PFHB.js +0 -11
- package/build/chunk-EUCZHHS6.js +0 -4
- package/build/chunk-HAYBGBEA.js +0 -6
- package/build/chunk-HAYBGBEA.js.map +0 -1
- package/build/chunk-KSQU6TME.js +0 -4
- package/build/chunk-KSQU6TME.js.map +0 -1
- package/build/chunk-ME4U7FVN.js +0 -4
- package/build/chunk-PDISMWAG.js +0 -4
- package/build/chunk-QVFKOTXV.js +0 -87
- package/build/chunk-QVFKOTXV.js.map +0 -1
- package/build/chunk-RXKVYQVC.js.map +0 -1
- package/build/chunk-SEGEUJOD.js +0 -99
- package/build/chunk-SEGEUJOD.js.map +0 -1
- package/build/chunk-VDBUFPPQ.js +0 -4
- package/build/chunk-XKB57U76.js +0 -4
- package/build/chunk-XKB57U76.js.map +0 -1
- package/build/chunk-XT25CBJM.js +0 -21
- package/build/chunk-XT25CBJM.js.map +0 -1
- package/build/chunk-ZF4WFDE4.js +0 -4
- package/build/chunk-ZF4WFDE4.js.map +0 -1
- package/build/chunk-ZTBNOJP4.js +0 -4
- package/build/preview-EV2USTXM.js +0 -4
- package/build/preview-EV2USTXM.js.map +0 -1
- package/build/render-command-QZNKMGV3.js +0 -4
- /package/build/{PreviewCommand-DCQC2ZG7.js.map → PreviewCommand-QAYLTUIX.js.map} +0 -0
- /package/build/{chunk-5IJKDSHA.js.map → chunk-GRIMGGL3.js.map} +0 -0
- /package/build/{chunk-4VHD7OBV.js.map → chunk-Q5WWBUFO.js.map} +0 -0
- /package/build/{chunk-FKNQBY7X.js.map → chunk-TTWJWXLR.js.map} +0 -0
- /package/build/{chunk-YF675DKE.js.map → chunk-VH4K3U5M.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{A as N,D as f,E,v as o,w as u,x as h,y as m,z as p}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{A as N,D as f,E,v as o,w as u,x as h,y as m,z as p}from"./chunk-PEDWEHXR.js";import{q as e}from"./chunk-JUS465G2.js";import{h as S}from"./chunk-V4TR6DCM.js";S();import C from"node:fs/promises";var g=e.object({errorReporting:e.object({url:e.string().optional(),artifact:e.object({fullArtifactId:e.string().max(255).min(1),version:e.string().max(255).min(1)}).optional()}).optional()}),d=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),_=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().uuid().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(g).merge(d).passthrough(),j=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(d).passthrough(),b=e.object({appId:e.string(),componentId:e.string().uuid(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),y=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:_}),compName:e.string().optional(),experiment:b}).passthrough(),A=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(N.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:j}).merge(g).passthrough()}),compName:e.string().optional(),experiment:b}).passthrough(),D=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_WIDGET),compData:e.object({backOfficeExtensionWidget:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),description:e.string().optional(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(d).merge(g).passthrough()}),compName:e.string().optional(),experiment:b}).passthrough(),v=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_MENU_ITEM),compData:e.object({backOfficeExtensionMenuItem:e.object({id:e.string().uuid(),title:e.string().min(1),subtitle:e.string().max(200).optional(),iconKey:e.string().min(3).max(50).optional(),extends:e.string().uuid(),action:e.object({navigateToPage:e.object({pageId:e.string().uuid(),relativeUrl:e.string().optional()}),openModal:e.object({componentId:e.string().uuid(),componentParams:e.record(e.string().min(1),e.string().min(1)).optional()})}).partial().superRefine((r,i)=>{!r.navigateToPage&&!r.openModal&&i.addIssue({code:e.ZodIssueCode.custom,message:"action must have either navigateToPage or openModal"})}),sentryDSN:e.string().optional(),requiredPermission:e.string().optional()}).merge(d).merge(g).passthrough()}),compName:e.string().optional(),experiment:b}).passthrough(),k=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_MODAL),compData:e.object({backOfficeModal:e.object({hostingPlatform:e.string(),title:e.string().nullish(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(d).merge(g).passthrough()}),compName:e.string().optional(),experiment:b}).passthrough(),P=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),F=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),x=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),T=e.object({packageName:e.string().min(2).max(100),version:e.number().int().min(0)}),M=e.object({template:e.string(),name:e.string(),pages:e.enum([h.NONE_PAGES,h.ONCE,h.SPECIFIC_PAGES]),placement:e.enum([m.HEAD,m.BODY_START,m.BODY_END,m.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([p.UNKNOWN,p.FUNCTIONAL,p.ESSENTIAL,p.ANALYTICS,p.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean(),dependencies:e.array(T)}),W=e.object({compId:e.string(),compType:e.literal(o.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:M})}).passthrough(),U=e.object({base:e.object({id:e.string().optional(),name:e.string()}),installation:e.object({base:e.object({autoAdd:e.boolean().optional(),essential:e.boolean().optional(),maxInstances:e.number().optional()}).optional(),widget:e.object({default_preset:e.object({desktop_preset_id:e.string().optional(),tablet_preset_id:e.string().optional(),mobile_preset_id:e.string().optional()}).optional(),region:e.enum([u.BODY,u.FOOTER,u.HEADER])}).optional()}).optional(),widgetData:e.object({tagName:e.string(),scriptUrl:e.string(),scriptType:e.enum([f.NONE,f.COMMON_JS,f.ES_MODULE])}),behaviors:e.object({settings:e.object({settingsUrl:e.string()}).optional(),dashboard:e.object({dashboardPageComponentId:e.string()}).optional()}),size:e.object({width:e.object({allowStretch:e.boolean().optional(),defaultWidth:e.number().optional(),stretchByDefault:e.boolean().optional()}),height:e.object({defaultHeight:e.number(),heightMode:e.enum([E.AUTO,E.FIXED,E.UNKNOWN]).optional()})}),dependencies:e.array(T)}),w=e.object({compId:e.string(),compType:e.literal(o.CUSTOM_ELEMENT_WIDGET),compName:e.string().optional(),compData:e.object({customElementWidget:U})}).passthrough(),B=e.object({compId:e.string().uuid(),compType:e.literal(o.WEBHOOK),compName:e.string().optional(),compData:e.object({webhook:e.object({webhookSlug:e.string(),callbackUrl:e.string()})})}).passthrough(),R=e.object({compType:e.literal(o.TOPOLOGY),compId:e.string(),compName:e.string().optional(),compData:e.object({topology:e.object({topology:e.object({backendApiUrl:e.string().url()})})})}).passthrough(),K=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[y,A,D,v,k,P,F,x,W,w,B,R]))});async function $(r){try{let i=await C.readFile(r,"utf-8");return K.parse(JSON.parse(i))}catch(i){let n=i instanceof Error?i.toString():JSON.stringify(i);throw new Error(`Failed to read App Manifest at ${r}: ${n}`)}}var I=(r,i)=>new URL(r,i).href,O=(r,i)=>{let{scriptAsset:n,iframeUrl:s}=r;return n?{scriptAsset:{...n,url:I(n.url,i)}}:s?{iframeUrl:I(s,i)}:r},L=(r,i)=>({template:r.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",i)}),z=(r,i,n)=>{let s=JSON.parse(JSON.stringify(r)),a=i.endsWith("/")?i:`${i}/`;return s.components.forEach(l=>{let{compData:t,compType:c}=l;c===o.BACK_OFFICE_PAGE&&(t.backOfficePage={...t.backOfficePage,...O(t.backOfficePage,a)}),c===o.BACK_OFFICE_EXTENSION&&(t.backOfficeExtension.widget={...t.backOfficeExtension.widget,...O(t.backOfficeExtension.widget,a)}),c===o.BACK_OFFICE_EXTENSION_WIDGET&&(t.backOfficeExtensionWidget={...t.backOfficeExtensionWidget,...O(t.backOfficeExtensionWidget,a)}),c===o.BACK_OFFICE_MODAL&&(t.backOfficeModal={...t.backOfficeModal,...O(t.backOfficeModal,a)}),c===o.EMBEDDED_SCRIPT&&(t.embeddedScriptComponentData={...t.embeddedScriptComponentData,...L(t.embeddedScriptComponentData,a)}),c===o.CUSTOM_ELEMENT_WIDGET&&(t.customElementWidget={...t.customElementWidget,widgetData:{...t.customElementWidget.widgetData,scriptUrl:I(t.customElementWidget.widgetData.scriptUrl,a)},behaviors:{...t.customElementWidget.behaviors,...t.customElementWidget.behaviors.settings?{settings:{settingsUrl:I(t.customElementWidget.behaviors.settings.settingsUrl,a)}}:{}}}),c===o.WEBHOOK&&n&&(t.webhook={...t.webhook,callbackUrl:`${n}/webhooks`})}),s},Z=(r,i)=>{let{baseApiUrl:n,id:s}=i;if(!s&&!n)return r;let a=JSON.parse(JSON.stringify(r));return a.components.forEach(l=>{l.compType===o.TOPOLOGY&&(s&&(l.compId=s),n&&(l.compData.topology.topology.backendApiUrl=n))}),a};export{$ as a,z as b,Z as c};
|
|
4
|
+
//# sourceMappingURL=chunk-Q5WWBUFO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@wix/cli-app\",\n \"description\": \"CLI tool for Wix apps\",\n \"version\": \"1.1.30\",\n \"author\": \"Amit Dahan\",\n \"dependencies\": {\n \"@wix/cli-cloudflare-runtime\": \"workspace:*\",\n \"@wix/cli-miniflare\": \"workspace:*\",\n \"vite\": \"5.3.2\"\n },\n \"devDependencies\": {\n \"@commander-js/extra-typings\": \"^12.1.0\",\n \"@types/lodash\": \"^4.17.6\",\n \"@types/mustache\": \"^4.2.5\",\n \"@wix/ambassador-cli-site-override-service-v1-site-override\": \"^1.0.5\",\n \"@wix/ambassador-ctp-app-cloud-backend-service-v1-app-cloud-backend-deployment\": \"^1.0.5\",\n \"@wix/ambassador-ctp-app-cloud-deployer-service-v1-app-cloud-deployer\": \"^1.0.21\",\n \"@wix/ambassador-ctp-gradual-rollout-v1-app-config\": \"^1.0.67\",\n \"@wix/ambassador-devcenter-components-v1-component\": \"^1.0.420\",\n \"@wix/arm-client\": \"workspace:*\",\n \"@wix/bi-logger-dev-tools-data\": \"^1.51.0\",\n \"@wix/cli-app-definitions\": \"workspace:*\",\n \"@wix/cli-app-manifest\": \"workspace:*\",\n \"@wix/cli-auth\": \"workspace:*\",\n \"@wix/cli-command-contract\": \"workspace:*\",\n \"@wix/cli-core-definitions\": \"workspace:*\",\n \"@wix/cli-debug-log\": \"workspace:*\",\n \"@wix/cli-error\": \"workspace:*\",\n \"@wix/cli-error-reporting\": \"workspace:*\",\n \"@wix/cli-fs\": \"workspace:*\",\n \"@wix/cli-http-client\": \"workspace:*\",\n \"@wix/cli-http-client-react\": \"workspace:*\",\n \"@wix/cli-i18n\": \"workspace:*\",\n \"@wix/cli-logger\": \"workspace:*\",\n \"@wix/cli-site-selector\": \"workspace:*\",\n \"@wix/cli-ssl\": \"workspace:*\",\n \"@wix/cli-telemetry\": \"workspace:*\",\n \"@wix/cli-telemetry-react\": \"workspace:*\",\n \"@wix/cli-test-overrides\": \"workspace:*\",\n \"@wix/cli-tunnel\": \"workspace:*\",\n \"@wix/cli-ui-kit\": \"workspace:*\",\n \"@wix/cli-user-config\": \"workspace:*\",\n \"@wix/dev-center-client\": \"workspace:*\",\n \"@wix/extensions-data-client\": \"workspace:*\",\n \"@wix/gena\": \"workspace:*\",\n \"@wix/site-list-client\": \"workspace:*\",\n \"@wix/site-override-client\": \"workspace:*\",\n \"@wix/tsup-configs\": \"workspace:*\",\n \"@wix/user-browser\": \"workspace:*\",\n \"chalk\": \"^5.3.0\",\n \"chokidar\": \"^3.6.0\",\n \"commander\": \"^12.1.0\",\n \"fast-equals\": \"^5.0.1\",\n \"form-data\": \"^4.0.0\",\n \"globby\": \"^13.2.2\",\n \"lodash\": \"^4.17.21\",\n \"mustache\": \"^4.2.0\",\n \"p-retry\": \"^5.1.2\",\n \"p-wait-for\": \"^5.0.2\",\n \"prompts\": \"^2.4.2\",\n \"react\": \"^18.3.1\",\n \"semver\": \"^7.6.2\",\n \"tempy\": \"^3.1.0\",\n \"typed-emitter\": \"^2.1.0\",\n \"variant\": \"^3.0.0-dev.27\",\n \"vite-plugin-externals\": \"^0.6.2\",\n \"zod\": \"^3.23.8\",\n \"zod-to-json-schema\": \"^3.23.1\"\n },\n \"engines\": {\n \"node\": \">= 18.16\"\n },\n \"exports\": {\n \".\": \"./build/index.js\",\n \"./client\": {\n \"types\": \"./client.d.ts\"\n },\n \"./internal/component-hmr-wrapper\": \"./internal/component-hmr-wrapper.tsx\",\n \"./tsconfig.app.json\": \"./tsconfig.app.json\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"build\",\n \"schemas\",\n \"tsconfig.app.json\",\n \"client.d.ts\",\n \"internal\",\n \"templates\"\n ],\n \"peerDependencies\": {\n \"react\": \"^16.14 || ^17 || ^18\",\n \"react-dom\": \"^16.14 || ^17 || ^18\"\n },\n \"peerDependenciesMeta\": {\n \"react-dom\": {\n \"optional\": true\n }\n },\n \"perfer\": {\n \"bundleSize\": {\n \"files\": [\n {\n \"glob\": \"./build/index.js\",\n \"maxSize\": \"460kb\"\n }\n ]\n }\n },\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org/\",\n \"access\": \"public\",\n \"versionBumpStrategy\": \"manual\",\n \"logLevel\": \"verbose\"\n },\n \"scripts\": {\n \"build\": \"run -T tsup && yarn generate-schemas\",\n \"build:watch\": \"run -T tsup --watch\",\n \"generate-schemas\": \"node build-scripts/generate-schemas.js\",\n \"lint\": \"run -T lint-package\",\n \"test\": \"yarn workspace @wix/cli-app-spec run test\",\n \"test:watch\": \"yarn workspace @wix/cli-app-spec run test:watch\",\n \"typecheck\": \"run -T tsc --noEmit\"\n },\n \"sideEffects\": false,\n \"type\": \"module\",\n \"wix\": {\n \"artifact\": {\n \"groupId\": \"com.wixpress.npm\",\n \"artifactId\": \"wix-cli-app\"\n },\n \"validations\": {\n \"postBuild\": [\n \"typecheck\",\n \"lint\"\n ]\n }\n }\n}\n"],"mappings":";;AAGE,IAAAA,EAAW","names":["version"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{b as p}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{b as p}from"./chunk-VH4K3U5M.js";import{b as r,c as i}from"./chunk-Q5WWBUFO.js";import{h as o}from"./chunk-V4TR6DCM.js";o();var M=async({model:e,arm:a,serveUrl:n,backendServerUrl:t,topologyComponentId:s})=>{let l=await p(e.projectFolder),m=i(r(l,n,t),{id:s,baseApiUrl:t});return a.createAppRelease(m,e.config.projectId)};export{M as a};
|
|
4
|
+
//# sourceMappingURL=chunk-TTWJWXLR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{a as r}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as r}from"./chunk-Q5WWBUFO.js";import{V as i,j as p}from"./chunk-PEDWEHXR.js";import{h as n}from"./chunk-V4TR6DCM.js";n();async function A({projectFolder:t,manifest:e}){let a=i(t);return p(a,e)}async function M(t){let e=i(t);return r(e)}export{A as a,M as b};
|
|
4
|
+
//# sourceMappingURL=chunk-VH4K3U5M.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as W}from"./chunk-GFH6QCDG.js";import{b as me}from"./chunk-BD6TU75M.js";import{b as H,c as ye,d as ge,e as _e}from"./chunk-ZFOHUOI6.js";import{a as fe}from"./chunk-C47JQ5AQ.js";import{c as pe,d as K,g as ae}from"./chunk-YLBOH353.js";import{A as C,B as y,D as le,d as re,e as se,l as M,m as O,q as B,r as ne,t as v,u as j,w as b,x as q}from"./chunk-5CHNGZ6H.js";import{F as ce,Ta as F,p as ie,q as oe,qa as ue,va as de,wa as Se}from"./chunk-PEDWEHXR.js";import{a as f,b as w,d as T,e as P,q as A,r as te}from"./chunk-JUS465G2.js";import{e as p,h as o}from"./chunk-V4TR6DCM.js";o();var I=p(f(),1),Z=p(w(),1);o();var D=p(f(),1),G=p(w(),1);o();o();var g=p(f(),1),Ee=p(w(),1);o();var U=p(f(),1),Ce=p(w(),1);o();var ve=p(f(),1);function De(e){return{cliAction:({question:s,action:r,key:t,additionalInfo:i})=>e.report(Se({question:s,action:r,key:t,additionalInfo:JSON.stringify(i)})),cliFlowStepAnswered:({question:s,answer:r,additionalInfo:t})=>e.report(de({question:s,answer:r,additionalInfo:JSON.stringify(t)}))}}function k(){let e=K();return(0,ve.useMemo)(()=>De(e),[e])}var we=({onSubmit:e,onError:s,sites:r})=>{let t=k(),{t:i}=y(),{getDevSitesCount:n,getDevSitesLimit:l}=W(),{status:_}=b(()=>Promise.all([n(),l()]),[],{onError:s}),c=S=>{t.cliFlowStepAnswered({question:i("site_type_select.label"),answer:S.title}),e(S.value)};return(0,Ce.match)(_,{Error:()=>null,Loading:()=>U.default.createElement(v,{text:i("general.loading")}),Success:({result:[S,m]})=>{let a=S>=m,Le=r.length===0;return U.default.createElement(O,{label:i("site_type_select.label"),options:[{availability:Le?M.Disabled({reason:i("site_type_select.no_sites")}):M.Enabled(),title:i("site_type_select.pick_existing_site"),value:"select-existing-site"},{title:i("site_type_select.create_new_dev_site"),value:"create-dev-site",availability:a?M.Disabled({reason:i("site_type_select.create_new_dev_site.disabled",{limit:m})}):M.Enabled()}],onSubmit:c})}})};o();var h=p(f(),1),he=p(w(),1);o();var z=p(f(),1);o();o();var xe=p(f(),1);o();o();var be=A.record(A.object({appDefinitionId:A.string().optional(),permissions:A.object({revoked:A.boolean()}).optional()}));var $=class{constructor(s){this.httpClient=s}isAppInstalled=async({metaSiteId:s,appId:r})=>{try{let{data:t}=await this.httpClient.request({url:`/_api/msm/v1/meta-site/editor-client-spec-map/${s}`}),i=be.parse(t);return Object.values(i).some(l=>l.appDefinitionId===r&&!l.permissions?.revoked)}catch(t){throw new T({code:P.FailedToCheckIfAppInstalled(),cause:t})}}};function N(){let e=fe({type:"general"});return(0,xe.useMemo)(()=>new $(e),[e])}var L=p(w(),1);o();var E=p(f(),1);var Ie=({siteId:e,appId:s})=>{let{t:r}=y(),t=k();return re(async(i,n)=>{n.return&&(t.cliAction({question:r("install_app_on_site.warning.instructions"),key:"enter",action:"install_app_on_site"}),await ae(`https://manage.wix.com/installer/install?metaSiteId=${e}&appId=${s}&platform=cli&version=latest`))}),E.default.createElement(E.default.Fragment,null,E.default.createElement(C,{i18nKey:"install_app_on_site.warning"}),E.default.createElement(C,{i18nKey:"install_app_on_site.warning.instructions",components:[E.default.createElement(ne,{value:"enter"})]}))};var Q=(0,L.variant)({Success:{},Canceled:{}});function Me(e){return e&&typeof e=="object"&&"name"in e&&e.name==="AbortError"}var J=({appId:e,site:s,onSubmit:r,onError:t})=>{let{isAppInstalled:i}=N(),{status:n}=b(async({signal:l})=>{let{appInstallationPollInterval:_}=te();try{return await oe(()=>i({metaSiteId:s.id,appId:e}),{interval:_??2e3,timeout:{milliseconds:60*1e3*2,signal:l}}),Q.Success()}catch(c){if(c instanceof ie)throw new T({code:P.SiteSelectorTimedout(),cause:c});if(Me(c))return Q.Canceled();throw c}},[],{onError:t,onSuccess:l=>{(0,L.isType)(l,Q.Success)&&r()}});return(0,L.match)(n,{Error:()=>null,Loading:()=>z.default.createElement(Ie,{siteId:s.id,appId:e}),Success:()=>z.default.createElement(B,{type:"success"},z.default.createElement(C,{i18nKey:"install_app_on_site.finished_successfully"}))})};var Te=({status:e,appId:s,onSubmit:r,onError:t})=>{let{t:i}=y();return(0,he.match)(e,{NotRequested:()=>null,Error:()=>null,Loading:()=>h.default.createElement(v,{text:i("create_dev_site.loading")}),Success:({result:n})=>h.default.createElement(h.default.Fragment,null,h.default.createElement(C,{i18nKey:"create_dev_site.success",components:[h.default.createElement(se,{skin:"success",bold:!0})],values:{name:n.displayName}}),h.default.createElement(J,{appId:s,site:n,onSubmit:()=>r(n),onError:t}))})};var Pe={"general.loading":"Loading...","site_type_select.label":"Select Development Site","site_type_select.create_new_dev_site":"Create a new Development Site","site_type_select.create_new_dev_site.disabled":"You have reached the maximum number of {limit} Development Sites","site_type_select.pick_existing_site":"Pick an existing site","site_type_select.no_sites":"No sites found","create_dev_site.loading":"Creating your new Development Site...","create_dev_site.success":"Development Site <0>{name}</0> created successfully! \u{1F680}","site_list_select.label":"Select Site","install_app_on_site.warning":"Your new application needs to be installed on the selected Development Site","install_app_on_site.warning.instructions":"Press <0/> to install the application in your browser","install_app_on_site.finished_successfully":"App installed on Development Site."};o();var x=p(f(),1);var Fe=p(w(),1);o();var Y=p(f(),1);var Ae=({onSubmit:e,sites:s})=>{let{t:r}=y(),t=k(),i=(0,Y.useCallback)(n=>{t.cliFlowStepAnswered({question:r("site_list_select.label"),answer:n.title}),e(n.value)},[t,e,r]);return Y.default.createElement(O,{label:r("site_list_select.label"),options:s.map(n=>({key:n.id,title:n.displayName,description:n.viewUrl,value:n})),onSubmit:i})};var ke=({sites:e,appId:s,onSubmit:r,onError:t})=>{let{t:i}=y(),{isAppInstalled:n}=N(),[l,_]=(0,x.useState)(null),c=q((m,a)=>n({metaSiteId:a.id,appId:s}),{onError:t});async function S(m){await c.execute(m)?r(m):_(m)}return x.default.createElement(x.default.Fragment,null,x.default.createElement(Ae,{onSubmit:S,sites:e}),(0,Fe.isType)(c.status,"Loading")&&x.default.createElement(v,{text:i("general.loading")}),l&&x.default.createElement(J,{appId:s,site:l,onSubmit:()=>r(l),onError:t}))};var V=({appId:e,biLogger:s,onSubmit:r,onError:t})=>{let[i,n]=(0,g.useState)(null),{createDevSite:l}=W(),_=H(),{status:c}=b(()=>_.querySites({query:{cursorPaging:{limit:100}}}),[],{onError:t}),S=q(()=>l(),{onError:t});function m(a){n(a),a==="create-dev-site"&&S.execute()}return g.default.createElement(pe,{value:s},g.default.createElement(le,{messages:Pe},(0,Ee.match)(c,{Error:()=>null,Loading:()=>g.default.createElement(v,{text:g.default.createElement(C,{i18nKey:"general.loading"})}),Success:({result:a})=>g.default.createElement(g.default.Fragment,null,g.default.createElement(we,{onSubmit:m,onError:t,sites:a}),i==="create-dev-site"&&g.default.createElement(Te,{status:S.status,appId:e,onSubmit:r,onError:t}),i==="select-existing-site"&&g.default.createElement(ke,{sites:a,appId:e,onSubmit:r,onError:t}))})))};var X=({state:e,onSubmit:s})=>{let r=j(),{t}=y(),{model:i}=F(),n=K();return D.default.createElement(D.default.Fragment,null,(0,G.match)(e,{NotConfigured:(0,G.constant)(D.default.createElement(B,{type:"insight"},t("general.no_site_id_configured"))),NotFound:({id:l})=>D.default.createElement(B,{type:"error"},t("general.site_id_not_found",{id:l}))}),D.default.createElement(V,{appId:i.config.appId,biLogger:n,onSubmit:s,onError:r}))};var gi=({children:e,siteId:s})=>{let r=j(),{model:{projectFolder:t}}=F(),i=me(),n=H(),{status:l,merge:_}=b(async()=>_e({projectFolder:t,siteListClient:n,siteId:s,writeDebugLog:i}),[]),c=(0,I.useCallback)(async m=>{try{await ue(t,{siteId:m.id}),_({result:ge.Resolved({site:m})})}catch{throw new T({code:P.FailedToSaveDevelopmentSite({path:ce})})}},[_,t]),S=(0,I.useCallback)(m=>c(m).catch(r),[r,c]);return(0,Z.match)(l,{Error:()=>null,Loading:()=>I.default.createElement(v,null),Success:({result:m})=>(0,Z.match)(m,{NotConfigured:a=>I.default.createElement(X,{state:a,onSubmit:S}),NotFound:a=>I.default.createElement(X,{state:a,onSubmit:S}),Resolved:({site:a})=>I.default.createElement(ye.Provider,{value:{site:a,setSite:c}},typeof e=="function"?e(a):e)})})};o();var R=p(f(),1),ee=p(w(),1);function wi(){let{model:e}=F(),s=(0,R.useCallback)(t=>e.components.some(i=>i.platforms.some((0,ee.isType)(t.type))),[e.components]),r=(0,R.useCallback)(t=>e.components.every(i=>i.platforms.some((0,ee.isType)(t.type))||i.platforms.length===0),[e.components]);return{isPlatformExists:s,hasSinglePlatform:r}}export{V as a,gi as b,wi as c};
|
|
4
|
+
//# sourceMappingURL=chunk-WZE4EKUX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/site-id/SiteIdProvider.tsx","../src/site-id/ResolveSiteId.tsx","../../cli-site-selector/src/index.ts","../../cli-site-selector/src/SiteSelector.tsx","../../cli-site-selector/src/SiteTypeSelect.tsx","../../cli-site-selector/src/bi.ts","../../cli-site-selector/src/CreateDevSite.tsx","../../cli-site-selector/src/WaitForAppToBeInstalled.tsx","../../metasite-manager-client/src/index.ts","../../metasite-manager-client/src/useMetasiteManagerClient.ts","../../metasite-manager-client/src/metasite-manager-client.ts","../../metasite-manager-client/src/schemas.ts","../../cli-site-selector/src/OpenBrowser.tsx","../../cli-site-selector/src/messages.json","../../cli-site-selector/src/SelectExistingSite.tsx","../../cli-site-selector/src/SiteListSelect.tsx","../src/components/Platform/usePlatform.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback } from 'react';\nimport { match } from 'variant';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { APP_CONFIG_PATH } from '@wix/cli-app-definitions';\nimport { useAsync, useExit, Spinner } from '@wix/cli-ui-kit';\nimport { type Site, useSiteListClient } from '@wix/site-list-client';\nimport { saveAppConfig } from '../files/app.config.js';\nimport { useProjectModel } from '../model.js';\nimport { ResolveSiteId } from './ResolveSiteId.js';\nimport { SiteIdContext } from './context.js';\nimport { SiteIdState } from './site-id-state.js';\nimport { resolveConfiguredSite } from './resolve-configured-site.js';\n\nexport const SiteIdProvider: FC<{\n siteId?: string;\n children: ReactNode | ((site: Site) => ReactNode);\n}> = ({ children, siteId }) => {\n const exit = useExit();\n const {\n model: { projectFolder },\n } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const siteListClient = useSiteListClient();\n\n const { status, merge } = useAsync(\n async () =>\n resolveConfiguredSite({\n projectFolder,\n siteListClient,\n siteId,\n writeDebugLog,\n }),\n []\n );\n\n const setSite = useCallback(\n async (site: Site) => {\n try {\n await saveAppConfig(projectFolder, { siteId: site.id });\n merge({ result: SiteIdState.Resolved({ site }) });\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToSaveDevelopmentSite({\n path: APP_CONFIG_PATH,\n }),\n });\n }\n },\n [merge, projectFolder]\n );\n\n const handleResolveSiteId = useCallback(\n (site: Site) => setSite(site).catch(exit),\n [exit, setSite]\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner />,\n Success: ({ result: state }) => {\n return match(state, {\n NotConfigured: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n NotFound: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n Resolved: ({ site }) => (\n <SiteIdContext.Provider\n value={{\n site,\n setSite,\n }}\n >\n {typeof children === 'function' ? children(site) : children}\n </SiteIdContext.Provider>\n ),\n });\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match, constant } from 'variant';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, useExit } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SiteSelector } from '@wix/cli-site-selector';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { useProjectModel } from '../model.js';\nimport type { SiteIdState } from './site-id-state.js';\n\ninterface Props {\n state: SiteIdState<'NotConfigured' | 'NotFound'>;\n onSubmit: (site: Site) => void;\n}\n\nexport const ResolveSiteId: FC<Props> = ({ state, onSubmit }) => {\n const exit = useExit();\n const { t } = useTranslation();\n const { model } = useProjectModel();\n const biLogger = useBiLogger();\n\n return (\n <>\n {match(state, {\n NotConfigured: constant(\n <Alert type=\"insight\">{t('general.no_site_id_configured')}</Alert>\n ),\n NotFound: ({ id }) => (\n <Alert type=\"error\">{t('general.site_id_not_found', { id })}</Alert>\n ),\n })}\n <SiteSelector\n appId={model.config.appId}\n biLogger={biLogger}\n onSubmit={onSubmit}\n onError={exit}\n />\n </>\n );\n};\n","export { SiteSelector } from './SiteSelector.js';\n","import React, { type FC, useState } from 'react';\nimport { match } from 'variant';\nimport { I18nProvider, Trans } from '@wix/cli-i18n';\nimport type { Site } from '@wix/site-list-client';\nimport { Spinner, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport { useSiteListClient } from '@wix/site-list-client';\nimport type { BiLogger } from '@wix/cli-telemetry';\nimport { BiProvider } from '@wix/cli-telemetry-react';\nimport { SiteTypeSelect, type SiteType } from './SiteTypeSelect.js';\nimport { CreateDevSite } from './CreateDevSite.js';\nimport messages from './messages.json';\nimport { SelectExistingSite } from './SelectExistingSite.js';\n\ninterface Props {\n appId: string;\n biLogger: BiLogger;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SiteSelector: FC<Props> = ({\n appId,\n biLogger,\n onSubmit,\n onError,\n}) => {\n const [siteType, setSiteType] = useState<SiteType | null>(null);\n const { createDevSite } = useDevCenterClient();\n const siteListClient = useSiteListClient();\n\n const { status } = useAsync(\n () =>\n siteListClient.querySites({\n query: {\n cursorPaging: {\n limit: 100,\n },\n },\n }),\n [],\n {\n onError,\n }\n );\n\n const createSite = useAsyncCallback(() => createDevSite(), {\n onError,\n });\n\n function handleSelectSiteType(siteType: SiteType) {\n setSiteType(siteType);\n if (siteType === 'create-dev-site') {\n createSite.execute();\n }\n }\n\n return (\n <BiProvider value={biLogger}>\n <I18nProvider messages={messages}>\n {match(status, {\n Error: () => null,\n Loading: () => <Spinner text={<Trans i18nKey=\"general.loading\" />} />,\n Success: ({ result: sites }) => (\n <>\n <SiteTypeSelect\n onSubmit={handleSelectSiteType}\n onError={onError}\n sites={sites}\n />\n {siteType === 'create-dev-site' && (\n <CreateDevSite\n status={createSite.status}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n {siteType === 'select-existing-site' && (\n <SelectExistingSite\n sites={sites}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n </>\n ),\n })}\n </I18nProvider>\n </BiProvider>\n );\n};\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport type { SelectOption } from '@wix/cli-ui-kit';\nimport {\n Spinner,\n SelectInput,\n useAsync,\n SelectOptionAvailability,\n} from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport type { Site } from '@wix/site-list-client';\nimport { useSiteSelectorBi } from './bi.js';\n\nexport type SiteType = 'create-dev-site' | 'select-existing-site';\ninterface Props {\n onSubmit: (siteType: SiteType) => void;\n onError: (error: unknown) => void;\n sites: Site[];\n}\n\nexport const SiteTypeSelect: FC<Props> = ({ onSubmit, onError, sites }) => {\n const bi = useSiteSelectorBi();\n const { t } = useTranslation();\n const { getDevSitesCount, getDevSitesLimit } = useDevCenterClient();\n const { status } = useAsync(\n () => Promise.all([getDevSitesCount(), getDevSitesLimit()]),\n [],\n { onError }\n );\n\n const handleSubmit = (option: SelectOption<SiteType>) => {\n bi.cliFlowStepAnswered({\n question: t('site_type_select.label'),\n answer: option.title,\n });\n onSubmit(option.value);\n };\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: [devSitesCount, devSitesLimit] }) => {\n const isDevSitesLimitReached = devSitesCount >= devSitesLimit;\n const userHasNoSites = sites.length === 0;\n\n return (\n <SelectInput<SiteType>\n label={t('site_type_select.label')}\n options={[\n {\n availability: userHasNoSites\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.no_sites'),\n })\n : SelectOptionAvailability.Enabled(),\n title: t('site_type_select.pick_existing_site'),\n value: 'select-existing-site',\n },\n {\n title: t('site_type_select.create_new_dev_site'),\n value: 'create-dev-site',\n availability: isDevSitesLimitReached\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.create_new_dev_site.disabled', {\n limit: devSitesLimit,\n }),\n })\n : SelectOptionAvailability.Enabled(),\n },\n ]}\n onSubmit={handleSubmit}\n />\n );\n },\n });\n};\n","import { useMemo } from 'react';\nimport type { BiLogger } from '@wix/cli-telemetry';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport {\n wixCliAction,\n wixCliAppFlowStepsAnswers,\n} from '@wix/bi-logger-dev-tools-data/v2';\n\nexport function siteSelectorBiEvents(biLogger: BiLogger) {\n return {\n cliAction: ({\n question,\n action,\n key,\n additionalInfo,\n }: {\n question: string;\n action: string;\n key: string;\n additionalInfo?: Record<string, unknown>;\n }) =>\n biLogger.report(\n wixCliAction({\n question,\n action,\n key,\n additionalInfo: JSON.stringify(additionalInfo),\n })\n ),\n cliFlowStepAnswered: ({\n question,\n answer,\n additionalInfo,\n }: {\n question: string;\n answer: string;\n additionalInfo?: Record<string, unknown>;\n }) =>\n biLogger.report(\n wixCliAppFlowStepsAnswers({\n question,\n answer,\n additionalInfo: JSON.stringify(additionalInfo),\n })\n ),\n };\n}\n\nexport function useSiteSelectorBi() {\n const biLogger = useBiLogger();\n return useMemo(() => siteSelectorBiEvents(biLogger), [biLogger]);\n}\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Text, Spinner } from '@wix/cli-ui-kit';\nimport type { Site } from '@wix/site-list-client';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\n\ninterface Props {\n status: AsyncCallbackStatus<Site>;\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const CreateDevSite: FC<Props> = ({\n status,\n appId,\n onSubmit,\n onError,\n}) => {\n const { t } = useTranslation();\n\n return match(status, {\n NotRequested: () => null,\n Error: () => null,\n Loading: () => <Spinner text={t('create_dev_site.loading')} />,\n Success: ({ result }) => (\n <>\n <Trans\n i18nKey=\"create_dev_site.success\"\n components={[<Text skin=\"success\" bold />]}\n values={{ name: result.displayName }}\n />\n <WaitForAppToBeInstalled\n appId={appId}\n site={result}\n onSubmit={() => onSubmit(result)}\n onError={onError}\n />\n </>\n ),\n });\n};\n","import pWaitFor, { TimeoutError } from 'p-wait-for';\nimport React, { type FC } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { Alert, useAsync } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport { isType, match, variant } from 'variant';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { Site } from '@wix/site-list-client';\nimport { OpenBrowser } from './OpenBrowser.js';\n\ninterface Props {\n site: Site;\n appId: string;\n onSubmit: () => void;\n onError: (error: unknown) => void;\n}\n\nexport const AppInstallData = variant({\n Success: {},\n Canceled: {},\n});\n\nfunction isAbortError(error: unknown) {\n return (\n error &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError'\n );\n}\n\nexport const WaitForAppToBeInstalled: FC<Props> = ({\n appId,\n site,\n onSubmit,\n onError,\n}) => {\n const { isAppInstalled } = useMetasiteManagerClient();\n\n const { status } = useAsync(\n async ({ signal }) => {\n const { appInstallationPollInterval } = getTestOverrides();\n\n try {\n await pWaitFor(() => isAppInstalled({ metaSiteId: site.id, appId }), {\n interval: appInstallationPollInterval ?? 2000,\n timeout: {\n milliseconds: 60 * 1000 * 2,\n signal,\n },\n });\n\n return AppInstallData.Success();\n } catch (error) {\n if (error instanceof TimeoutError) {\n throw new CliError({\n code: CliErrorCode.SiteSelectorTimedout(),\n cause: error,\n });\n }\n\n if (isAbortError(error)) {\n return AppInstallData.Canceled();\n }\n\n throw error;\n }\n },\n [],\n {\n onError,\n onSuccess: (result) => {\n if (isType(result, AppInstallData.Success)) {\n onSubmit();\n }\n },\n }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <OpenBrowser siteId={site.id} appId={appId} />,\n Success: () => (\n <Alert type=\"success\">\n <Trans i18nKey=\"install_app_on_site.finished_successfully\" />\n </Alert>\n ),\n });\n};\n","export { useMetasiteManagerClient } from './useMetasiteManagerClient.js';\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { MetasiteManagerClient } from './metasite-manager-client.js';\n\nexport function useMetasiteManagerClient(): MetasiteManagerClient {\n const httpClient = useHttpClient({ type: 'general' });\n return useMemo(() => new MetasiteManagerClient(httpClient), [httpClient]);\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { clientSpecMapSchema } from './schemas.js';\n\nexport class MetasiteManagerClient {\n constructor(private readonly httpClient: HttpClient) {}\n\n public isAppInstalled = async ({\n metaSiteId,\n appId,\n }: {\n metaSiteId: string;\n appId: string;\n }) => {\n try {\n const { data } = await this.httpClient.request({\n url: `/_api/msm/v1/meta-site/editor-client-spec-map/${metaSiteId}`,\n });\n\n const clientSpecMap = clientSpecMapSchema.parse(data);\n\n const isInstalled = Object.values(clientSpecMap).some(\n (spec) => spec.appDefinitionId === appId && !spec.permissions?.revoked\n );\n\n return isInstalled;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCheckIfAppInstalled(),\n cause: e,\n });\n }\n };\n}\n","import { z } from 'zod';\n\nexport const clientSpecMapSchema = z.record(\n z.object({\n appDefinitionId: z.string().optional(),\n permissions: z.object({ revoked: z.boolean() }).optional(),\n })\n);\n\nexport type ClientSpecMap = z.TypeOf<typeof clientSpecMapSchema>;\n","import React, { type FC } from 'react';\nimport { Key, useInput } from '@wix/cli-ui-kit';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport { openBrowser } from '@wix/user-browser';\nimport { useSiteSelectorBi } from './bi.js';\n\ninterface Props {\n siteId: string;\n appId: string;\n}\n\nexport const OpenBrowser: FC<Props> = ({ siteId, appId }) => {\n const { t } = useTranslation();\n const bi = useSiteSelectorBi();\n\n useInput(async (input, key) => {\n if (key.return) {\n bi.cliAction({\n question: t('install_app_on_site.warning.instructions'),\n key: 'enter',\n action: 'install_app_on_site',\n });\n await openBrowser(\n `https://manage.wix.com/installer/install?metaSiteId=${siteId}&appId=${appId}&platform=cli&version=latest`\n );\n }\n });\n\n return (\n <>\n <Trans i18nKey=\"install_app_on_site.warning\" />\n <Trans\n i18nKey=\"install_app_on_site.warning.instructions\"\n components={[<Key value=\"enter\" />]}\n />\n </>\n );\n};\n","{\n \"general.loading\": \"Loading...\",\n \"site_type_select.label\": \"Select Development Site\",\n \"site_type_select.create_new_dev_site\": \"Create a new Development Site\",\n \"site_type_select.create_new_dev_site.disabled\": \"You have reached the maximum number of {limit} Development Sites\",\n \"site_type_select.pick_existing_site\": \"Pick an existing site\",\n \"site_type_select.no_sites\": \"No sites found\",\n \"create_dev_site.loading\": \"Creating your new Development Site...\",\n \"create_dev_site.success\": \"Development Site <0>{name}</0> created successfully! 🚀\",\n \"site_list_select.label\": \"Select Site\",\n \"install_app_on_site.warning\": \"Your new application needs to be installed on the selected Development Site\",\n \"install_app_on_site.warning.instructions\": \"Press <0/> to install the application in your browser\",\n \"install_app_on_site.finished_successfully\": \"App installed on Development Site.\"\n}\n","import React, { useState } from 'react';\nimport { Spinner, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport type { Site } from '@wix/site-list-client';\nimport { isType } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\nimport { SiteListSelect } from './SiteListSelect.js';\n\ninterface Props {\n sites: Site[];\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SelectExistingSite = ({\n sites,\n appId,\n onSubmit,\n onError,\n}: Props) => {\n const { t } = useTranslation();\n const { isAppInstalled } = useMetasiteManagerClient();\n const [siteToInstallAppOn, setSiteToInstallAppOn] = useState<Site | null>(\n null\n );\n const checkAppInstalled = useAsyncCallback(\n (_, site: Site) => isAppInstalled({ metaSiteId: site.id, appId }),\n {\n onError,\n }\n );\n\n async function handleSelectSite(site: Site) {\n const isInstalled = await checkAppInstalled.execute(site);\n if (isInstalled) {\n onSubmit(site);\n } else {\n setSiteToInstallAppOn(site);\n }\n }\n\n return (\n <>\n <SiteListSelect onSubmit={handleSelectSite} sites={sites} />\n {isType(checkAppInstalled.status, 'Loading') && (\n <Spinner text={t('general.loading')} />\n )}\n {siteToInstallAppOn && (\n <WaitForAppToBeInstalled\n appId={appId}\n site={siteToInstallAppOn}\n onSubmit={() => onSubmit(siteToInstallAppOn)}\n onError={onError}\n />\n )}\n </>\n );\n};\n","import React, { useCallback, type FC } from 'react';\nimport { useTranslation } from '@wix/cli-i18n';\nimport type { SelectOption } from '@wix/cli-ui-kit';\nimport { SelectInput } from '@wix/cli-ui-kit';\nimport { type Site } from '@wix/site-list-client';\nimport { useSiteSelectorBi } from './bi.js';\n\ninterface Props {\n onSubmit: (site: Site) => void;\n sites: Site[];\n}\n\nexport const SiteListSelect: FC<Props> = ({ onSubmit, sites }) => {\n const { t } = useTranslation();\n const bi = useSiteSelectorBi();\n\n const handleSubmit = useCallback(\n (option: SelectOption<Site>) => {\n bi.cliFlowStepAnswered({\n question: t('site_list_select.label'),\n answer: option.title,\n });\n onSubmit(option.value);\n },\n [bi, onSubmit, t]\n );\n\n return (\n <SelectInput<Site>\n label={t('site_list_select.label')}\n options={sites.map((site) => ({\n key: site.id,\n title: site.displayName,\n description: site.viewUrl,\n value: site,\n }))}\n onSubmit={handleSubmit}\n />\n );\n};\n","import { useCallback } from 'react';\nimport { isType } from 'variant';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport { useProjectModel } from '../../model.js';\n\nexport function usePlatform() {\n const { model } = useProjectModel();\n\n const isPlatformExists = useCallback(\n (platformType: PlatformType) =>\n model.components.some((component) =>\n component.platforms.some(isType(platformType.type))\n ),\n [model.components]\n );\n\n const hasSinglePlatform = useCallback(\n (platformType: PlatformType) =>\n model.components.every(\n (component) =>\n component.platforms.some(isType(platformType.type)) ||\n component.platforms.length === 0\n ),\n [model.components]\n );\n\n return {\n isPlatformExists,\n hasSinglePlatform,\n };\n}\n"],"mappings":";;0jBAAAA,IACA,IAAAC,EAAsB,SADtB,OAAOC,GAAkC,eAAAC,OAAmB,QCA5DC,IACA,IAAAC,EAAgC,SADhC,OAAOC,MAAwB,QCA/BC,ICAAC,IACA,IAAAC,GAAsB,SADtB,OAAOC,GAAkB,YAAAC,OAAgB,QCAzCC,IACA,IAAAC,GAAsB,SADtB,OAAOC,OAAwB,QCA/BC,IAAA,OAAS,WAAAC,OAAe,QAQjB,SAASC,GAAqBC,EAAoB,CACvD,MAAO,CACL,UAAW,CAAC,CACV,SAAAC,EACA,OAAAC,EACA,IAAAC,EACA,eAAAC,CACF,IAMEJ,EAAS,OACPK,GAAa,CACX,SAAAJ,EACA,OAAAC,EACA,IAAAC,EACA,eAAgB,KAAK,UAAUC,CAAc,CAC/C,CAAC,CACH,EACF,oBAAqB,CAAC,CACpB,SAAAH,EACA,OAAAK,EACA,eAAAF,CACF,IAKEJ,EAAS,OACPO,GAA0B,CACxB,SAAAN,EACA,OAAAK,EACA,eAAgB,KAAK,UAAUF,CAAc,CAC/C,CAAC,CACH,CACJ,CACF,CAEO,SAASI,GAAoB,CAClC,IAAMR,EAAWS,EAAY,EAC7B,OAAOC,GAAQ,IAAMX,GAAqBC,CAAQ,EAAG,CAACA,CAAQ,CAAC,CACjE,CD9BO,IAAMW,GAA4B,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAS,MAAAC,CAAM,IAAM,CACz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AAUJ,EAAqB,EAEhE,SAAU,CAAC,CAAE,KAAAN,CAAK,IAChBO,EAAA,cAACK,GAAc,SAAd,CACC,MAAO,CACL,KAAAZ,EACA,QAAAF,CACF,GAEC,OAAOd,GAAa,WAAaA,EAASgB,CAAI,EAAIhB,CACrD,CAEJ,CAAC,CAEL,CAAC,CACH,EgBjFA6B,IACA,IAAAC,EAAuB,SADvB,OAAS,eAAAC,OAAmB,QAKrB,SAASC,IAAc,CAC5B,GAAM,CAAE,MAAAC,CAAM,EAAIC,EAAgB,EAE5BC,EAAmBC,GACtBC,GACCJ,EAAM,WAAW,KAAMK,GACrBA,EAAU,UAAU,QAAK,UAAOD,EAAa,IAAI,CAAC,CACpD,EACF,CAACJ,EAAM,UAAU,CACnB,EAEMM,EAAoBH,GACvBC,GACCJ,EAAM,WAAW,MACdK,GACCA,EAAU,UAAU,QAAK,UAAOD,EAAa,IAAI,CAAC,GAClDC,EAAU,UAAU,SAAW,CACnC,EACF,CAACL,EAAM,UAAU,CACnB,EAEA,MAAO,CACL,iBAAAE,EACA,kBAAAI,CACF,CACF","names":["init_esm_shims","import_variant","React","useCallback","init_esm_shims","import_variant","React","init_esm_shims","init_esm_shims","import_variant","React","useState","init_esm_shims","import_variant","React","init_esm_shims","useMemo","siteSelectorBiEvents","biLogger","question","action","key","additionalInfo","wixCliAction","answer","wixCliAppFlowStepsAnswers","useSiteSelectorBi","useBiLogger","useMemo","SiteTypeSelect","onSubmit","onError","sites","bi","useSiteSelectorBi","t","useTranslation","getDevSitesCount","getDevSitesLimit","useDevCenterClient","status","useAsync","handleSubmit","option","React","Spinner","devSitesCount","devSitesLimit","isDevSitesLimitReached","userHasNoSites","SelectInput","SelectOptionAvailability","init_esm_shims","import_variant","React","init_esm_shims","React","init_esm_shims","init_esm_shims","useMemo","init_esm_shims","init_esm_shims","clientSpecMapSchema","z","MetasiteManagerClient","httpClient","metaSiteId","appId","data","clientSpecMap","clientSpecMapSchema","spec","e","CliError","CliErrorCode","useMetasiteManagerClient","httpClient","useHttpClient","useMemo","MetasiteManagerClient","import_variant","init_esm_shims","React","OpenBrowser","siteId","appId","t","useTranslation","bi","useSiteSelectorBi","use_input_default","input","key","openBrowser","React","Trans","Key","AppInstallData","isAbortError","error","WaitForAppToBeInstalled","appId","site","onSubmit","onError","isAppInstalled","useMetasiteManagerClient","status","useAsync","signal","appInstallationPollInterval","getTestOverrides","pWaitFor","TimeoutError","CliError","CliErrorCode","result","React","OpenBrowser","Alert","Trans","CreateDevSite","status","appId","onSubmit","onError","t","useTranslation","React","Spinner","result","Trans","Text","WaitForAppToBeInstalled","messages_default","init_esm_shims","React","useState","import_variant","init_esm_shims","React","useCallback","SiteListSelect","onSubmit","sites","t","useTranslation","bi","useSiteSelectorBi","handleSubmit","useCallback","option","React","SelectInput","site","SelectExistingSite","sites","appId","onSubmit","onError","t","useTranslation","isAppInstalled","useMetasiteManagerClient","siteToInstallAppOn","setSiteToInstallAppOn","useState","checkAppInstalled","useAsyncCallback","_","site","handleSelectSite","React","SiteListSelect","Spinner","WaitForAppToBeInstalled","SiteSelector","appId","biLogger","onSubmit","onError","siteType","setSiteType","useState","createDevSite","useDevCenterClient","siteListClient","useSiteListClient","status","useAsync","createSite","useAsyncCallback","handleSelectSiteType","React","BiProvider","I18nProvider","messages_default","Spinner","Trans","sites","SiteTypeSelect","CreateDevSite","SelectExistingSite","ResolveSiteId","state","onSubmit","exit","useExit","useTranslation","model","useProjectModel","biLogger","useBiLogger","React","Alert","id","SiteSelector","SiteIdProvider","children","siteId","exit","useExit","projectFolder","useProjectModel","writeDebugLog","useDebugLog","siteListClient","useSiteListClient","status","merge","useAsync","resolveConfiguredSite","setSite","useCallback","site","saveAppConfig","SiteIdState","CliError","CliErrorCode","APP_CONFIG_PATH","handleResolveSiteId","React","Spinner","state","variant","ResolveSiteId","SiteIdContext","init_esm_shims","import_variant","useCallback","usePlatform","model","useProjectModel","isPlatformExists","useCallback","platformType","component","hasSinglePlatform"]}
|
|
1
|
+
{"version":3,"sources":["../src/site-id/SiteIdProvider.tsx","../src/site-id/ResolveSiteId.tsx","../../cli-site-selector/src/index.ts","../../cli-site-selector/src/SiteSelector.tsx","../../cli-site-selector/src/SiteTypeSelect.tsx","../../cli-site-selector/src/bi.ts","../../cli-site-selector/src/CreateDevSite.tsx","../../cli-site-selector/src/WaitForAppToBeInstalled.tsx","../../metasite-manager-client/src/index.ts","../../metasite-manager-client/src/useMetasiteManagerClient.ts","../../metasite-manager-client/src/metasite-manager-client.ts","../../metasite-manager-client/src/schemas.ts","../../cli-site-selector/src/OpenBrowser.tsx","../../cli-site-selector/src/messages.json","../../cli-site-selector/src/SelectExistingSite.tsx","../../cli-site-selector/src/SiteListSelect.tsx","../src/components/Platform/usePlatform.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback } from 'react';\nimport { match } from 'variant';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { APP_CONFIG_PATH } from '@wix/cli-app-definitions';\nimport { useAsync, useExit, Spinner } from '@wix/cli-ui-kit';\nimport { type Site, useSiteListClient } from '@wix/site-list-client';\nimport { saveAppConfig } from '../files/app.config.js';\nimport { useProjectModel } from '../model.js';\nimport { ResolveSiteId } from './ResolveSiteId.js';\nimport { SiteIdContext } from './context.js';\nimport { SiteIdState } from './site-id-state.js';\nimport { resolveConfiguredSite } from './resolve-configured-site.js';\n\nexport const SiteIdProvider: FC<{\n siteId?: string;\n children: ReactNode | ((site: Site) => ReactNode);\n}> = ({ children, siteId }) => {\n const exit = useExit();\n const {\n model: { projectFolder },\n } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const siteListClient = useSiteListClient();\n\n const { status, merge } = useAsync(\n async () =>\n resolveConfiguredSite({\n projectFolder,\n siteListClient,\n siteId,\n writeDebugLog,\n }),\n []\n );\n\n const setSite = useCallback(\n async (site: Site) => {\n try {\n await saveAppConfig(projectFolder, { siteId: site.id });\n merge({ result: SiteIdState.Resolved({ site }) });\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToSaveDevelopmentSite({\n path: APP_CONFIG_PATH,\n }),\n });\n }\n },\n [merge, projectFolder]\n );\n\n const handleResolveSiteId = useCallback(\n (site: Site) => setSite(site).catch(exit),\n [exit, setSite]\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner />,\n Success: ({ result: state }) => {\n return match(state, {\n NotConfigured: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n NotFound: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n Resolved: ({ site }) => (\n <SiteIdContext.Provider\n value={{\n site,\n setSite,\n }}\n >\n {typeof children === 'function' ? children(site) : children}\n </SiteIdContext.Provider>\n ),\n });\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match, constant } from 'variant';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, useExit } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SiteSelector } from '@wix/cli-site-selector';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { useProjectModel } from '../model.js';\nimport type { SiteIdState } from './site-id-state.js';\n\ninterface Props {\n state: SiteIdState<'NotConfigured' | 'NotFound'>;\n onSubmit: (site: Site) => void;\n}\n\nexport const ResolveSiteId: FC<Props> = ({ state, onSubmit }) => {\n const exit = useExit();\n const { t } = useTranslation();\n const { model } = useProjectModel();\n const biLogger = useBiLogger();\n\n return (\n <>\n {match(state, {\n NotConfigured: constant(\n <Alert type=\"insight\">{t('general.no_site_id_configured')}</Alert>\n ),\n NotFound: ({ id }) => (\n <Alert type=\"error\">{t('general.site_id_not_found', { id })}</Alert>\n ),\n })}\n <SiteSelector\n appId={model.config.appId}\n biLogger={biLogger}\n onSubmit={onSubmit}\n onError={exit}\n />\n </>\n );\n};\n","export { SiteSelector } from './SiteSelector.js';\n","import React, { type FC, useState } from 'react';\nimport { match } from 'variant';\nimport { I18nProvider, Trans } from '@wix/cli-i18n';\nimport type { Site } from '@wix/site-list-client';\nimport { Spinner, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport { useSiteListClient } from '@wix/site-list-client';\nimport type { BiLogger } from '@wix/cli-telemetry';\nimport { BiProvider } from '@wix/cli-telemetry-react';\nimport { SiteTypeSelect, type SiteType } from './SiteTypeSelect.js';\nimport { CreateDevSite } from './CreateDevSite.js';\nimport messages from './messages.json';\nimport { SelectExistingSite } from './SelectExistingSite.js';\n\ninterface Props {\n appId: string;\n biLogger: BiLogger;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SiteSelector: FC<Props> = ({\n appId,\n biLogger,\n onSubmit,\n onError,\n}) => {\n const [siteType, setSiteType] = useState<SiteType | null>(null);\n const { createDevSite } = useDevCenterClient();\n const siteListClient = useSiteListClient();\n\n const { status } = useAsync(\n () =>\n siteListClient.querySites({\n query: {\n cursorPaging: {\n limit: 100,\n },\n },\n }),\n [],\n {\n onError,\n }\n );\n\n const createSite = useAsyncCallback(() => createDevSite(), {\n onError,\n });\n\n function handleSelectSiteType(siteType: SiteType) {\n setSiteType(siteType);\n if (siteType === 'create-dev-site') {\n createSite.execute();\n }\n }\n\n return (\n <BiProvider value={biLogger}>\n <I18nProvider messages={messages}>\n {match(status, {\n Error: () => null,\n Loading: () => <Spinner text={<Trans i18nKey=\"general.loading\" />} />,\n Success: ({ result: sites }) => (\n <>\n <SiteTypeSelect\n onSubmit={handleSelectSiteType}\n onError={onError}\n sites={sites}\n />\n {siteType === 'create-dev-site' && (\n <CreateDevSite\n status={createSite.status}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n {siteType === 'select-existing-site' && (\n <SelectExistingSite\n sites={sites}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n </>\n ),\n })}\n </I18nProvider>\n </BiProvider>\n );\n};\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport type { SelectOption } from '@wix/cli-ui-kit';\nimport {\n Spinner,\n SelectInput,\n useAsync,\n SelectOptionAvailability,\n} from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport type { Site } from '@wix/site-list-client';\nimport { useSiteSelectorBi } from './bi.js';\n\nexport type SiteType = 'create-dev-site' | 'select-existing-site';\ninterface Props {\n onSubmit: (siteType: SiteType) => void;\n onError: (error: unknown) => void;\n sites: Site[];\n}\n\nexport const SiteTypeSelect: FC<Props> = ({ onSubmit, onError, sites }) => {\n const bi = useSiteSelectorBi();\n const { t } = useTranslation();\n const { getDevSitesCount, getDevSitesLimit } = useDevCenterClient();\n const { status } = useAsync(\n () => Promise.all([getDevSitesCount(), getDevSitesLimit()]),\n [],\n { onError }\n );\n\n const handleSubmit = (option: SelectOption<SiteType>) => {\n bi.cliFlowStepAnswered({\n question: t('site_type_select.label'),\n answer: option.title,\n });\n onSubmit(option.value);\n };\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: [devSitesCount, devSitesLimit] }) => {\n const isDevSitesLimitReached = devSitesCount >= devSitesLimit;\n const userHasNoSites = sites.length === 0;\n\n return (\n <SelectInput<SiteType>\n label={t('site_type_select.label')}\n options={[\n {\n availability: userHasNoSites\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.no_sites'),\n })\n : SelectOptionAvailability.Enabled(),\n title: t('site_type_select.pick_existing_site'),\n value: 'select-existing-site',\n },\n {\n title: t('site_type_select.create_new_dev_site'),\n value: 'create-dev-site',\n availability: isDevSitesLimitReached\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.create_new_dev_site.disabled', {\n limit: devSitesLimit,\n }),\n })\n : SelectOptionAvailability.Enabled(),\n },\n ]}\n onSubmit={handleSubmit}\n />\n );\n },\n });\n};\n","import { useMemo } from 'react';\nimport type { BiLogger } from '@wix/cli-telemetry';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport {\n wixCliAction,\n wixCliAppFlowStepsAnswers,\n} from '@wix/bi-logger-dev-tools-data/v2';\n\nexport function siteSelectorBiEvents(biLogger: BiLogger) {\n return {\n cliAction: ({\n question,\n action,\n key,\n additionalInfo,\n }: {\n question: string;\n action: string;\n key: string;\n additionalInfo?: Record<string, unknown>;\n }) =>\n biLogger.report(\n wixCliAction({\n question,\n action,\n key,\n additionalInfo: JSON.stringify(additionalInfo),\n })\n ),\n cliFlowStepAnswered: ({\n question,\n answer,\n additionalInfo,\n }: {\n question: string;\n answer: string;\n additionalInfo?: Record<string, unknown>;\n }) =>\n biLogger.report(\n wixCliAppFlowStepsAnswers({\n question,\n answer,\n additionalInfo: JSON.stringify(additionalInfo),\n })\n ),\n };\n}\n\nexport function useSiteSelectorBi() {\n const biLogger = useBiLogger();\n return useMemo(() => siteSelectorBiEvents(biLogger), [biLogger]);\n}\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Text, Spinner } from '@wix/cli-ui-kit';\nimport type { Site } from '@wix/site-list-client';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\n\ninterface Props {\n status: AsyncCallbackStatus<Site>;\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const CreateDevSite: FC<Props> = ({\n status,\n appId,\n onSubmit,\n onError,\n}) => {\n const { t } = useTranslation();\n\n return match(status, {\n NotRequested: () => null,\n Error: () => null,\n Loading: () => <Spinner text={t('create_dev_site.loading')} />,\n Success: ({ result }) => (\n <>\n <Trans\n i18nKey=\"create_dev_site.success\"\n components={[<Text skin=\"success\" bold />]}\n values={{ name: result.displayName }}\n />\n <WaitForAppToBeInstalled\n appId={appId}\n site={result}\n onSubmit={() => onSubmit(result)}\n onError={onError}\n />\n </>\n ),\n });\n};\n","import pWaitFor, { TimeoutError } from 'p-wait-for';\nimport React, { type FC } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { Alert, useAsync } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport { isType, match, variant } from 'variant';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { Site } from '@wix/site-list-client';\nimport { OpenBrowser } from './OpenBrowser.js';\n\ninterface Props {\n site: Site;\n appId: string;\n onSubmit: () => void;\n onError: (error: unknown) => void;\n}\n\nexport const AppInstallData = variant({\n Success: {},\n Canceled: {},\n});\n\nfunction isAbortError(error: unknown) {\n return (\n error &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError'\n );\n}\n\nexport const WaitForAppToBeInstalled: FC<Props> = ({\n appId,\n site,\n onSubmit,\n onError,\n}) => {\n const { isAppInstalled } = useMetasiteManagerClient();\n\n const { status } = useAsync(\n async ({ signal }) => {\n const { appInstallationPollInterval } = getTestOverrides();\n\n try {\n await pWaitFor(() => isAppInstalled({ metaSiteId: site.id, appId }), {\n interval: appInstallationPollInterval ?? 2000,\n timeout: {\n milliseconds: 60 * 1000 * 2,\n signal,\n },\n });\n\n return AppInstallData.Success();\n } catch (error) {\n if (error instanceof TimeoutError) {\n throw new CliError({\n code: CliErrorCode.SiteSelectorTimedout(),\n cause: error,\n });\n }\n\n if (isAbortError(error)) {\n return AppInstallData.Canceled();\n }\n\n throw error;\n }\n },\n [],\n {\n onError,\n onSuccess: (result) => {\n if (isType(result, AppInstallData.Success)) {\n onSubmit();\n }\n },\n }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <OpenBrowser siteId={site.id} appId={appId} />,\n Success: () => (\n <Alert type=\"success\">\n <Trans i18nKey=\"install_app_on_site.finished_successfully\" />\n </Alert>\n ),\n });\n};\n","export { useMetasiteManagerClient } from './useMetasiteManagerClient.js';\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { MetasiteManagerClient } from './metasite-manager-client.js';\n\nexport function useMetasiteManagerClient(): MetasiteManagerClient {\n const httpClient = useHttpClient({ type: 'general' });\n return useMemo(() => new MetasiteManagerClient(httpClient), [httpClient]);\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { clientSpecMapSchema } from './schemas.js';\n\nexport class MetasiteManagerClient {\n constructor(private readonly httpClient: HttpClient) {}\n\n public isAppInstalled = async ({\n metaSiteId,\n appId,\n }: {\n metaSiteId: string;\n appId: string;\n }) => {\n try {\n const { data } = await this.httpClient.request({\n url: `/_api/msm/v1/meta-site/editor-client-spec-map/${metaSiteId}`,\n });\n\n const clientSpecMap = clientSpecMapSchema.parse(data);\n\n const isInstalled = Object.values(clientSpecMap).some(\n (spec) => spec.appDefinitionId === appId && !spec.permissions?.revoked\n );\n\n return isInstalled;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCheckIfAppInstalled(),\n cause: e,\n });\n }\n };\n}\n","import { z } from 'zod';\n\nexport const clientSpecMapSchema = z.record(\n z.object({\n appDefinitionId: z.string().optional(),\n permissions: z.object({ revoked: z.boolean() }).optional(),\n })\n);\n\nexport type ClientSpecMap = z.TypeOf<typeof clientSpecMapSchema>;\n","import React, { type FC } from 'react';\nimport { Key, useInput } from '@wix/cli-ui-kit';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport { openBrowser } from '@wix/user-browser';\nimport { useSiteSelectorBi } from './bi.js';\n\ninterface Props {\n siteId: string;\n appId: string;\n}\n\nexport const OpenBrowser: FC<Props> = ({ siteId, appId }) => {\n const { t } = useTranslation();\n const bi = useSiteSelectorBi();\n\n useInput(async (input, key) => {\n if (key.return) {\n bi.cliAction({\n question: t('install_app_on_site.warning.instructions'),\n key: 'enter',\n action: 'install_app_on_site',\n });\n await openBrowser(\n `https://manage.wix.com/installer/install?metaSiteId=${siteId}&appId=${appId}&platform=cli&version=latest`\n );\n }\n });\n\n return (\n <>\n <Trans i18nKey=\"install_app_on_site.warning\" />\n <Trans\n i18nKey=\"install_app_on_site.warning.instructions\"\n components={[<Key value=\"enter\" />]}\n />\n </>\n );\n};\n","{\n \"general.loading\": \"Loading...\",\n \"site_type_select.label\": \"Select Development Site\",\n \"site_type_select.create_new_dev_site\": \"Create a new Development Site\",\n \"site_type_select.create_new_dev_site.disabled\": \"You have reached the maximum number of {limit} Development Sites\",\n \"site_type_select.pick_existing_site\": \"Pick an existing site\",\n \"site_type_select.no_sites\": \"No sites found\",\n \"create_dev_site.loading\": \"Creating your new Development Site...\",\n \"create_dev_site.success\": \"Development Site <0>{name}</0> created successfully! 🚀\",\n \"site_list_select.label\": \"Select Site\",\n \"install_app_on_site.warning\": \"Your new application needs to be installed on the selected Development Site\",\n \"install_app_on_site.warning.instructions\": \"Press <0/> to install the application in your browser\",\n \"install_app_on_site.finished_successfully\": \"App installed on Development Site.\"\n}\n","import React, { useState } from 'react';\nimport { Spinner, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport type { Site } from '@wix/site-list-client';\nimport { isType } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\nimport { SiteListSelect } from './SiteListSelect.js';\n\ninterface Props {\n sites: Site[];\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SelectExistingSite = ({\n sites,\n appId,\n onSubmit,\n onError,\n}: Props) => {\n const { t } = useTranslation();\n const { isAppInstalled } = useMetasiteManagerClient();\n const [siteToInstallAppOn, setSiteToInstallAppOn] = useState<Site | null>(\n null\n );\n const checkAppInstalled = useAsyncCallback(\n (_, site: Site) => isAppInstalled({ metaSiteId: site.id, appId }),\n {\n onError,\n }\n );\n\n async function handleSelectSite(site: Site) {\n const isInstalled = await checkAppInstalled.execute(site);\n if (isInstalled) {\n onSubmit(site);\n } else {\n setSiteToInstallAppOn(site);\n }\n }\n\n return (\n <>\n <SiteListSelect onSubmit={handleSelectSite} sites={sites} />\n {isType(checkAppInstalled.status, 'Loading') && (\n <Spinner text={t('general.loading')} />\n )}\n {siteToInstallAppOn && (\n <WaitForAppToBeInstalled\n appId={appId}\n site={siteToInstallAppOn}\n onSubmit={() => onSubmit(siteToInstallAppOn)}\n onError={onError}\n />\n )}\n </>\n );\n};\n","import React, { useCallback, type FC } from 'react';\nimport { useTranslation } from '@wix/cli-i18n';\nimport type { SelectOption } from '@wix/cli-ui-kit';\nimport { SelectInput } from '@wix/cli-ui-kit';\nimport { type Site } from '@wix/site-list-client';\nimport { useSiteSelectorBi } from './bi.js';\n\ninterface Props {\n onSubmit: (site: Site) => void;\n sites: Site[];\n}\n\nexport const SiteListSelect: FC<Props> = ({ onSubmit, sites }) => {\n const { t } = useTranslation();\n const bi = useSiteSelectorBi();\n\n const handleSubmit = useCallback(\n (option: SelectOption<Site>) => {\n bi.cliFlowStepAnswered({\n question: t('site_list_select.label'),\n answer: option.title,\n });\n onSubmit(option.value);\n },\n [bi, onSubmit, t]\n );\n\n return (\n <SelectInput<Site>\n label={t('site_list_select.label')}\n options={sites.map((site) => ({\n key: site.id,\n title: site.displayName,\n description: site.viewUrl,\n value: site,\n }))}\n onSubmit={handleSubmit}\n />\n );\n};\n","import { useCallback } from 'react';\nimport { isType } from 'variant';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport { useProjectModel } from '../../model.js';\n\nexport function usePlatform() {\n const { model } = useProjectModel();\n\n const isPlatformExists = useCallback(\n (platformType: PlatformType) =>\n model.components.some((component) =>\n component.platforms.some(isType(platformType.type))\n ),\n [model.components]\n );\n\n const hasSinglePlatform = useCallback(\n (platformType: PlatformType) =>\n model.components.every(\n (component) =>\n component.platforms.some(isType(platformType.type)) ||\n component.platforms.length === 0\n ),\n [model.components]\n );\n\n return {\n isPlatformExists,\n hasSinglePlatform,\n };\n}\n"],"mappings":";;ykBAAAA,IAAA,IAAAC,EAA4D,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AAc,CAC5B,GAAM,CAAE,MAAAC,CAAM,EAAIC,EAAgB,EAE5BC,KAAmB,eACtBC,GACCH,EAAM,WAAW,KAAMI,GACrBA,EAAU,UAAU,QAAK,WAAOD,EAAa,IAAI,CAAC,CACpD,EACF,CAACH,EAAM,UAAU,CACnB,EAEMK,KAAoB,eACvBF,GACCH,EAAM,WAAW,MACdI,GACCA,EAAU,UAAU,QAAK,WAAOD,EAAa,IAAI,CAAC,GAClDC,EAAU,UAAU,SAAW,CACnC,EACF,CAACJ,EAAM,UAAU,CACnB,EAEA,MAAO,CACL,iBAAAE,EACA,kBAAAG,CACF,CACF","names":["init_esm_shims","import_react","import_variant","init_esm_shims","import_react","import_variant","init_esm_shims","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","siteSelectorBiEvents","biLogger","question","action","key","additionalInfo","wixCliAction","answer","wixCliAppFlowStepsAnswers","useSiteSelectorBi","useBiLogger","SiteTypeSelect","onSubmit","onError","sites","bi","useSiteSelectorBi","t","useTranslation","getDevSitesCount","getDevSitesLimit","useDevCenterClient","status","useAsync","handleSubmit","option","React","Spinner","devSitesCount","devSitesLimit","isDevSitesLimitReached","userHasNoSites","SelectInput","SelectOptionAvailability","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","init_esm_shims","init_esm_shims","import_react","init_esm_shims","init_esm_shims","clientSpecMapSchema","z","MetasiteManagerClient","httpClient","metaSiteId","appId","data","clientSpecMap","clientSpecMapSchema","spec","e","CliError","CliErrorCode","useMetasiteManagerClient","httpClient","useHttpClient","MetasiteManagerClient","import_variant","init_esm_shims","import_react","OpenBrowser","siteId","appId","t","useTranslation","bi","useSiteSelectorBi","use_input_default","input","key","openBrowser","React","Trans","Key","AppInstallData","isAbortError","error","WaitForAppToBeInstalled","appId","site","onSubmit","onError","isAppInstalled","useMetasiteManagerClient","status","useAsync","signal","appInstallationPollInterval","getTestOverrides","pWaitFor","TimeoutError","CliError","CliErrorCode","result","React","OpenBrowser","Alert","Trans","CreateDevSite","status","appId","onSubmit","onError","t","useTranslation","React","Spinner","result","Trans","Text","WaitForAppToBeInstalled","messages_default","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","SiteListSelect","onSubmit","sites","t","useTranslation","bi","useSiteSelectorBi","handleSubmit","option","React","SelectInput","site","SelectExistingSite","sites","appId","onSubmit","onError","t","useTranslation","isAppInstalled","useMetasiteManagerClient","siteToInstallAppOn","setSiteToInstallAppOn","checkAppInstalled","useAsyncCallback","_","site","handleSelectSite","React","SiteListSelect","Spinner","WaitForAppToBeInstalled","SiteSelector","appId","biLogger","onSubmit","onError","siteType","setSiteType","createDevSite","useDevCenterClient","siteListClient","useSiteListClient","status","useAsync","createSite","useAsyncCallback","handleSelectSiteType","React","BiProvider","I18nProvider","messages_default","Spinner","Trans","sites","SiteTypeSelect","CreateDevSite","SelectExistingSite","ResolveSiteId","state","onSubmit","exit","useExit","useTranslation","model","useProjectModel","biLogger","useBiLogger","React","Alert","id","SiteSelector","SiteIdProvider","children","siteId","exit","useExit","projectFolder","useProjectModel","writeDebugLog","useDebugLog","siteListClient","useSiteListClient","status","merge","useAsync","resolveConfiguredSite","setSite","site","saveAppConfig","SiteIdState","CliError","CliErrorCode","APP_CONFIG_PATH","handleResolveSiteId","React","Spinner","state","variant","ResolveSiteId","SiteIdContext","init_esm_shims","import_react","import_variant","usePlatform","model","useProjectModel","isPlatformExists","platformType","component","hasSinglePlatform"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as Pt}from"./chunk-C47JQ5AQ.js";import{d as vt}from"./chunk-YLBOH353.js";import{a as ve,b as wt,c as bt,d as G,l as Et,ra as Te,sa as Ce,xa as Ot}from"./chunk-PEDWEHXR.js";import{a as Vn,d as Oe,e as Pe,q as F,r as te}from"./chunk-JUS465G2.js";import{a as x,c as _,e as ee,g as f,h as s}from"./chunk-V4TR6DCM.js";var $t=_((ba,jt)=>{"use strict";s();jt.exports=Nt;Nt.sync=Kn;var Rt=x("fs");function Xn(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Lt(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Xn(t,r)}function Nt(e,t,r){Rt.stat(e,function(n,o){r(n,n?!1:Lt(o,e,t))})}function Kn(e,t){return Lt(Rt.statSync(e),e,t)}});var Gt=_((va,Bt)=>{"use strict";s();Bt.exports=kt;kt.sync=Yn;var Dt=x("fs");function kt(e,t,r){Dt.stat(e,function(n,o){r(n,n?!1:Ut(o,t))})}function Yn(e,t){return Ut(Dt.statSync(e),t)}function Ut(e,t){return e.isFile()&&Zn(e,t)}function Zn(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),a=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),u=c|l,h=r&p||r&l&&o===a||r&c&&n===i||r&u&&i===0;return h}});var Mt=_((Ta,Ft)=>{"use strict";s();var Pa=x("fs"),ne;process.platform==="win32"||global.TESTING_WINDOWS?ne=$t():ne=Gt();Ft.exports=Ie;Ie.sync=Qn;function Ie(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){Ie(e,t||{},function(i,a){i?o(i):n(a)})})}ne(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Qn(e,t){try{return ne.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Xt=_((Ia,Jt)=>{"use strict";s();var j=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=x("path"),eo=j?";":":",Vt=Mt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ht=(e,t)=>{let r=t.colon||eo,n=e.match(/\//)||j&&e.match(/\\/)?[""]:[...j?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=j?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=j?o.split(r):[""];return j&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Wt=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Ht(e,t),a=[],c=p=>new Promise((u,h)=>{if(p===n.length)return t.all&&a.length?u(a):h(zt(e));let m=n[p],g=/^".*"$/.test(m)?m.slice(1,-1):m,y=qt.join(g,e),b=!g&&/^\.[\\\/]/.test(e)?e.slice(0,2)+y:y;u(l(b,p,0))}),l=(p,u,h)=>new Promise((m,g)=>{if(h===o.length)return m(c(u+1));let y=o[h];Vt(p+y,{pathExt:i},(b,E)=>{if(!b&&E)if(t.all)a.push(p+y);else return m(p+y);return m(l(p,u,h+1))})});return r?c(0).then(p=>r(null,p),r):c(0)},to=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Ht(e,t),i=[];for(let a=0;a<r.length;a++){let c=r[a],l=/^".*"$/.test(c)?c.slice(1,-1):c,p=qt.join(l,e),u=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let h=0;h<n.length;h++){let m=u+n[h];try{if(Vt.sync(m,{pathExt:o}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw zt(e)};Jt.exports=Wt;Wt.sync=to});var Yt=_((Ra,Ae)=>{"use strict";s();var Kt=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Ae.exports=Kt;Ae.exports.default=Kt});var tr=_((Na,er)=>{"use strict";s();var Zt=x("path"),ro=Xt(),no=Yt();function Qt(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let a;try{a=ro.sync(e.command,{path:r[no({env:r})],pathExt:t?Zt.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Zt.resolve(o?e.options.cwd:"",a)),a}function oo(e){return Qt(e)||Qt(e,!0)}er.exports=oo});var rr=_(($a,Le)=>{"use strict";s();var Re=/([()\][%!^"`<>&|;, *?])/g;function io(e){return e=e.replace(Re,"^$1"),e}function so(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Re,"^$1"),t&&(e=e.replace(Re,"^$1")),e}Le.exports.command=io;Le.exports.argument=so});var or=_((ka,nr)=>{"use strict";s();nr.exports=/^#!(.*)/});var sr=_((Ba,ir)=>{"use strict";s();var ao=or();ir.exports=(e="")=>{let t=e.match(ao);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var cr=_((Fa,ar)=>{"use strict";s();var Ne=x("fs"),co=sr();function lo(e){let r=Buffer.alloc(150),n;try{n=Ne.openSync(e,"r"),Ne.readSync(n,r,0,150,0),Ne.closeSync(n)}catch{}return co(r.toString())}ar.exports=lo});var dr=_((qa,fr)=>{"use strict";s();var uo=x("path"),lr=tr(),ur=rr(),fo=cr(),po=process.platform==="win32",mo=/\.(?:com|exe)$/i,ho=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function go(e){e.file=lr(e);let t=e.file&&fo(e.file);return t?(e.args.unshift(e.file),e.command=t,lr(e)):e.file}function yo(e){if(!po)return e;let t=go(e),r=!mo.test(t);if(e.options.forceShell||r){let n=ho.test(t);e.command=uo.normalize(e.command),e.command=ur.command(e.command),e.args=e.args.map(i=>ur.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function _o(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:yo(n)}fr.exports=_o});var hr=_((za,mr)=>{"use strict";s();var je=process.platform==="win32";function $e(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function xo(e,t){if(!je)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=pr(o,t,"spawn");if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}function pr(e,t){return je&&e===1&&!t.file?$e(t.original,"spawn"):null}function So(e,t){return je&&e===1&&!t.file?$e(t.original,"spawnSync"):null}mr.exports={hookChildProcess:xo,verifyENOENT:pr,verifyENOENTSync:So,notFoundError:$e}});var _r=_((Wa,$)=>{"use strict";s();var gr=x("child_process"),De=dr(),ke=hr();function yr(e,t,r){let n=De(e,t,r),o=gr.spawn(n.command,n.args,n.options);return ke.hookChildProcess(o,n),o}function wo(e,t,r){let n=De(e,t,r),o=gr.spawnSync(n.command,n.args,n.options);return o.error=o.error||ke.verifyENOENTSync(o.status,n),o}$.exports=yr;$.exports.spawn=yr;$.exports.sync=wo;$.exports._parse=De;$.exports._enoent=ke});var zr=_((xl,Vr)=>{"use strict";s();var{PassThrough:_i}=x("stream");Vr.exports=function(){var e=[],t=new _i({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(i){return Array.isArray(i)?(i.forEach(r),this):(e.push(i),i.once("end",o.bind(null,i)),i.once("error",t.emit.bind(t,"error")),i.pipe(t,{end:!1}),this)}function n(){return e.length==0}function o(i){e=e.filter(function(a){return a!==i}),!e.length&&t.readable&&t.end()}}});var H=_((nu,dn)=>{"use strict";s();var Mi=Object.create,_e=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Vi=Object.getOwnPropertyNames,zi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty,Wi=(e,t)=>{for(var r in t)_e(e,r,{get:t[r],enumerable:!0})},cn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vi(t))!Hi.call(e,o)&&o!==r&&_e(e,o,{get:()=>t[o],enumerable:!(n=qi(t,o))||n.enumerable});return e},Ji=(e,t,r)=>(r=e!=null?Mi(zi(e)):{},cn(t||!e||!e.__esModule?_e(r,"default",{value:e,enumerable:!0}):r,e)),Xi=e=>cn(_e({},"__esModule",{value:!0}),e),ln={};Wi(ln,{CLOUDFLARED_VERSION:()=>Zi,DEFAULT_CLOUDFLARED_BIN:()=>un,RELEASE_BASE:()=>Qi,bin:()=>fn,use:()=>Yi});dn.exports=Xi(ln);var Ki=Ji(x("node:path")),un=Ki.default.join(f,"..","bin",process.platform==="win32"?"cloudflared.exe":"cloudflared"),fn=process.env.CLOUDFLARED_BIN||un;function Yi(e){fn=e}var Zi=process.env.CLOUDFLARED_VERSION||"latest",Qi="https://github.com/cloudflare/cloudflared/releases/"});var hn=_((iu,mn)=>{"use strict";s();var ct=Object.defineProperty,es=Object.getOwnPropertyDescriptor,ts=Object.getOwnPropertyNames,rs=Object.prototype.hasOwnProperty,ns=(e,t)=>{for(var r in t)ct(e,r,{get:t[r],enumerable:!0})},os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ts(t))!rs.call(e,o)&&o!==r&&ct(e,o,{get:()=>t[o],enumerable:!(n=es(t,o))||n.enumerable});return e},is=e=>os(ct({},"__esModule",{value:!0}),e),pn={};ns(pn,{UnsupportedError:()=>at});mn.exports=is(pn);var at=class extends Error{constructor(t){super(t)}}});var bn=_((au,wn)=>{"use strict";s();var ss=Object.create,xe=Object.defineProperty,as=Object.getOwnPropertyDescriptor,cs=Object.getOwnPropertyNames,ls=Object.getPrototypeOf,us=Object.prototype.hasOwnProperty,fs=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})},gn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of cs(t))!us.call(e,o)&&o!==r&&xe(e,o,{get:()=>t[o],enumerable:!(n=as(t,o))||n.enumerable});return e},lt=(e,t,r)=>(r=e!=null?ss(ls(e)):{},gn(t||!e||!e.__esModule?xe(r,"default",{value:e,enumerable:!0}):r,e)),ds=e=>gn(xe({},"__esModule",{value:!0}),e),yn={};fs(yn,{install:()=>_s,install_linux:()=>_n,install_macos:()=>xn,install_windows:()=>Sn});wn.exports=ds(yn);var A=lt(x("node:fs")),W=lt(x("node:path")),ps=lt(x("node:https")),ms=x("node:child_process"),D=H(),Se=hn(),hs={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},gs={arm64:"cloudflared-darwin-amd64.tgz",x64:"cloudflared-darwin-amd64.tgz"},ys={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe"};function ut(e){return e==="latest"?`${D.RELEASE_BASE}latest/download/`:`${D.RELEASE_BASE}download/${e}/`}async function _s(e,t=D.CLOUDFLARED_VERSION){if(process.platform==="linux")return _n(e,t);if(process.platform==="darwin")return xn(e,t);if(process.platform==="win32")return Sn(e,t);throw new Se.UnsupportedError("Unsupported platform: "+process.platform)}async function _n(e,t=D.CLOUDFLARED_VERSION){let r=hs[process.arch];if(r===void 0)throw new Se.UnsupportedError("Unsupported architecture: "+process.arch);return await we(ut(t)+r,e),A.default.chmodSync(e,"755"),e}async function xn(e,t=D.CLOUDFLARED_VERSION){let r=gs[process.arch];if(r===void 0)throw new Se.UnsupportedError("Unsupported architecture: "+process.arch);return await we(ut(t)+r,`${e}.tgz`),process.env.VERBOSE&&console.log(`Extracting to ${e}`),(0,ms.execSync)(`tar -xzf ${W.default.basename(`${e}.tgz`)}`,{cwd:W.default.dirname(e)}),A.default.unlinkSync(`${e}.tgz`),A.default.renameSync(`${W.default.dirname(e)}/cloudflared`,e),e}async function Sn(e,t=D.CLOUDFLARED_VERSION){let r=ys[process.arch];if(r===void 0)throw new Se.UnsupportedError("Unsupported architecture: "+process.arch);return await we(ut(t)+r,e),e}function we(e,t,r=0){return r===0?process.env.VERBOSE&&console.log(`Downloading ${e} to ${t}`):process.env.VERBOSE&&console.log(`Redirecting to ${e}`),A.default.existsSync(W.default.dirname(t))||A.default.mkdirSync(W.default.dirname(t),{recursive:!0}),new Promise((n,o)=>{let i=ps.default.get(e,a=>{if([301,302,303,307,308].includes(a.statusCode)&&a.headers.location!==void 0){i.destroy();let l=a.headers.location;n(we(l,t,r+1));return}if(a.statusCode&&a.statusCode>=200&&a.statusCode<300){let l=A.default.createWriteStream(t);l.on("finish",()=>{l.close(()=>n(t))}),l.on("error",p=>{A.default.unlink(t,()=>o(p))}),a.pipe(l)}else i.destroy(),o(new Error(`HTTP response with status code: ${a.statusCode}`))});i.on("error",a=>{o(a)}),i.end()})}});var dt=_((lu,vn)=>{"use strict";s();var ft=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyNames,ws=Object.prototype.hasOwnProperty,bs=(e,t)=>{for(var r in t)ft(e,r,{get:t[r],enumerable:!0})},Es=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ss(t))!ws.call(e,o)&&o!==r&&ft(e,o,{get:()=>t[o],enumerable:!(n=xs(t,o))||n.enumerable});return e},vs=e=>Es(ft({},"__esModule",{value:!0}),e),En={};bs(En,{config_regex:()=>Ns,conn_regex:()=>Os,connectorID_regex:()=>Rs,disconnect_regex:()=>Is,index_regex:()=>Cs,ip_regex:()=>Ps,location_regex:()=>Ts,metrics_regex:()=>Ls,tunnelID_regex:()=>As});vn.exports=vs(En);var Os=/connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,Ps=/ip=([0-9.]+)/,Ts=/location=([A-Za-z0-9]+)/,Cs=/connIndex=(\d)/,Is=/Unregistered tunnel connection connIndex=(\d)/i,As=/tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,Rs=/Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,Ls=/metrics server on ([0-9.:]+\/metrics)/,Ns=/config="(.+[^\\])"/});var Tn=_((fu,Pn)=>{"use strict";s();var pt=Object.defineProperty,js=Object.getOwnPropertyDescriptor,$s=Object.getOwnPropertyNames,Ds=Object.prototype.hasOwnProperty,ks=(e,t)=>{for(var r in t)pt(e,r,{get:t[r],enumerable:!0})},Us=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $s(t))!Ds.call(e,o)&&o!==r&&pt(e,o,{get:()=>t[o],enumerable:!(n=js(t,o))||n.enumerable});return e},Bs=e=>Us(pt({},"__esModule",{value:!0}),e),On={};ks(On,{tunnel:()=>Ms});Pn.exports=Bs(On);var Gs=x("node:child_process"),Fs=H(),be=dt();function Ms(e={}){let t=["tunnel"];for(let[m,g]of Object.entries(e))typeof g=="string"?t.push(`${m}`,g):typeof g=="number"?t.push(`${m}`,g.toString()):g===null&&t.push(`${m}`);t.length===1&&t.push("--url","localhost:8080");let r=(0,Gs.spawn)(Fs.bin,t,{stdio:["ignore","pipe","pipe"]});process.env.VERBOSE&&(r.stdout.pipe(process.stdout),r.stderr.pipe(process.stderr));let n=/\|\s+(https?:\/\/[^\s]+)/,o=()=>{},i=()=>{},a=new Promise((...m)=>[o,i]=m),c=[],l=[],p=[];for(let m=0;m<1;m++)p.push(new Promise((...g)=>[c[m],l[m]]=g));let u=m=>{var g;let y=m.toString(),b=y.match(n);b&&o(b[1]);let E=y.match(be.conn_regex),P=y.match(be.ip_regex),T=y.match(be.location_regex),C=y.match(be.index_regex);if(E&&P&&T&&C){let[,K]=E,[,Y]=P,[,Z]=T,[,Q]=C;(g=c[+Q])==null||g.call(c,{id:K,ip:Y,location:Z})}};return r.stdout.on("data",u).on("error",i),r.stderr.on("data",u).on("error",i),{url:a,connections:p,child:r,stop:()=>r.kill("SIGINT")}}});var Un=_((pu,kn)=>{"use strict";s();var qs=Object.create,Ee=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,zs=Object.getOwnPropertyNames,Hs=Object.getPrototypeOf,Ws=Object.prototype.hasOwnProperty,Js=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},Cn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zs(t))!Ws.call(e,o)&&o!==r&&Ee(e,o,{get:()=>t[o],enumerable:!(n=Vs(t,o))||n.enumerable});return e},In=(e,t,r)=>(r=e!=null?qs(Hs(e)):{},Cn(t||!e||!e.__esModule?Ee(r,"default",{value:e,enumerable:!0}):r,e)),Xs=e=>Cn(Ee({},"__esModule",{value:!0}),e),An={};Js(An,{AlreadyInstalledError:()=>J,LINUX_SERVICE_PATH:()=>L,MACOS_SERVICE_PATH:()=>v,NotInstalledError:()=>N,clean:()=>Dn,current:()=>$n,err:()=>_t,exists:()=>O,identifier:()=>R,install:()=>Ln,journal:()=>xt,log:()=>jn,service:()=>Ks,service_name:()=>yt,uninstall:()=>Nn});kn.exports=Xs(An);var mt=In(x("node:os")),w=In(x("node:fs")),gt=x("node:child_process"),Rn=H(),S=dt(),R="com.cloudflare.cloudflared",yt="cloudflared.service",v={PLIST:ht()?`/Library/LaunchDaemons/${R}.plist`:`${mt.default.homedir()}/Library/LaunchAgents/${R}.plist`,OUT:ht()?`/Library/Logs/${R}.out.log`:`${mt.default.homedir()}/Library/Logs/${R}.out.log`,ERR:ht()?`/Library/Logs/${R}.err.log`:`${mt.default.homedir()}/Library/Logs/${R}.err.log`},L={SYSTEMD:`/etc/systemd/system/${yt}`,SERVICE:"/etc/init.d/cloudflared",SERVICE_OUT:"/var/log/cloudflared.log",SERVICE_ERR:"/var/log/cloudflared.err"},Ks={install:Ln,uninstall:Nn,exists:O,log:jn,err:_t,current:$n,clean:Dn,journal:xt},J=class extends Error{constructor(){super("service is already installed")}},N=class extends Error{constructor(){super("service is not installed")}};function Ln(e){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(O())throw new J;let t=["service","install"];e&&t.push(e);let r=(0,gt.spawnSync)(Rn.bin,t);if(r.status!==0)throw new Error(`service install failed: ${r.stderr.toString()}`)}function Nn(){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!O())throw new N;let e=(0,gt.spawnSync)(Rn.bin,["service","uninstall"]);if(e.status!==0)throw new Error(`service uninstall failed: ${e.stderr.toString()}`);process.platform==="darwin"?(w.default.rmSync(v.OUT),w.default.rmSync(v.ERR)):process.platform==="linux"&&!k()&&(w.default.rmSync(L.SERVICE_OUT),w.default.rmSync(L.SERVICE_ERR))}function jn(){if(!O())throw new N;if(process.platform==="darwin")return w.default.readFileSync(v.OUT,"utf8");if(process.platform==="linux"&&!k())return w.default.readFileSync(L.SERVICE_OUT,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function _t(){if(!O())throw new N;if(process.platform==="darwin")return w.default.readFileSync(v.ERR,"utf8");if(process.platform==="linux"&&!k())return w.default.readFileSync(L.SERVICE_ERR,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function xt(e=300){if(process.platform==="linux"&&k()){let t=["-u",yt,"-o","cat","-n",e.toString()];return(0,gt.spawnSync)("journalctl",t).stdout.toString()}throw new Error(`Not Implemented on platform ${process.platform}`)}function $n(){var e,t,r,n;if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!O())throw new N;let o=k()?xt():_t(),i="",a="",c=[],l="",p={};for(let u of o.split(`
|
|
4
|
+
`))try{if(u.match(S.tunnelID_regex))i=((e=u.match(S.tunnelID_regex))==null?void 0:e[1])??"";else if(u.match(S.connectorID_regex))a=((t=u.match(S.connectorID_regex))==null?void 0:t[1])??"";else if(u.match(S.conn_regex)&&u.match(S.location_regex)&&u.match(S.ip_regex)&&u.match(S.index_regex)){let[,h]=u.match(S.conn_regex)??[],[,m]=u.match(S.location_regex)??[],[,g]=u.match(S.ip_regex)??[],[,y]=u.match(S.index_regex)??[];c[parseInt(y)]={id:h,ip:g,location:m}}else if(u.match(S.disconnect_regex)){let[,h]=u.match(S.disconnect_regex)??[];parseInt(h)in c&&(c[parseInt(h)]={id:"",ip:"",location:""})}else u.match(S.metrics_regex)?l=((r=u.match(S.metrics_regex))==null?void 0:r[1])??"":u.match(S.config_regex)&&(p=JSON.parse(((n=u.match(S.config_regex))==null?void 0:n[1].replace(/\\/g,""))??"{}"))}catch(h){process.env.VERBOSE&&console.error("log parsing failed",h)}return{tunnelID:i,connectorID:a,connections:c,metrics:l,config:p}}function Dn(){if(process.platform!=="darwin")throw new Error(`Not Implemented on platform ${process.platform}`);if(O())throw new J;w.default.rmSync(v.OUT,{force:!0}),w.default.rmSync(v.ERR,{force:!0})}function O(){if(process.platform==="darwin")return w.default.existsSync(v.PLIST);if(process.platform==="linux")return k()?w.default.existsSync(L.SYSTEMD):w.default.existsSync(L.SERVICE);throw new Error(`Not Implemented on platform ${process.platform}`)}function ht(){var e;return((e=process.getuid)==null?void 0:e.call(process))===0}function k(){return process.platform==="linux"&&w.default.existsSync("/run/systemd/system")}});var Fn=_((hu,Gn)=>{"use strict";s();var St=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Zs=Object.getOwnPropertyNames,Qs=Object.prototype.hasOwnProperty,ea=(e,t)=>{for(var r in t)St(e,r,{get:t[r],enumerable:!0})},ta=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zs(t))!Qs.call(e,o)&&o!==r&&St(e,o,{get:()=>t[o],enumerable:!(n=Ys(t,o))||n.enumerable});return e},ra=e=>ta(St({},"__esModule",{value:!0}),e),Bn={};ea(Bn,{AlreadyInstalledError:()=>X.AlreadyInstalledError,MACOS_SERVICE_PATH:()=>X.MACOS_SERVICE_PATH,NotInstalledError:()=>X.NotInstalledError,bin:()=>na.bin,identifier:()=>X.identifier,install:()=>oa.install,service:()=>X.service,tunnel:()=>ia.tunnel});Gn.exports=ra(Bn);var na=H(),oa=bn(),ia=Tn(),X=Un()});s();var B=ee(Vn(),1);s();s();var zn={},Hn={},Wn={},Jn={};function Tt(e){var t={"bo._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"wixbo.ai":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"manage._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}]};return wt(Object.assign(e,{domainToMappings:t}))}function Ct(e){var t=G(zn,{}),r=t.toJSON,n=t.fromJSON,o=G(Hn,{}).fromJSON;function i(a){var c=a.host,l=r(e),p={entityFqdn:"wix.apps.hosting.v1.deployment",method:"POST",methodFqn:"wix.apps.hosting.v1.BackendService.CreateTunnel",url:Tt({protoPath:"/v1/tunnel",data:l,host:c}),data:l,transformResponse:o};return p}return i.fromReq=n,i.__isAmbassador=!0,i}function It(e){var t=G(Wn,{}),r=t.toJSON,n=t.fromJSON,o=G(Jn,{}).fromJSON;function i(a){var c=a.host,l=r(e),p={entityFqdn:"wix.apps.hosting.v1.deployment",method:"DELETE",methodFqn:"wix.apps.hosting.v1.BackendService.DeleteTunnel",url:Tt({protoPath:"/v1/tunnel",data:l,host:c}),params:bt(l),transformResponse:o};return p}return i.fromReq=n,i.__isAmbassador=!0,i}s();var At=F.object({id:F.string(),token:F.string(),domain:F.string()});var re=class{constructor(t){this.httpClient=t;let{minRetryTimeout:r}=te();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;createTunnel=async({port:t})=>{try{let{data:r}=await ve(()=>this.httpClient.request(Ct({port:t})),this.retryOptions);return At.parse(r)}catch(r){throw new Oe({code:Pe.FailedToCreateTunnel(),cause:r})}};deleteTunnel=async t=>{try{await ve(()=>this.httpClient.request(It({id:t})),this.retryOptions)}catch(r){throw new Oe({code:Pe.FailedToDeleteTunnel(),cause:r})}}};s();s();var on=ee(_r(),1);import{Buffer as Di}from"node:buffer";import ki from"node:path";import st from"node:child_process";import ge from"node:process";s();function Ue(e){let t=typeof e=="string"?`
|
|
5
|
+
`:10,r=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}s();import ie from"node:process";import M from"node:path";import bo from"node:url";s();function oe(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}function Eo(e={}){let{cwd:t=ie.cwd(),path:r=ie.env[oe()],execPath:n=ie.execPath}=e,o,i=t instanceof URL?bo.fileURLToPath(t):t,a=M.resolve(i),c=[];for(;o!==a;)c.push(M.join(a,"node_modules/.bin")),o=a,a=M.resolve(a,"..");return c.push(M.resolve(i,n,"..")),[...c,r].join(M.delimiter)}function xr({env:e=ie.env,...t}={}){e={...e};let r=oe({env:e});return t.path=e[r],e[r]=Eo(t),e}s();s();var vo=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!Oo(o,i)&&n||Object.defineProperty(e,r,i)},Oo=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Po=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},To=(e,t)=>`/* Wrapped ${e}*/
|
|
6
|
+
${t}`,Co=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Io=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ao=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=To.bind(null,n,t.toString());Object.defineProperty(o,"name",Io),Object.defineProperty(e,"toString",{...Co,value:o})};function Be(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))vo(e,t,o,r);return Po(e,t),Ao(e,t,n),e}var se=new WeakMap,Sr=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...a){if(se.set(i,++n),n===1)r=e.apply(this,a),e=null;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return Be(i,e),se.set(i,n),i};Sr.callCount=e=>{if(!se.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return se.get(e)};var wr=Sr;s();import Go from"node:process";s();import{constants as jo}from"node:os";s();var br=()=>{let e=vr-Er+1;return Array.from({length:e},Ro)},Ro=(e,t)=>({name:`SIGRT${t+1}`,number:Er+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Er=34,vr=64;s();import{constants as Lo}from"node:os";s();var Or=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var Ge=()=>{let e=br();return[...Or,...e].map(No)},No=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:a}}=Lo,c=a!==void 0;return{name:e,number:c?a:t,description:r,supported:c,action:n,forced:o,standard:i}};var $o=()=>{let e=Ge();return Object.fromEntries(e.map(Do))},Do=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:a})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:a}],Pr=$o(),ko=()=>{let e=Ge(),t=65,r=Array.from({length:t},(n,o)=>Uo(o,e));return Object.assign({},...r)},Uo=(e,t)=>{let r=Bo(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:a,forced:c,standard:l}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:a,forced:c,standard:l}}},Bo=(e,t)=>{let r=t.find(({name:n})=>jo.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},wc=ko();var Fo=({timedOut:e,timeout:t,errorCode:r,signal:n,signalDescription:o,exitCode:i,isCanceled:a})=>e?`timed out after ${t} milliseconds`:a?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${o})`:i!==void 0?`failed with exit code ${i}`:"failed",q=({stdout:e,stderr:t,all:r,error:n,signal:o,exitCode:i,command:a,escapedCommand:c,timedOut:l,isCanceled:p,killed:u,parsed:{options:{timeout:h,cwd:m=Go.cwd()}}})=>{i=i===null?void 0:i,o=o===null?void 0:o;let g=o===void 0?void 0:Pr[o].description,y=n&&n.code,E=`Command ${Fo({timedOut:l,timeout:h,errorCode:y,signal:o,signalDescription:g,exitCode:i,isCanceled:p})}: ${a}`,P=Object.prototype.toString.call(n)==="[object Error]",T=P?`${E}
|
|
7
|
+
${n.message}`:E,C=[T,t,e].filter(Boolean).join(`
|
|
8
|
+
`);return P?(n.originalMessage=n.message,n.message=C):n=new Error(C),n.shortMessage=T,n.command=a,n.escapedCommand=c,n.exitCode=i,n.signal=o,n.signalDescription=g,n.stdout=e,n.stderr=t,n.cwd=m,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!l,n.isCanceled=p,n.killed=u&&!l,n};s();var ae=["stdin","stdout","stderr"],Mo=e=>ae.some(t=>e[t]!==void 0),Tr=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return ae.map(n=>e[n]);if(Mo(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${ae.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,ae.length);return Array.from({length:r},(n,o)=>t[o])};s();import zo from"node:os";s();s();var I=[];I.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&I.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&I.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var ce=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Fe=Symbol.for("signal-exit emitter"),Me=globalThis,qo=Object.defineProperty.bind(Object),qe=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Me[Fe])return Me[Fe];qo(Me,Fe,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},le=class{},Vo=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Ve=class extends le{onExit(){return()=>{}}load(){}unload(){}},ze=class extends le{#s=He.platform==="win32"?"SIGINT":"SIGHUP";#t=new qe;#e;#o;#i;#n={};#r=!1;constructor(t){super(),this.#e=t,this.#n={};for(let r of I)this.#n[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#t,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let a=this.#t.emit("exit",null,r),c=r==="SIGHUP"?this.#s:r;a||t.kill(t.pid,c)}};this.#i=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!ce(this.#e))return()=>{};this.#r===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#t.on(n,t),()=>{this.#t.removeListener(n,t),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#t.count+=1;for(let t of I)try{let r=this.#n[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#r&&(this.#r=!1,I.forEach(t=>{let r=this.#n[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#i,this.#t.count-=1)}#a(t){return ce(this.#e)?(this.#e.exitCode=t||0,this.#t.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#o;if(t==="exit"&&ce(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#t.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},He=globalThis.process,{onExit:Cr,load:Nc,unload:jc}=Vo(ce(He)?new ze(He):new Ve);var Ho=1e3*5,Ir=(e,t="SIGTERM",r={})=>{let n=e(t);return Wo(e,t,r,n),n},Wo=(e,t,r,n)=>{if(!Jo(t,r,n))return;let o=Ko(r),i=setTimeout(()=>{e("SIGKILL")},o);i.unref&&i.unref()},Jo=(e,{forceKillAfterTimeout:t},r)=>Xo(e)&&t!==!1&&r,Xo=e=>e===zo.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Ko=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Ho;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ar=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Yo=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Rr=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let o,i=new Promise((c,l)=>{o=setTimeout(()=>{Yo(e,r,l)},t)}),a=n.finally(()=>{clearTimeout(o)});return Promise.race([i,a])},Lr=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Nr=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;let o=Cr(()=>{e.kill()});return n.finally(()=>{o()})};s();import{createWriteStream as Zo}from"node:fs";import{ChildProcess as Qo}from"node:child_process";var ei=e=>e instanceof Qo&&typeof e.then=="function",We=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(Zo(r)),e;if(Ce(r))return e[t].pipe(r),e;if(!ei(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Ce(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},jr=e=>{e.stdout!==null&&(e.pipeStdout=We.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=We.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=We.bind(void 0,e,"all"))};s();import{createReadStream as xi,readFileSync as Si}from"node:fs";import{setTimeout as wi}from"node:timers/promises";s();s();s();var V=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:a,finalize:c},{maxBuffer:l=Number.POSITIVE_INFINITY}={})=>{if(!ri(e))throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");let p=t();p.length=0;try{for await(let u of e){let h=ni(u),m=r[h](u,p);kr({convertedChunk:m,state:p,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:l})}return ti({state:p,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:a,maxBuffer:l}),c(p)}catch(u){throw u.bufferedData=c(p),u}},ti=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let a=o(e);a!==void 0&&kr({convertedChunk:a,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},kr=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let a=r(e),c=t.length+a;if(c<=i){$r(e,t,o,c);return}let l=n(e,i-t.length);throw l!==void 0&&$r(l,t,o,i),new ue},$r=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},ri=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",ni=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Dr.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Dr.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Dr}=Object.prototype,ue=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};s();var Je=e=>e,Xe=()=>{},Ke=({contents:e})=>e,fe=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},de=e=>e.length;s();async function Ye(e,t){return V(e,di,t)}var oi=()=>({contents:new ArrayBuffer(0)}),ii=e=>si.encode(e),si=new TextEncoder,Ur=e=>new Uint8Array(e),Br=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),ai=(e,t)=>e.slice(0,t),ci=(e,{contents:t,length:r},n)=>{let o=Mr()?ui(t,n):li(t,n);return new Uint8Array(o).set(e,r),o},li=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Fr(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},ui=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Fr(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Fr=e=>Gr**Math.ceil(Math.log(e)/Math.log(Gr)),Gr=2,fi=({contents:e,length:t})=>Mr()?e:e.slice(0,t),Mr=()=>"resize"in ArrayBuffer.prototype,di={init:oi,convertChunk:{string:ii,buffer:Ur,arrayBuffer:Ur,dataView:Br,typedArray:Br,others:fe},getSize:de,truncateChunk:ai,addChunk:ci,getFinalChunk:Xe,finalize:fi};s();async function pe(e,t){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return qr(await Ye(e,t))}catch(r){throw r.bufferedData!==void 0&&(r.bufferedData=qr(r.bufferedData)),r}}var qr=e=>globalThis.Buffer.from(e);s();async function Ze(e,t){return V(e,yi,t)}var pi=()=>({contents:"",textDecoder:new TextDecoder}),me=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),mi=(e,{contents:t})=>t+e,hi=(e,t)=>e.slice(0,t),gi=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},yi={init:pi,convertChunk:{string:Je,buffer:me,arrayBuffer:me,dataView:me,typedArray:me,others:fe},getSize:de,truncateChunk:hi,addChunk:mi,getFinalChunk:gi,finalize:Ke};var Hr=ee(zr(),1),Wr=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},bi=({input:e,inputFile:t})=>typeof t!="string"?e:(Wr(e),Si(t)),Jr=e=>{let t=bi(e);if(Te(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},Ei=({input:e,inputFile:t})=>typeof t!="string"?e:(Wr(e),xi(t)),Xr=(e,t)=>{let r=Ei(t);r!==void 0&&(Te(r)?r.pipe(e.stdin):e.stdin.end(r))},Kr=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,Hr.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},Qe=async(e,t)=>{if(!(!e||t===void 0)){await wi(0),e.destroy();try{return await t}catch(r){return r.bufferedData}}},et=(e,{encoding:t,buffer:r,maxBuffer:n})=>{if(!(!e||!r))return t==="utf8"||t==="utf-8"?Ze(e,{maxBuffer:n}):t===null||t==="buffer"?pe(e,{maxBuffer:n}):vi(e,n,t)},vi=async(e,t,r)=>(await pe(e,{maxBuffer:t})).toString(r),Yr=async({stdout:e,stderr:t,all:r},{encoding:n,buffer:o,maxBuffer:i},a)=>{let c=et(e,{encoding:n,buffer:o,maxBuffer:i}),l=et(t,{encoding:n,buffer:o,maxBuffer:i}),p=et(r,{encoding:n,buffer:o,maxBuffer:i*2});try{return await Promise.all([a,c,l,p])}catch(u){return Promise.all([{error:u,signal:u.signal,timedOut:u.timedOut},Qe(e,c),Qe(t,l),Qe(r,p)])}};s();var Oi=(async()=>{})().constructor.prototype,Pi=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Oi,e)]),tt=(e,t)=>{for(let[r,n]of Pi){let o=typeof t=="function"?(...i)=>Reflect.apply(n.value,t(),i):n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},Zr=e=>new Promise((t,r)=>{e.on("exit",(n,o)=>{t({exitCode:n,signal:o})}),e.on("error",n=>{r(n)}),e.stdin&&e.stdin.on("error",n=>{r(n)})});s();import{Buffer as Ti}from"node:buffer";import{ChildProcess as Ci}from"node:child_process";var tn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ii=/^[\w.-]+$/,Ai=e=>typeof e!="string"||Ii.test(e)?e:`"${e.replaceAll('"','\\"')}"`,rt=(e,t)=>tn(e,t).join(" "),nt=(e,t)=>tn(e,t).map(r=>Ai(r)).join(" "),Ri=/ +/g;var Qr=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof Ci)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(Ti.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},en=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Li=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{let i=o??e.raw[n],a=i.split(Ri).filter(Boolean),c=en(r,a,i.startsWith(" "));if(n===t.length)return c;let l=t[n],p=Array.isArray(l)?l.map(u=>Qr(u)):[Qr(l)];return en(c,p,i.endsWith(" "))},ot=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=Li({templates:e,expressions:t,tokens:r,index:n,template:o});return r};s();import{debuglog as Ni}from"node:util";import ji from"node:process";var rn=Ni("execa").enabled,he=(e,t)=>String(e).padStart(t,"0"),$i=()=>{let e=new Date;return`${he(e.getHours(),2)}:${he(e.getMinutes(),2)}:${he(e.getSeconds(),2)}.${he(e.getMilliseconds(),3)}`},it=(e,{verbose:t})=>{t&&ji.stderr.write(`[${$i()}] ${e}
|
|
9
|
+
`)};var Ui=1e3*1e3*100,Bi=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:o})=>{let i=t?{...ge.env,...e}:e;return r?xr({env:i,cwd:n,execPath:o}):i},sn=(e,t,r={})=>{let n=on.default._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:Ui,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||ge.cwd(),execPath:ge.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:rn,...r},r.env=Bi(r),r.stdio=Tr(r),ge.platform==="win32"&&ki.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},z=(e,t,r)=>typeof t!="string"&&!Di.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?Ue(t):t;function ye(e,t,r){let n=sn(e,t,r),o=rt(e,t),i=nt(e,t);it(i,n.options),Lr(n.options);let a;try{a=st.spawn(n.file,n.args,n.options)}catch(g){let y=new st.ChildProcess,b=Promise.reject(q({error:g,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return tt(y,b),y}let c=Zr(a),l=Rr(a,n.options,c),p=Nr(a,n.options,l),u={isCanceled:!1};a.kill=Ir.bind(null,a.kill.bind(a)),a.cancel=Ar.bind(null,a,u);let m=wr(async()=>{let[{error:g,exitCode:y,signal:b,timedOut:E},P,T,C]=await Yr(a,n.options,p),K=z(n.options,P),Y=z(n.options,T),Z=z(n.options,C);if(g||y!==0||b!==null){let Q=q({error:g,exitCode:y,signal:b,stdout:K,stderr:Y,all:Z,command:o,escapedCommand:i,parsed:n,timedOut:E,isCanceled:u.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:a.killed});if(!n.options.reject)return Q;throw Q}return{command:o,escapedCommand:i,exitCode:0,stdout:K,stderr:Y,all:Z,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Xr(a,n.options),a.all=Kr(a,n.options),jr(a),tt(a,m),a}function Gi(e,t,r){let n=sn(e,t,r),o=rt(e,t),i=nt(e,t);it(i,n.options);let a=Jr(n.options),c;try{c=st.spawnSync(n.file,n.args,{...n.options,input:a})}catch(u){throw q({error:u,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let l=z(n.options,c.stdout,c.error),p=z(n.options,c.stderr,c.error);if(c.error||c.status!==0||c.signal!==null){let u=q({stdout:l,stderr:p,error:c.error,signal:c.signal,exitCode:c.status,command:o,escapedCommand:i,parsed:n,timedOut:c.error&&c.error.code==="ETIMEDOUT",isCanceled:!1,killed:c.signal!==null});if(!n.options.reject)return u;throw u}return{command:o,escapedCommand:i,exitCode:0,stdout:l,stderr:p,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var Fi=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},nn=(e={})=>({preferLocal:!0,...Fi(e),...e});function an(e){function t(r,...n){if(!Array.isArray(r))return an({...e,...r});let[o,...i]=ot(r,n);return ye(o,i,nn(e))}return t.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[o,...i]=ot(r,n);return Gi(o,i,nn(e))},t}var eu=an();var U=ee(Fn(),1);async function Mn(e,t){let{localTunnel:r}=te();!r&&!await Et(U.bin)&&await(0,U.install)(U.bin);let n=await t.createTunnel({port:e}),o=`http${r?"":"s"}://${n.domain}`,i=new Promise((a,c)=>{let l=r?ye("echo",[n.domain,n.token],{detached:!0}):ye(U.bin,["tunnel","run","--token",n.token]),p=()=>{l.kill()},u=async h=>{h.toString().match(n.domain)?.[0]&&a({domain:o,close:p})};l.stderr?.on("data",u),l.stdout?.on("data",u),l.on("error",h=>{c(h)})});return{domain:o,close:async()=>(await i).close()}}s();var qn=e=>({tunnel:()=>{let t=Date.now();return{finish:({isSuccess:r,failureReason:n})=>e.report(Ot({isSuccess:r,failureReason:n,tunnelCreationTime:Date.now()-t}))}}});function sa(){let e=(0,B.useRef)(),t=Pt({type:"backoffice"}),r=vt();return(0,B.useEffect)(()=>()=>{e.current?.close()},[]),(0,B.useCallback)(async n=>{let o=new re(t),a=qn(r).tunnel();try{let c=await Mn(n,o);return e.current=c,a.finish({isSuccess:!0}),{url:c.domain}}catch(c){throw a.finish({isSuccess:!1,failureReason:c instanceof Error?c.message:"Unknown error"}),c}},[t,r])}s();export{sa as a};
|
|
10
|
+
//# sourceMappingURL=chunk-XQLBMLA6.js.map
|