@adminide-stack/yantra-mobile 12.0.173 → 12.0.174-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/lib/compute.js +54 -1
  2. package/lib/compute.js.map +1 -1
  3. package/lib/features/apps/AppsCatalog.js +10 -0
  4. package/lib/features/apps/AppsCatalog.js.map +1 -1
  5. package/lib/features/apps/mobileAppCatalog.js +6 -1
  6. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  7. package/lib/features/apps/nativeAppHandoff.js +4 -1
  8. package/lib/features/apps/nativeAppHandoff.js.map +1 -1
  9. package/lib/features/apps/nativeSurfaceTwin.js +2 -1
  10. package/lib/features/apps/nativeSurfaceTwin.js.map +1 -1
  11. package/lib/features/channels/ChannelIcon.js +13 -3
  12. package/lib/features/channels/ChannelIcon.js.map +1 -1
  13. package/lib/features/channels/ConnectAppsSheet.js +5 -5
  14. package/lib/features/channels/ConnectAppsSheet.js.map +1 -1
  15. package/lib/features/channels/HomeImessage.js +5 -3
  16. package/lib/features/channels/HomeImessage.js.map +1 -1
  17. package/lib/features/channels/channelLinks.js +13 -1
  18. package/lib/features/channels/channelLinks.js.map +1 -1
  19. package/lib/features/computer/ComputerAgentChatPane.js +45 -0
  20. package/lib/features/computer/ComputerAgentChatPane.js.map +1 -0
  21. package/lib/features/computer/ComputerDesktop.js +164 -0
  22. package/lib/features/computer/ComputerDesktop.js.map +1 -0
  23. package/lib/features/computer/ComputerExperience.js +79 -0
  24. package/lib/features/computer/ComputerExperience.js.map +1 -0
  25. package/lib/features/computer/ComputerHandoff.js +142 -0
  26. package/lib/features/computer/ComputerHandoff.js.map +1 -0
  27. package/lib/features/computer/FilesPane.js +179 -0
  28. package/lib/features/computer/FilesPane.js.map +1 -0
  29. package/lib/features/computer/LivePage.js +1093 -0
  30. package/lib/features/computer/LivePage.js.map +1 -0
  31. package/lib/features/computer/TerminalPane.js +139 -0
  32. package/lib/features/computer/TerminalPane.js.map +1 -0
  33. package/lib/features/computer/computerApi.js +819 -0
  34. package/lib/features/computer/computerApi.js.map +1 -0
  35. package/lib/features/computer/computerChat.js +42 -0
  36. package/lib/features/computer/computerChat.js.map +1 -0
  37. package/lib/features/computer/computerControls.js +227 -0
  38. package/lib/features/computer/computerControls.js.map +1 -0
  39. package/lib/features/computer/computerStyles.js +384 -0
  40. package/lib/features/computer/computerStyles.js.map +1 -0
  41. package/lib/features/computer/computerTheme.js +133 -0
  42. package/lib/features/computer/computerTheme.js.map +1 -0
  43. package/lib/features/computer/handoff.js +73 -0
  44. package/lib/features/computer/handoff.js.map +1 -0
  45. package/lib/features/computer/inputLane.js +171 -0
  46. package/lib/features/computer/inputLane.js.map +1 -0
  47. package/lib/features/computer/inputPump.js +77 -0
  48. package/lib/features/computer/inputPump.js.map +1 -0
  49. package/lib/features/computer/inputSocket.js +148 -0
  50. package/lib/features/computer/inputSocket.js.map +1 -0
  51. package/lib/features/computer/keyboardBridge.js +176 -0
  52. package/lib/features/computer/keyboardBridge.js.map +1 -0
  53. package/lib/features/computer/pageCoordinates.js +19 -0
  54. package/lib/features/computer/pageCoordinates.js.map +1 -0
  55. package/lib/features/computer/pageZoom.js +12 -0
  56. package/lib/features/computer/pageZoom.js.map +1 -0
  57. package/lib/features/computer/pictureGeometry.js +68 -0
  58. package/lib/features/computer/pictureGeometry.js.map +1 -0
  59. package/lib/features/computer/tabsState.js +7 -0
  60. package/lib/features/computer/tabsState.js.map +1 -0
  61. package/lib/features/computer/useComputerHooks.js +146 -0
  62. package/lib/features/computer/useComputerHooks.js.map +1 -0
  63. package/lib/features/games/cubeforgeFriends.js +14 -1
  64. package/lib/features/games/cubeforgeFriends.js.map +1 -1
  65. package/lib/features/games/useCubeforgeFriends.js +5 -2
  66. package/lib/features/games/useCubeforgeFriends.js.map +1 -1
  67. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +146 -37
  68. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -1
  69. package/lib/features/games/vendored/ui/theme.js +3 -1
  70. package/lib/features/games/vendored/ui/theme.js.map +1 -1
  71. package/lib/features/links/openInApp.js +10 -1
  72. package/lib/features/links/openInApp.js.map +1 -1
  73. package/lib/features/webbuilder/WebBuilderExperience.js +180 -44
  74. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  75. package/lib/features/webbuilder/buildFragments.js +16 -3
  76. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  77. package/lib/features/webbuilder/codezenHandoff.js +29 -1
  78. package/lib/features/webbuilder/codezenHandoff.js.map +1 -1
  79. package/lib/features/webbuilder/components/CodeView.js +69 -23
  80. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  81. package/lib/features/webbuilder/components/PreviewFrame.js +62 -2
  82. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  83. package/lib/features/webbuilder/components/PreviewScreen.js +37 -2
  84. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  85. package/lib/features/webbuilder/components/ProjectChat.js +2 -1
  86. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  87. package/lib/features/webbuilder/components/ProjectSheets.js +147 -57
  88. package/lib/features/webbuilder/components/ProjectSheets.js.map +1 -1
  89. package/lib/features/webbuilder/components/PublishSheet.js +106 -2
  90. package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
  91. package/lib/features/webbuilder/components/ReferenceModeChoice.js +105 -0
  92. package/lib/features/webbuilder/components/ReferenceModeChoice.js.map +1 -0
  93. package/lib/features/webbuilder/components/RetentionBanner.js +17 -6
  94. package/lib/features/webbuilder/components/RetentionBanner.js.map +1 -1
  95. package/lib/features/webbuilder/components/SiteUploadSheet.js +327 -0
  96. package/lib/features/webbuilder/components/SiteUploadSheet.js.map +1 -0
  97. package/lib/features/webbuilder/components/StreamStallNote.js +38 -0
  98. package/lib/features/webbuilder/components/StreamStallNote.js.map +1 -0
  99. package/lib/features/webbuilder/components/StudioHome.js +18 -8
  100. package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
  101. package/lib/features/webbuilder/previewRoutes.js +30 -1
  102. package/lib/features/webbuilder/previewRoutes.js.map +1 -1
  103. package/lib/features/webbuilder/studioCatalog.js +9 -2
  104. package/lib/features/webbuilder/studioCatalog.js.map +1 -1
  105. package/lib/features/webbuilder/web/chat/referenceMode.js +11 -0
  106. package/lib/features/webbuilder/web/chat/referenceMode.js.map +1 -0
  107. package/lib/features/webbuilder/web/chat/siteCopy.js +5 -2
  108. package/lib/features/webbuilder/web/chat/siteCopy.js.map +1 -1
  109. package/lib/features/webbuilder/web/chat/streamStall.js +6 -0
  110. package/lib/features/webbuilder/web/chat/streamStall.js.map +1 -0
  111. package/lib/features/webbuilder/web/code/savedCode.js +7 -0
  112. package/lib/features/webbuilder/web/code/savedCode.js.map +1 -0
  113. package/lib/features/webbuilder/web/design/directions.js.map +1 -1
  114. package/lib/features/webbuilder/web/history/versions.js.map +1 -1
  115. package/lib/features/webbuilder/web/import/websiteImport.js +27 -0
  116. package/lib/features/webbuilder/web/import/websiteImport.js.map +1 -0
  117. package/lib/features/webbuilder/web/preview/setupPhase.js +31 -0
  118. package/lib/features/webbuilder/web/preview/setupPhase.js.map +1 -0
  119. package/lib/features/webbuilder/web/publish/siteInsights.js +23 -1
  120. package/lib/features/webbuilder/web/publish/siteInsights.js.map +1 -1
  121. package/lib/features/webbuilder/web/upload/sitePhotos.js +102 -0
  122. package/lib/features/webbuilder/web/upload/sitePhotos.js.map +1 -0
  123. package/lib/routes.json +54 -0
  124. package/lib/screens/ComputerNative/index.js +124 -0
  125. package/lib/screens/ComputerNative/index.js.map +1 -0
  126. package/lib/screens/ComputerNative/useComputerHostChat.js +83 -0
  127. package/lib/screens/ComputerNative/useComputerHostChat.js.map +1 -0
  128. package/lib/screens/GamesNative/index.js +1 -1
  129. package/lib/screens/GamesNative/index.js.map +1 -1
  130. package/lib/screens/Home/components/homeCatalog.js +2 -1
  131. package/lib/screens/Home/components/homeCatalog.js.map +1 -1
  132. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +6 -2
  133. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
  134. package/lib/screens/WebBuilderNative/index.js +15 -3
  135. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  136. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +18 -3
  137. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  138. package/lib/screens/WebBuilderNative/webbuilderTransport.js +16 -7
  139. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  140. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useState,useCallback,useRef,useEffect}from'react';import {StyleSheet,Alert,Linking,Keyboard,BackHandler,View,Text,Share,Clipboard}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {GestureHandlerRootView}from'react-native-gesture-handler';import {useSafeInsets}from'../canvas/withRemoteSafeArea.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {Tap,DIM}from'../inbox/components/Tap.js';import {isBareSeed,studioTurnText,siteScoreTurn}from'./studioCatalog.js';import {brandKitNote,findDesires,importBrandKit}from'../design/surface/brandKit.js';import {useBrandKitInUse}from'../design/surface/useBrandKitInUse.js';import {BrandSheet}from'../design/surface/BrandSheet.js';import {moveLegacyBrandKit}from'./brandKitMove.js';import {titleFromPrompt,displayHost}from'./buildFragments.js';import {parseToolActivity}from'../chat/toolActivity.js';import {friendlySteps,firstContentLanded}from'./stepLabels.js';import {restoreTurnNote}from'./webbuilderPrompts.js';import {webbuilderTheme}from'./webbuilderTheme.js';import {CodeView}from'./components/CodeView.js';import {ProjectChat}from'./components/ProjectChat.js';import {ViewportToggle,PreviewScreen,ViewPicker}from'./components/PreviewScreen.js';import {PublishSheet}from'./components/PublishSheet.js';import {BOTTOM_TABS_SPACE,BottomTabs}from'./components/BottomTabs.js';import {SiteScoreSheet}from'./components/SiteScoreSheet.js';import {ProjectsScreen}from'./components/ProjectsScreen.js';import {TemplatesSheet}from'./components/TemplatesSheet.js';import {StudioHome}from'./components/StudioHome.js';import {VersionsSheet}from'./components/VersionsSheet.js';import {IconButton,Sheet,Toast}from'./components/ui.js';import {exportMessage,exportTurn}from'./exportCode.js';import {ownCloudflareTurn,projectNameOfLiveUrl,plainActionError}from'./publishTools.js';import {SecretsSheet}from'./components/SecretsSheet.js';import {CloudSheet}from'./components/CloudSheet.js';import {MAX_IMAGE_EDIT_BYTES,imageMimeFor}from'./web/code/imageEdit.js';import {useSiteCopyProgress,SiteCopyCard}from'./components/SiteCopyProgress.js';import {copyLine}from'./web/chat/siteCopy.js';import {publishDeployCheck}from'./web/publish/siteInsights.js';import {DraftBanner,DraftsSheet}from'./components/DraftsSheet.js';import {draftBuild,createDrafts}from'./drafts.js';import {draftTurnNote}from'./web/project/drafts.js';import {notReadyHint,projectReadiness}from'./readiness.js';import {SiteStatusSheet}from'./components/SiteStatusSheet.js';import {useRetention,RetentionBanner}from'./components/RetentionBanner.js';import {useGithubAutoSync}from'./useGithubAutoSync.js';import {githubSyncStatus,repoNameOf,githubSettingsPatch}from'./web/github/githubSync.js';import {syncChip,canRunSync}from'./web/github/autoSync.js';import {normalizeGithubRepoUrl}from'./web/project/serverSettings.js';import {ShareSheet}from'./components/ShareSheet.js';import {approvalsSettingsUrl}from'./approvalsLink.js';import {NotesSheet}from'./components/NotesSheet.js';import {projectShareLink}from'./web/sharing/shareLink.js';import {ignoresPatch}from'./web/publish/review/ignores.js';import {publishRequestComment}from'./web/publish/publishRequest.js';import {roleCan}from'./web/sharing/roles.js';import {remixSnapshotParams,snapshotIdFromResult,remixSecretsCheck,buildRemixUrl}from'./web/sharing/share.js';import {OutOfCreditsCard,CreditsSheet}from'./components/Credits.js';import {billingPageUrl}from'./creditsLinks.js';import {useWebBuilderCredits}from'./useWebBuilderCredits.js';import {OUT_OF_CREDITS_TITLE,outOfCreditsText,chipLabel}from'./web/credits/credits.js';import {IntegrationsPanel}from'./components/IntegrationsPanel.js';import {createWebServices}from'./web/webServices.js';import {ProjectMenuSheet,ProjectSettingsSheet,GithubPushSheet,IntegrationsSheet,ImportProjectSheet}from'./components/ProjectSheets.js';import {demoVideoSource,webbuilderDemoHandoff,encodeCodezenHandoff}from'./codezenHandoff.js';import {PreviewAccessProvider,openPreviewInBrowser}from'./usePreviewAccess.js';import {probePreviewPrivacy}from'./previewProbe.js';import {siteShareTarget,PRIVATE_SHARE_TITLE,privateShareMessage}from'./shareLink.js';var __defProp = Object.defineProperty;
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useState,useCallback,useRef,useEffect}from'react';import {StyleSheet,Alert,Linking,Keyboard,BackHandler,View,Text,Share,Clipboard}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {GestureHandlerRootView}from'react-native-gesture-handler';import {useSafeInsets}from'../canvas/withRemoteSafeArea.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {Tap,DIM}from'../inbox/components/Tap.js';import {isBareSeed,studioTurnText,siteScoreTurn}from'./studioCatalog.js';import {brandKitNote,findDesires,importBrandKit}from'../design/surface/brandKit.js';import {useBrandKitInUse}from'../design/surface/useBrandKitInUse.js';import {BrandSheet}from'../design/surface/BrandSheet.js';import {moveLegacyBrandKit}from'./brandKitMove.js';import {titleFromPrompt,displayHost}from'./buildFragments.js';import {parseToolActivity}from'../chat/toolActivity.js';import {friendlySteps,firstContentLanded}from'./stepLabels.js';import {restoreTurnNote}from'./webbuilderPrompts.js';import {webbuilderTheme}from'./webbuilderTheme.js';import {CodeView}from'./components/CodeView.js';import {ProjectChat}from'./components/ProjectChat.js';import {ViewportToggle,PreviewScreen,ViewPicker}from'./components/PreviewScreen.js';import {PublishSheet}from'./components/PublishSheet.js';import {BOTTOM_TABS_SPACE,BottomTabs}from'./components/BottomTabs.js';import {SiteScoreSheet}from'./components/SiteScoreSheet.js';import {ProjectsScreen}from'./components/ProjectsScreen.js';import {TemplatesSheet}from'./components/TemplatesSheet.js';import {StudioHome}from'./components/StudioHome.js';import {VersionsSheet}from'./components/VersionsSheet.js';import {IconButton,Sheet,Toast}from'./components/ui.js';import {exportMessage,exportTurn}from'./exportCode.js';import {ownCloudflareTurn,projectNameOfLiveUrl,plainActionError}from'./publishTools.js';import {SecretsSheet}from'./components/SecretsSheet.js';import {CloudSheet}from'./components/CloudSheet.js';import {MAX_IMAGE_EDIT_BYTES,imageMimeFor}from'./web/code/imageEdit.js';import {useSiteCopyProgress,SiteCopyCard}from'./components/SiteCopyProgress.js';import {heldCopyLine,copyLine}from'./web/chat/siteCopy.js';import {publishDeployCheck}from'./web/publish/siteInsights.js';import {DraftBanner,DraftsSheet}from'./components/DraftsSheet.js';import {draftBuild,createDrafts}from'./drafts.js';import {draftTurnNote}from'./web/project/drafts.js';import {notReadyHint,projectReadiness}from'./readiness.js';import {SiteStatusSheet}from'./components/SiteStatusSheet.js';import {useRetention,RetentionBanner}from'./components/RetentionBanner.js';import {useGithubAutoSync}from'./useGithubAutoSync.js';import {githubSyncStatus,repoNameOf,githubSettingsPatch}from'./web/github/githubSync.js';import {syncChip,canRunSync}from'./web/github/autoSync.js';import {normalizeGithubRepoUrl}from'./web/project/serverSettings.js';import {ShareSheet}from'./components/ShareSheet.js';import {approvalsSettingsUrl}from'./approvalsLink.js';import {NotesSheet}from'./components/NotesSheet.js';import {projectShareLink}from'./web/sharing/shareLink.js';import {ignoresPatch}from'./web/publish/review/ignores.js';import {publishRequestComment}from'./web/publish/publishRequest.js';import {roleCan}from'./web/sharing/roles.js';import {remixSnapshotParams,snapshotIdFromResult,remixSecretsCheck,buildRemixUrl}from'./web/sharing/share.js';import {OutOfCreditsCard,CreditsSheet}from'./components/Credits.js';import {billingPageUrl}from'./creditsLinks.js';import {useWebBuilderCredits}from'./useWebBuilderCredits.js';import {OUT_OF_CREDITS_TITLE,outOfCreditsText,chipLabel}from'./web/credits/credits.js';import {IntegrationsPanel}from'./components/IntegrationsPanel.js';import {createWebServices}from'./web/webServices.js';import {websiteImportBrief}from'./web/import/websiteImport.js';import {siteForLink}from'./web/upload/sitePhotos.js';import {SiteUploadSheet}from'./components/SiteUploadSheet.js';import {setupPhase}from'./web/preview/setupPhase.js';import {ProjectMenuSheet,ProjectSettingsSheet,GithubPushSheet,IntegrationsSheet,ImportProjectSheet}from'./components/ProjectSheets.js';import {isUserOwnedRepo,CODEZEN_NEEDS_GITHUB,codezenRepoHandoff,codezenRepoFragment,demoVideoSource,webbuilderDemoHandoff,encodeCodezenHandoff}from'./codezenHandoff.js';import {PreviewAccessProvider,openPreviewInBrowser}from'./usePreviewAccess.js';import {probePreviewPrivacy}from'./previewProbe.js';import {siteShareTarget,PRIVATE_SHARE_TITLE,privateShareMessage}from'./shareLink.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -60,9 +60,11 @@ function WebBuilderExperience({
60
60
  projectTools,
61
61
  code,
62
62
  initialAgentSeed = null,
63
+ uploadLink = null,
64
+ onUploadLinkDone,
63
65
  previewAccess
64
66
  }) {
65
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
67
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M;
66
68
  const appTheme = useAppTheme();
67
69
  const isDark = hostIsDark != null ? hostIsDark : appTheme.isDark;
68
70
  const theme = useMemo(() => webbuilderTheme(isDark), [isDark]);
@@ -100,37 +102,59 @@ function WebBuilderExperience({
100
102
  setDraft((prev) => isBareSeed(prev) && picked.chatPrompt ? picked.chatPrompt : prev);
101
103
  }, []);
102
104
  const [brandOff, setBrandOff] = useState(false);
105
+ const brandBusy = Boolean(hostChat == null ? void 0 : hostChat.busy) || Boolean(building);
106
+ const wasBrandBusy = useRef(brandBusy);
107
+ useEffect(() => {
108
+ if (wasBrandBusy.current && !brandBusy) setBrandOff(false);
109
+ wasBrandBusy.current = brandBusy;
110
+ }, [brandBusy]);
111
+ const outOfCredits = useCallback(() => {
112
+ if (!(credits == null ? void 0 : credits.out)) return false;
113
+ Alert.alert(OUT_OF_CREDITS_TITLE, outOfCreditsText(true), [{
114
+ text: "Not now",
115
+ style: "cancel"
116
+ }, {
117
+ text: "Plans and top-up",
118
+ onPress: () => {
119
+ Linking.openURL(billingPageUrl(projectTools == null ? void 0 : projectTools.appUrl)).catch(() => void 0);
120
+ }
121
+ }]);
122
+ return true;
123
+ }, [credits, projectTools == null ? void 0 : projectTools.appUrl]);
103
124
  const startSite = useCallback((start, files) => {
104
125
  const brief = start.brief.trim() || (start.template ? start.template.chatPrompt || start.template.title : "");
105
- if (!brief && !(files == null ? void 0 : files.length)) return;
106
- if (credits == null ? void 0 : credits.out) {
107
- Alert.alert(OUT_OF_CREDITS_TITLE, outOfCreditsText(true), [{
108
- text: "Not now",
109
- style: "cancel"
110
- }, {
111
- text: "Plans and top-up",
112
- onPress: () => {
113
- Linking.openURL(billingPageUrl(projectTools == null ? void 0 : projectTools.appUrl)).catch(() => void 0);
114
- }
115
- }]);
116
- return;
117
- }
118
- onStartProject(__spreadValues(__spreadValues({
126
+ const copyingSite = Boolean(start.referenceUrl) && start.referenceMode === "copy";
127
+ if (!brief && !(files == null ? void 0 : files.length) && !copyingSite) return;
128
+ if (outOfCredits()) return;
129
+ const copying = copyingSite;
130
+ onStartProject(__spreadValues(__spreadValues(__spreadValues({
119
131
  text: studioTurnText({
120
132
  brief,
121
- brandBlock: brandOff ? null : brandKitNote(brand) || null,
122
- referenceUrl: start.referenceUrl
133
+ brandBlock: brandOff || copying ? null : brandKitNote(brand) || null,
134
+ referenceUrl: start.referenceUrl,
135
+ referenceMode: start.referenceMode,
136
+ referenceGraphics: start.referenceGraphics
123
137
  }),
124
- template: start.template
125
- }, start.referenceUrl ? {
138
+ template: copying ? null : start.template
139
+ }, copying ? {
140
+ agent: true
141
+ } : {}), start.referenceUrl && !copying ? {
126
142
  referenceUrl: start.referenceUrl
127
143
  } : {}), (files == null ? void 0 : files.length) ? {
128
144
  attachments: files
129
145
  } : {}));
130
146
  setDraft("");
131
147
  setTemplate(null);
132
- setBrandOff(false);
133
- }, [onStartProject, brand, brandOff, credits, projectTools == null ? void 0 : projectTools.appUrl]);
148
+ }, [onStartProject, brand, brandOff, outOfCredits]);
149
+ const startWebsiteCopy = useCallback((url, graphics) => {
150
+ if (outOfCredits()) return false;
151
+ onStartProject({
152
+ text: websiteImportBrief(url, graphics),
153
+ template: null,
154
+ agent: true
155
+ });
156
+ return true;
157
+ }, [onStartProject, outOfCredits]);
134
158
  const handedOff = useRef(false);
135
159
  useEffect(() => {
136
160
  if (handedOff.current || !initialAgentSeed || startBlocked) return;
@@ -218,6 +242,31 @@ ${draftTurnNote(openDraft, openDraft.sandboxId)}` : text, [openDraft]);
218
242
  hostChat.send(inDraft(turn), files, build);
219
243
  });
220
244
  }, [hostChat, build, activeChannelId, showToast, inDraft]);
245
+ const [uploadPicked, setUploadPicked] = useState(null);
246
+ const uploadPages = useRef(1);
247
+ const uploadResolved = siteForLink(projects, (_c = uploadLink == null ? void 0 : uploadLink.build) != null ? _c : null, {
248
+ loading: Boolean(projectsLoading),
249
+ pagesSettled: uploadPages.current,
250
+ hasMore: Boolean(projectsHasMore && onLoadMoreProjects),
251
+ error: Boolean(projectsError)
252
+ });
253
+ const uploadSite = uploadPicked ? __spreadProps(__spreadValues({}, uploadResolved), {
254
+ site: uploadPicked,
255
+ state: "ready"
256
+ }) : uploadResolved;
257
+ useEffect(() => {
258
+ if (!uploadLink || uploadResolved.state !== "load-more" || projectsLoading) return;
259
+ uploadPages.current += 1;
260
+ onLoadMoreProjects == null ? void 0 : onLoadMoreProjects();
261
+ }, [uploadLink, uploadResolved.state, projectsLoading, onLoadMoreProjects]);
262
+ useEffect(() => {
263
+ if (!uploadLink) uploadPages.current = 1;
264
+ }, [uploadLink]);
265
+ const uploadChannel = uploadLink ? (_e = (_d = uploadSite.site) == null ? void 0 : _d.channelId) != null ? _e : null : null;
266
+ useEffect(() => {
267
+ if (uploadChannel && uploadChannel !== activeChannelId) onOpenProject(uploadChannel);
268
+ }, [uploadChannel, activeChannelId, onOpenProject]);
269
+ const uploadLastReply = uploadLink ? (_h = (_g = [...(_f = hostChat == null ? void 0 : hostChat.messages) != null ? _f : []].reverse().find((m) => m.role === "assistant")) == null ? void 0 : _g.content) != null ? _h : null : null;
221
270
  const openChat = useCallback(() => {
222
271
  Keyboard.dismiss();
223
272
  setMode("chat");
@@ -317,8 +366,8 @@ ${restoreTurnNote({
317
366
  const [versionsOpen, setVersionsOpen] = useState(false);
318
367
  const [publishStarted, setPublishStarted] = useState(null);
319
368
  useEffect(() => setPublishStarted(null), [activeChannelId]);
320
- const siteLive = (_d = (_c = builds.find((b) => b.liveUrl)) == null ? void 0 : _c.liveUrl) != null ? _d : null;
321
- const liveSince = (_f = (_e = builds.find((b) => b.liveUrl)) == null ? void 0 : _e.updatedAt) != null ? _f : 0;
369
+ const siteLive = (_j = (_i = builds.find((b) => b.liveUrl)) == null ? void 0 : _i.liveUrl) != null ? _j : null;
370
+ const liveSince = (_l = (_k = builds.find((b) => b.liveUrl)) == null ? void 0 : _k.updatedAt) != null ? _l : 0;
322
371
  const landedLive = Boolean(publishStarted && liveSince >= publishStarted.at - 2e3);
323
372
  useEffect(() => {
324
373
  if (!publishStarted) return;
@@ -410,7 +459,7 @@ ${restoreTurnNote({
410
459
  });
411
460
  return () => sub.remove();
412
461
  }, [back]);
413
- const live = (_h = (_g = build == null ? void 0 : build.liveUrl) != null ? _g : project == null ? void 0 : project.liveUrl) != null ? _h : null;
462
+ const live = (_n = (_m = build == null ? void 0 : build.liveUrl) != null ? _m : project == null ? void 0 : project.liveUrl) != null ? _n : null;
414
463
  let statusText = "New";
415
464
  let statusTone = theme.muted;
416
465
  if (building || (hostChat == null ? void 0 : hostChat.busy)) {
@@ -438,8 +487,9 @@ ${restoreTurnNote({
438
487
  const coverSteps = friendlySteps(liveSteps);
439
488
  const buildingCover = turnBusy && build && !hadBuildsAtTurnStart.current && !firstContentLanded(liveSteps) ? {
440
489
  title: siteTitle || build.title,
441
- step: (_j = (_i = coverSteps[coverSteps.length - 1]) == null ? void 0 : _i.label) != null ? _j : null
490
+ step: (_p = (_o = coverSteps[coverSteps.length - 1]) == null ? void 0 : _o.label) != null ? _p : null
442
491
  } : null;
492
+ const setupNotice = turnBusy && build && !buildingCover ? setupPhase(hostChat == null ? void 0 : hostChat.streaming) : null;
443
493
  let publishLabel = "Publish";
444
494
  if (publishing) publishLabel = "Publishing\u2026";
445
495
  const shareUrl = live || (build == null ? void 0 : build.previewUrl) || null;
@@ -548,8 +598,10 @@ ${restoreTurnNote({
548
598
  const content = typeof (d == null ? void 0 : d.content) === "string" ? d.content : "";
549
599
  return content ? `data:${imageMimeFor(path)};base64,${content}` : null;
550
600
  }, [build, publishTools]);
551
- const copyText = (hostChat == null ? void 0 : hostChat.busy) ? (_m = hostChat.streaming) != null ? _m : (_l = [...(_k = hostChat.messages) != null ? _k : []].reverse().find((m) => m.role === "assistant")) == null ? void 0 : _l.content : null;
552
- const copyTarget = (_o = (_n = copyLine(copyText)) == null ? void 0 : _n.sandboxId) != null ? _o : null;
601
+ const copyText = (hostChat == null ? void 0 : hostChat.busy) ? (_s = hostChat.streaming) != null ? _s : (_r = [...(_q = hostChat.messages) != null ? _q : []].reverse().find((m) => m.role === "assistant")) == null ? void 0 : _r.content : null;
602
+ const copyHeld = useRef(null);
603
+ copyHeld.current = heldCopyLine(copyHeld.current, (_u = (_t = copyLine(copyText)) == null ? void 0 : _t.sandboxId) != null ? _u : null, Boolean(hostChat == null ? void 0 : hostChat.busy));
604
+ const copyTarget = copyHeld.current;
553
605
  const siteCopy = useSiteCopyProgress(publishTools == null ? void 0 : publishTools.run, build, copyTarget);
554
606
  const [draftsOpen, setDraftsOpen] = useState(false);
555
607
  const drafts = useMemo(() => webServices && (publishTools == null ? void 0 : publishTools.run) && activeChannelId ? createDrafts({
@@ -583,7 +635,7 @@ ${restoreTurnNote({
583
635
  live2 = false;
584
636
  };
585
637
  }, [webServices, activeChannelId, publishOpen]);
586
- const retention = useRetention(projectTools == null ? void 0 : projectTools.graphql, activeChannelId);
638
+ const retention = useRetention(projectTools == null ? void 0 : projectTools.graphql, activeChannelId, (_v = builds[0]) == null ? void 0 : _v.updatedAt);
587
639
  const [roleEpoch, setRoleEpoch] = useState(0);
588
640
  const [projectRole, setProjectRole] = useState(null);
589
641
  useEffect(() => {
@@ -631,6 +683,36 @@ ${secrets.note}` : ""}`, [{
631
683
  }).catch(() => void 0)
632
684
  }]);
633
685
  };
686
+ const codezenAfterPush = useRef(false);
687
+ const codezenPushStarted = useRef(false);
688
+ const openCodezenRepo = (repoUrl, branch) => {
689
+ const handoff = codezenRepoHandoff(repoUrl, {
690
+ branch,
691
+ title: siteTitle || (build == null ? void 0 : build.title) || ""
692
+ });
693
+ if (!handoff || !onOpenCodezen) return;
694
+ onOpenCodezen(codezenRepoFragment(handoff));
695
+ };
696
+ const pushedRepo = normalizeGithubRepoUrl((_w = githubSync.settings) == null ? void 0 : _w.repoUrl) || null;
697
+ useEffect(() => {
698
+ if (!codezenAfterPush.current || !codezenPushStarted.current || !pushedRepo) return;
699
+ codezenAfterPush.current = false;
700
+ codezenPushStarted.current = false;
701
+ if (!isUserOwnedRepo(pushedRepo)) {
702
+ Alert.alert("Code in Codezen", CODEZEN_NEEDS_GITHUB);
703
+ return;
704
+ }
705
+ Alert.alert("Your code is on GitHub", "Open it in Codezen to keep building by hand.", [{
706
+ text: "Not now",
707
+ style: "cancel"
708
+ }, {
709
+ text: "Open Codezen",
710
+ onPress: () => {
711
+ var _a2;
712
+ return openCodezenRepo(pushedRepo, (_a2 = githubSync.settings) == null ? void 0 : _a2.branch);
713
+ }
714
+ }]);
715
+ }, [pushedRepo]);
634
716
  const filmDemo = () => {
635
717
  const demo = build && !building ? demoVideoSource(live, build.previewUrl) : null;
636
718
  if (!demo || !onOpenCodezen) return;
@@ -895,6 +977,23 @@ ${secrets.note}` : ""}`, [{
895
977
  }
896
978
  });
897
979
  }
980
+ if (onOpenCodezen && roleCan(projectRole, "build")) {
981
+ const ownRepo = isUserOwnedRepo(repoUrl) ? repoUrl : null;
982
+ children.push({
983
+ key: "github-codezen",
984
+ icon: "code-braces",
985
+ label: "Code in Codezen",
986
+ hint: ownRepo ? "The whole repo in a coding workspace" : "Puts the code on your GitHub, then opens it to keep building by hand",
987
+ run: () => {
988
+ if (ownRepo) {
989
+ openCodezenRepo(ownRepo, gh == null ? void 0 : gh.branch);
990
+ return;
991
+ }
992
+ codezenAfterPush.current = true;
993
+ setGithubOpen(true);
994
+ }
995
+ });
996
+ }
898
997
  let hint;
899
998
  if (repoUrl) hint = (gh == null ? void 0 : gh.sync) ? "Keeping in sync" : "Connected";
900
999
  tools.push({
@@ -1019,7 +1118,7 @@ ${secrets.note}` : ""}`, [{
1019
1118
  ] })
1020
1119
  ] })
1021
1120
  ] }),
1022
- mode === "chat" ? /* @__PURE__ */ jsx(ProjectChat, { messages: (_p = hostChat == null ? void 0 : hostChat.messages) != null ? _p : [], streaming: (_q = hostChat == null ? void 0 : hostChat.streaming) != null ? _q : null, busy: Boolean(hostChat == null ? void 0 : hostChat.busy), error: (_r = hostChat == null ? void 0 : hostChat.error) != null ? _r : null, connected: Boolean(hostChat == null ? void 0 : hostChat.connected), building, build, siteTitle: siteTitle || "Your site", onSend: (text, files) => sendToAgent(text, files), codeActions: Boolean(hostChat && (build == null ? void 0 : build.sandboxId)), holdTurn, liveCard: siteCopy ? /* @__PURE__ */ jsx(SiteCopyCard, { view: siteCopy, theme }) : null, code: code != null ? code : void 0, permissionsUrl: approvalsSettingsUrl(projectTools == null ? void 0 : projectTools.appUrl), templates, onStartFromTemplate: (t, brief) => startSite({
1121
+ mode === "chat" ? /* @__PURE__ */ jsx(ProjectChat, { messages: (_x = hostChat == null ? void 0 : hostChat.messages) != null ? _x : [], streaming: (_y = hostChat == null ? void 0 : hostChat.streaming) != null ? _y : null, busy: Boolean(hostChat == null ? void 0 : hostChat.busy), error: (_z = hostChat == null ? void 0 : hostChat.error) != null ? _z : null, connected: Boolean(hostChat == null ? void 0 : hostChat.connected), building, build, siteTitle: siteTitle || "Your site", onSend: (text, files) => sendToAgent(text, files), codeActions: Boolean(hostChat && (build == null ? void 0 : build.sandboxId)), holdTurn, liveCard: siteCopy ? /* @__PURE__ */ jsx(SiteCopyCard, { view: siteCopy, theme }) : null, code: code != null ? code : void 0, permissionsUrl: approvalsSettingsUrl(projectTools == null ? void 0 : projectTools.appUrl), templates, onStartFromTemplate: (t, brief) => startSite({
1023
1122
  brief,
1024
1123
  template: t
1025
1124
  }), banner: /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1028,13 +1127,13 @@ ${secrets.note}` : ""}`, [{
1028
1127
  showToast("Back to the project.");
1029
1128
  }, theme }) : null,
1030
1129
  /* @__PURE__ */ jsx(RetentionBanner, { view: retention, appUrl: projectTools == null ? void 0 : projectTools.appUrl, canExtend: projectRole !== "viewer", onDownload: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, theme })
1031
- ] }), costLine: ((_s = credits == null ? void 0 : credits.costLine) == null ? void 0 : _s.channelId) === activeChannelId ? credits.costLine.text : null, creditsCard: (credits == null ? void 0 : credits.cardOpen) ? /* @__PURE__ */ jsx(OutOfCreditsCard, { appUrl: projectTools == null ? void 0 : projectTools.appUrl, onCheckAgain: () => credits.refresh({
1130
+ ] }), costLine: ((_A = credits == null ? void 0 : credits.costLine) == null ? void 0 : _A.channelId) === activeChannelId ? credits.costLine.text : null, creditsCard: (credits == null ? void 0 : credits.cardOpen) ? /* @__PURE__ */ jsx(OutOfCreditsCard, { appUrl: projectTools == null ? void 0 : projectTools.appUrl, onCheckAgain: () => credits.refresh({
1032
1131
  fresh: true
1033
- }), onDismiss: credits.dismissCard, theme }) : null, onOpenPreview: () => setMode("preview"), onPublish: openPublish, onPreviewAsleep: () => wakePreview(), previewDown: Boolean(previewTrouble && previewTrouble.kind !== "restoring"), ask: (_t = hostChat == null ? void 0 : hostChat.ask) != null ? _t : null, onAnswerAsk: (formatted) => hostChat == null ? void 0 : hostChat.send(formatted), loading: historyLoading, steering: hostChat == null ? void 0 : hostChat.steering, renderConnectorCard: hostChat == null ? void 0 : hostChat.renderConnectorCard, onCopyLink: copySiteLink, theme, bottomInset: insets.bottom }) : null,
1034
- mode === "preview" ? /* @__PURE__ */ jsx(PreviewScreen, { build, building, loading: buildsLoading, previewNonce, onReload: () => setPreviewNonce((n) => n + 1), onWake: () => wakePreview(), waking, trouble: previewTrouble, onRetry: () => wakePreview(true), onRestore: restoreFromSavedCopy, onAskAiRestore: hostChat ? askAiToRestore : void 0, agentBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), steps: liveSteps, onPublish: openPublish, publishLabel, error: (_u = hostChat == null ? void 0 : hostChat.error) != null ? _u : null, theme, bottomInset: insets.bottom, viewport, unpublished: Boolean(build == null ? void 0 : build.sandboxId) && !(build == null ? void 0 : build.liveUrl), readSourceFile: code && build ? (path) => code.readFile(build, path, false).then((r) => {
1132
+ }), onDismiss: credits.dismissCard, theme }) : null, onOpenPreview: () => setMode("preview"), onPublish: openPublish, onPreviewAsleep: () => wakePreview(), previewDown: Boolean(previewTrouble && previewTrouble.kind !== "restoring"), ask: (_B = hostChat == null ? void 0 : hostChat.ask) != null ? _B : null, onAnswerAsk: (formatted) => hostChat == null ? void 0 : hostChat.send(formatted), loading: historyLoading, steering: hostChat == null ? void 0 : hostChat.steering, renderConnectorCard: hostChat == null ? void 0 : hostChat.renderConnectorCard, onCopyLink: copySiteLink, theme, bottomInset: insets.bottom }) : null,
1133
+ mode === "preview" ? /* @__PURE__ */ jsx(PreviewScreen, { build, building, loading: buildsLoading, previewNonce, onReload: () => setPreviewNonce((n) => n + 1), onWake: () => wakePreview(), waking, trouble: previewTrouble, onRetry: () => wakePreview(true), onRestore: restoreFromSavedCopy, onAskAiRestore: hostChat ? askAiToRestore : void 0, agentBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), steps: liveSteps, onPublish: openPublish, publishLabel, error: (_C = hostChat == null ? void 0 : hostChat.error) != null ? _C : null, theme, bottomInset: insets.bottom, viewport, unpublished: Boolean(build == null ? void 0 : build.sandboxId) && !(build == null ? void 0 : build.liveUrl), readSourceFile: code && build ? (path) => code.readFile(build, path, false).then((r) => {
1035
1134
  var _a2;
1036
1135
  return r.ok ? (_a2 = r.content) != null ? _a2 : null : null;
1037
- }) : void 0, onShowCode: canShowCode ? () => setMode("code") : void 0, buildingCover }) : null,
1136
+ }) : void 0, onShowCode: canShowCode ? () => setMode("code") : void 0, buildingCover, setupNotice }) : null,
1038
1137
  mode === "code" ? /* @__PURE__ */ jsxs(View, { style: [styles.fill, {
1039
1138
  backgroundColor: theme.card,
1040
1139
  paddingBottom: insets.bottom
@@ -1049,7 +1148,7 @@ ${secrets.note}` : ""}`, [{
1049
1148
  color: theme.ink
1050
1149
  }], numberOfLines: 1, children: "Code" })
1051
1150
  ] }),
1052
- /* @__PURE__ */ jsx(CodeView, { files: (_v = build == null ? void 0 : build.files) != null ? _v : null, build, code, readImage: (publishTools == null ? void 0 : publishTools.run) && (build == null ? void 0 : build.sandboxId) ? readSiteImage : void 0, onImageEdit: hostChat && roleCan(projectRole, "build") ? (req) => {
1151
+ /* @__PURE__ */ jsx(CodeView, { files: (_D = build == null ? void 0 : build.files) != null ? _D : null, build, code, readImage: (publishTools == null ? void 0 : publishTools.run) && (build == null ? void 0 : build.sandboxId) ? readSiteImage : void 0, onImageEdit: hostChat && roleCan(projectRole, "build") ? (req) => {
1053
1152
  if (!build || hostChat.busy || holdTurn()) return false;
1054
1153
  hostChat.send(inDraft(`${req.text}
1055
1154
 
@@ -1059,7 +1158,7 @@ ${req.note}`), req.attachments, build);
1059
1158
  } : void 0, busy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onWake: build && onResumePreview ? () => onResumePreview(build).then((outcome) => {
1060
1159
  if (outcome === "ok") setPreviewNonce((n) => n + 1);
1061
1160
  return outcome;
1062
- }) : void 0, theme, onAsk: openChat })
1161
+ }) : void 0, githubUrl: normalizeGithubRepoUrl((_E = githubSync.settings) == null ? void 0 : _E.repoUrl) || null, onDownload: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, theme, onAsk: openChat })
1063
1162
  ] }) : null
1064
1163
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1065
1164
  homeTab === "create" ? /* @__PURE__ */ jsx(View, { style: [styles.header, styles.headerBare, {
@@ -1072,7 +1171,7 @@ ${req.note}`), req.attachments, build);
1072
1171
  }, brand, brandOff, onBrandOffChange: setBrandOff, onBrand: () => setBrandOpen(true), onSiteScore: () => setScoreOpen(true), onStart: startSite, connecting: startBlocked, startNotice, theme, bottomInset: BOTTOM_TABS_SPACE + insets.bottom }) : /* @__PURE__ */ jsx(ProjectsScreen, { projects, loading: projectsLoading, error: projectsError, hasMore: projectsHasMore, onRefresh: onRefreshProjects, onLoadMore: onLoadMoreProjects, onOpen: (p) => onOpenProject(p.channelId), onNewProject: () => setHomeTab("create"), topInset: insets.top + 12, bottomInset: BOTTOM_TABS_SPACE + insets.bottom, theme }) }),
1073
1172
  /* @__PURE__ */ jsx(BottomTabs, { tab: homeTab, onTab: setHomeTab, theme, bottomInset: insets.bottom })
1074
1173
  ] }),
1075
- /* @__PURE__ */ jsx(TemplatesSheet, { visible: templatesOpen, onClose: () => setTemplatesOpen(false), templates, loading: templatesLoading, error: templatesError, onReload: onReloadTemplates, selectedId: (_w = template == null ? void 0 : template.id) != null ? _w : null, onPick: pickTemplate, theme }),
1174
+ /* @__PURE__ */ jsx(TemplatesSheet, { visible: templatesOpen, onClose: () => setTemplatesOpen(false), templates, loading: templatesLoading, error: templatesError, onReload: onReloadTemplates, selectedId: (_F = template == null ? void 0 : template.id) != null ? _F : null, onPick: pickTemplate, theme }),
1076
1175
  /* @__PURE__ */ jsx(SiteScoreSheet, { visible: scoreOpen, onClose: () => setScoreOpen(false), blocked: startBlocked, onCheck: (url) => {
1077
1176
  setScoreOpen(false);
1078
1177
  onStartProject({
@@ -1091,19 +1190,23 @@ ${req.note}`), req.attachments, build);
1091
1190
  onRefreshProjects == null ? void 0 : onRefreshProjects();
1092
1191
  }, onClose: () => setSettingsMode(null), theme }),
1093
1192
  /* @__PURE__ */ jsx(GithubPushSheet, { visible: githubOpen, build, channelId: activeChannelId, title: siteTitle || (build == null ? void 0 : build.title) || "", tools: projectTools, onStarted: (message) => {
1193
+ if (codezenAfterPush.current) codezenPushStarted.current = true;
1094
1194
  showToast(message);
1095
1195
  setMode("chat");
1096
1196
  setTimeout(githubSync.reload, 5e3);
1097
- }, onClose: () => setGithubOpen(false), theme }),
1197
+ }, onClose: () => {
1198
+ if (!codezenPushStarted.current) codezenAfterPush.current = false;
1199
+ setGithubOpen(false);
1200
+ }, theme }),
1098
1201
  webServices ? /* @__PURE__ */ jsx(IntegrationsPanel, { visible: integrationsOpen, channelId: activeChannelId, services: webServices, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onRequest: (text) => askAgent(text), onClose: () => setIntegrationsOpen(false), theme }) : /* @__PURE__ */ jsx(IntegrationsSheet, { visible: integrationsOpen, channelId: activeChannelId, tools: projectTools, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onRequest: (text) => askAgent(text), onClose: () => setIntegrationsOpen(false), theme })
1099
1202
  ] }) : null,
1100
- webServices ? /* @__PURE__ */ jsx(CreditsSheet, { visible: creditsOpen, balance: (_x = credits == null ? void 0 : credits.balance) != null ? _x : null, appUrl: projectTools == null ? void 0 : projectTools.appUrl, onRefresh: () => {
1203
+ webServices ? /* @__PURE__ */ jsx(CreditsSheet, { visible: creditsOpen, balance: (_G = credits == null ? void 0 : credits.balance) != null ? _G : null, appUrl: projectTools == null ? void 0 : projectTools.appUrl, onRefresh: () => {
1101
1204
  var _a2;
1102
1205
  return (_a2 = credits == null ? void 0 : credits.refresh({
1103
1206
  fresh: true
1104
1207
  })) != null ? _a2 : Promise.resolve(null);
1105
1208
  }, onClose: () => setCreditsOpen(false), theme }) : null,
1106
- /* @__PURE__ */ jsx(DraftsSheet, { visible: draftsOpen, project: projectBuild, drafts, openDraftId: (_y = openDraft == null ? void 0 : openDraft.id) != null ? _y : null, canEdit: roleCan(projectRole, "build"), onOpen: (d) => {
1209
+ /* @__PURE__ */ jsx(DraftsSheet, { visible: draftsOpen, project: projectBuild, drafts, openDraftId: (_H = openDraft == null ? void 0 : openDraft.id) != null ? _H : null, canEdit: roleCan(projectRole, "build"), onOpen: (d) => {
1107
1210
  setOpenDraft(d);
1108
1211
  setMode("chat");
1109
1212
  showToast(d ? `In the draft "${d.name}".` : "Back to the project.");
@@ -1123,17 +1226,50 @@ ${req.note}`), req.attachments, build);
1123
1226
  return true;
1124
1227
  }, onClose: () => setCloudOpen(false), theme }) : null,
1125
1228
  webServices ? /* @__PURE__ */ jsx(SecretsSheet, { visible: secretsOpen, channelId: activeChannelId, build, secrets: webServices.secrets, runAction: publishTools == null ? void 0 : publishTools.run, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onClose: () => setSecretsOpen(false), theme }) : null,
1229
+ /* @__PURE__ */ jsx(SiteUploadSheet, { visible: Boolean(uploadLink), onClose: () => {
1230
+ setUploadPicked(null);
1231
+ onUploadLinkDone == null ? void 0 : onUploadLinkDone();
1232
+ }, linkState: uploadSite.state, site: uploadSite.site, choices: uploadSite.choices, onPickSite: (p) => setUploadPicked(p), ready: Boolean(uploadSite.site && activeChannelId === uploadSite.site.channelId && hostChat && build), busy: Boolean(hostChat == null ? void 0 : hostChat.busy) || Boolean(building), lastReply: uploadLastReply, messageCount: (_J = (_I = hostChat == null ? void 0 : hostChat.messages) == null ? void 0 : _I.length) != null ? _J : 0, onSend: (text, files) => {
1233
+ if (!hostChat || !build) return {
1234
+ ok: false,
1235
+ reason: "Opening your site. Try again in a moment."
1236
+ };
1237
+ if (credits == null ? void 0 : credits.out) {
1238
+ return {
1239
+ ok: false,
1240
+ reason: "Your AI credits have run out, so Yantra cannot do this right now."
1241
+ };
1242
+ }
1243
+ if (hostChat.busy || building) {
1244
+ return {
1245
+ ok: false,
1246
+ reason: "Yantra is working on this site. Try again in a moment."
1247
+ };
1248
+ }
1249
+ hostChat.send(inDraft(text), files, build);
1250
+ return {
1251
+ ok: true
1252
+ };
1253
+ }, onReview: () => {
1254
+ setUploadPicked(null);
1255
+ onUploadLinkDone == null ? void 0 : onUploadLinkDone();
1256
+ setMode("preview");
1257
+ }, onAnswerInChat: () => {
1258
+ setUploadPicked(null);
1259
+ onUploadLinkDone == null ? void 0 : onUploadLinkDone();
1260
+ openChat();
1261
+ }, theme }),
1126
1262
  /* @__PURE__ */ jsx(ImportProjectSheet, { visible: importOpen, onImport: (turn) => {
1127
1263
  onStartProject({
1128
1264
  text: turn,
1129
1265
  template: null,
1130
1266
  agent: true
1131
1267
  });
1132
- }, onClose: () => setImportOpen(false), theme }),
1268
+ }, onImportWebsite: startWebsiteCopy, onClose: () => setImportOpen(false), theme }),
1133
1269
  /* @__PURE__ */ jsx(PublishSheet, { visible: publishOpen, build, publishing, onPublish: onPublish ? publish : void 0, onClose: () => setPublishOpen(false), theme, liveUrl: live, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), tools: publishTools, onDownloadCode: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, onExport: hostChat && !building ? exportTo : void 0, onOwnCloudflare: hostChat && !building ? () => askAgent(ownCloudflareTurn(siteTitle || (build == null ? void 0 : build.title) || "")) : void 0, onFixWithAi: hostChat ? (text) => askAgent(text) : void 0, onUnpublished: () => showToast("The site is offline now."), onSiteStatus: (publishTools == null ? void 0 : publishTools.run) && live ? () => {
1134
1270
  setPublishOpen(false);
1135
1271
  setTimeout(() => setSiteStatusOpen(true), 300);
1136
- } : void 0, progressText: publishing ? (_z = building == null ? void 0 : building.statusText) != null ? _z : null : null, reviewIgnores, appUrl: projectTools == null ? void 0 : projectTools.appUrl, askToPublish: projectRole === "viewer" && (projectTools == null ? void 0 : projectTools.graphql) && activeChannelId ? async (note) => {
1272
+ } : void 0, progressText: publishing ? (_K = building == null ? void 0 : building.statusText) != null ? _K : null : null, reviewIgnores, appUrl: projectTools == null ? void 0 : projectTools.appUrl, askToPublish: projectRole === "viewer" && (projectTools == null ? void 0 : projectTools.graphql) && activeChannelId ? async (note) => {
1137
1273
  var _a2, _b2, _c2;
1138
1274
  const r = await projectTools.graphql.mutate(ADD_COMMENT_MUTATION, {
1139
1275
  channelId: activeChannelId,
@@ -1169,9 +1305,9 @@ ${req.note}`), req.attachments, build);
1169
1305
  setSelectedKey(picked.key === (latest == null ? void 0 : latest.key) ? null : picked.key);
1170
1306
  setVersionsOpen(false);
1171
1307
  }, onClose: () => setVersionsOpen(false), theme }),
1172
- /* @__PURE__ */ jsx(Sheet, { visible: menu !== null, title: (_A = menu == null ? void 0 : menu.title) != null ? _A : "", onClose: () => setMenu(null), theme, children: /* @__PURE__ */ jsx(View, { style: [styles.menuList, {
1308
+ /* @__PURE__ */ jsx(Sheet, { visible: menu !== null, title: (_L = menu == null ? void 0 : menu.title) != null ? _L : "", onClose: () => setMenu(null), theme, children: /* @__PURE__ */ jsx(View, { style: [styles.menuList, {
1173
1309
  paddingBottom: insets.bottom + 8
1174
- }], children: ((_B = menu == null ? void 0 : menu.actions) != null ? _B : []).map((action) => /* @__PURE__ */ jsx(Tap, { onPress: () => chooseMenu(action), accessibilityRole: "button", style: [styles.menuRow, {
1310
+ }], children: ((_M = menu == null ? void 0 : menu.actions) != null ? _M : []).map((action) => /* @__PURE__ */ jsx(Tap, { onPress: () => chooseMenu(action), accessibilityRole: "button", style: [styles.menuRow, {
1175
1311
  borderBottomColor: theme.border
1176
1312
  }], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.menuLabel, {
1177
1313
  color: action.destructive ? theme.crit : theme.ink