@devcabs/folio-engine 0.0.0-stage → 0.1.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 (193) hide show
  1. package/dist/App.d.ts +7 -0
  2. package/dist/components/canvas/CanvasAddBar.d.ts +28 -0
  3. package/dist/components/canvas/CanvasAddModal.d.ts +38 -0
  4. package/dist/components/canvas/CanvasChart.d.ts +23 -0
  5. package/dist/components/canvas/CanvasDeleteConfirmModal.d.ts +21 -0
  6. package/dist/components/canvas/CanvasGallery.d.ts +20 -0
  7. package/dist/components/canvas/CanvasItemControls.d.ts +33 -0
  8. package/dist/components/canvas/CanvasPhoto.d.ts +28 -0
  9. package/dist/components/canvas/CanvasSection.d.ts +27 -0
  10. package/dist/components/canvas/CanvasSubsection.d.ts +23 -0
  11. package/dist/components/canvas/CanvasText.d.ts +23 -0
  12. package/dist/components/canvas/DocumentCanvas.d.ts +20 -0
  13. package/dist/components/canvas/HeroPhoto.d.ts +17 -0
  14. package/dist/components/canvas/NodeCanvas.d.ts +2 -0
  15. package/dist/components/canvas/index.d.ts +17 -0
  16. package/dist/components/chart/BarChart.d.ts +23 -0
  17. package/dist/components/chart/ChartCard.d.ts +33 -0
  18. package/dist/components/chart/ChartConfigDrawer.d.ts +16 -0
  19. package/dist/components/chart/ChartGhostWireframe.d.ts +16 -0
  20. package/dist/components/chart/ChartLegend.d.ts +14 -0
  21. package/dist/components/chart/ChartRouter.d.ts +8 -0
  22. package/dist/components/chart/ChartSortingControls.d.ts +15 -0
  23. package/dist/components/chart/ChartTableModal.d.ts +26 -0
  24. package/dist/components/chart/ChartTooltip.d.ts +12 -0
  25. package/dist/components/chart/DataPendingCard.d.ts +28 -0
  26. package/dist/components/chart/DonutChart.d.ts +16 -0
  27. package/dist/components/chart/HistogramChart.d.ts +23 -0
  28. package/dist/components/chart/LineChart.d.ts +22 -0
  29. package/dist/components/chart/RangePreviewMatrix.d.ts +19 -0
  30. package/dist/components/chart/ScatterPlot.d.ts +21 -0
  31. package/dist/components/chart/drawer/controls/BarVisualControls.d.ts +9 -0
  32. package/dist/components/chart/drawer/controls/ChartTitlesSection.d.ts +15 -0
  33. package/dist/components/chart/drawer/controls/DonutVisualControls.d.ts +7 -0
  34. package/dist/components/chart/drawer/controls/HistogramVisualControls.d.ts +13 -0
  35. package/dist/components/chart/drawer/controls/LineVisualControls.d.ts +14 -0
  36. package/dist/components/chart/drawer/controls/ScatterDataControls.d.ts +17 -0
  37. package/dist/components/chart/drawer/controls/ScatterVisualControls.d.ts +23 -0
  38. package/dist/components/chart/drawer/controls/SortingAndOrderControls.d.ts +18 -0
  39. package/dist/components/chart/drawer/controls/StandardDataControls.d.ts +31 -0
  40. package/dist/components/chart/drawer/hooks/useChartConfigForm.d.ts +156 -0
  41. package/dist/components/chart/drawer/hooks/useLiveMatrixSync.d.ts +21 -0
  42. package/dist/components/chart/drawer/hooks/useSheetVerification.d.ts +26 -0
  43. package/dist/components/chart/drawer/index.d.ts +17 -0
  44. package/dist/components/chart/drawer/panels/Step1Source.d.ts +18 -0
  45. package/dist/components/chart/drawer/panels/Step1SourceRange.d.ts +32 -0
  46. package/dist/components/chart/drawer/panels/Step2DataRange.d.ts +15 -0
  47. package/dist/components/chart/drawer/panels/Step3ChartSetup.d.ts +17 -0
  48. package/dist/components/chart/drawer/panels/Step4Review.d.ts +11 -0
  49. package/dist/components/chart/index.d.ts +22 -0
  50. package/dist/components/dev/DevActionAffordance.d.ts +4 -0
  51. package/dist/components/dev/DevExitConfirmModal.d.ts +14 -0
  52. package/dist/components/dev/DevLockBlockedModal.d.ts +3 -0
  53. package/dist/components/dev/DevModeBadge.d.ts +3 -0
  54. package/dist/components/dev/DevPinModal.d.ts +3 -0
  55. package/dist/components/dev/DevPublishModal.d.ts +9 -0
  56. package/dist/components/dev/UniversalEditModal.d.ts +40 -0
  57. package/dist/components/dev/index.d.ts +8 -0
  58. package/dist/components/feedback/EmptyState.d.ts +13 -0
  59. package/dist/components/feedback/PageNotFound.d.ts +15 -0
  60. package/dist/components/feedback/Toast.d.ts +25 -0
  61. package/dist/components/feedback/index.d.ts +2 -0
  62. package/dist/components/history/HistoryHubModal.d.ts +44 -0
  63. package/dist/components/history/index.d.ts +1 -0
  64. package/dist/components/layout/AppFooter.d.ts +10 -0
  65. package/dist/components/layout/AppHeader.d.ts +22 -0
  66. package/dist/components/layout/EditorialSection.d.ts +27 -0
  67. package/dist/components/layout/EditorialSidebar.d.ts +34 -0
  68. package/dist/components/layout/HeroSection.d.ts +2 -0
  69. package/dist/components/layout/HeroWelcome.d.ts +11 -0
  70. package/dist/components/layout/SearchField.d.ts +9 -0
  71. package/dist/components/layout/StatusPill.d.ts +2 -0
  72. package/dist/components/layout/index.d.ts +8 -0
  73. package/dist/components/roadmap/RoadmapNode.d.ts +30 -0
  74. package/dist/components/roadmap/RoadmapSection.d.ts +27 -0
  75. package/dist/components/roadmap/RoadmapTrack.d.ts +25 -0
  76. package/dist/components/roadmap/serpentine-generator.d.ts +60 -0
  77. package/dist/components/roadmap/use-roadmap-scroll.d.ts +19 -0
  78. package/dist/components/source/EditPhotoModal.d.ts +22 -0
  79. package/dist/components/source/LightboxPhotoStrip.d.ts +23 -0
  80. package/dist/components/source/LinkFolderModal.d.ts +24 -0
  81. package/dist/components/source/SourceCard.d.ts +31 -0
  82. package/dist/components/source/SourceFolderAttachment.d.ts +25 -0
  83. package/dist/components/source/SourceGallery.d.ts +26 -0
  84. package/dist/components/source/SourceImage.d.ts +26 -0
  85. package/dist/components/source/SourceLightbox.d.ts +28 -0
  86. package/dist/components/source/index.d.ts +9 -0
  87. package/dist/components/ui/AccordionSection.d.ts +21 -0
  88. package/dist/components/ui/Breadcrumb.d.ts +29 -0
  89. package/dist/components/ui/Button.d.ts +31 -0
  90. package/dist/components/ui/ColumnSelect.d.ts +17 -0
  91. package/dist/components/ui/ColumnTypeBadge.d.ts +6 -0
  92. package/dist/components/ui/DevHelpTooltip.d.ts +11 -0
  93. package/dist/components/ui/DraggableRows.d.ts +21 -0
  94. package/dist/components/ui/Drawer.d.ts +50 -0
  95. package/dist/components/ui/DrawerTier.d.ts +8 -0
  96. package/dist/components/ui/EditableText.d.ts +48 -0
  97. package/dist/components/ui/FAB.d.ts +24 -0
  98. package/dist/components/ui/Modal.d.ts +24 -0
  99. package/dist/components/ui/PageTitle.d.ts +33 -0
  100. package/dist/components/ui/ParametricShape.d.ts +57 -0
  101. package/dist/components/ui/RevolvingButton.d.ts +5 -0
  102. package/dist/components/ui/SectionTitle.d.ts +42 -0
  103. package/dist/components/ui/SeriesSelectToolbar.d.ts +10 -0
  104. package/dist/components/ui/StatusPill.d.ts +21 -0
  105. package/dist/components/ui/TieredSlider.d.ts +19 -0
  106. package/dist/components/ui/Toast.d.ts +1 -0
  107. package/dist/components/ui/ValueLabelToggle.d.ts +10 -0
  108. package/dist/components/ui/index.d.ts +21 -0
  109. package/dist/config/engine.config.d.ts +162 -0
  110. package/dist/context/DeveloperModeContext.d.ts +11 -0
  111. package/dist/context/UndoRedoContext.d.ts +20 -0
  112. package/dist/diagnostics/verifyEngineSetup.d.ts +30 -0
  113. package/dist/diagnostics-CpGr1hhi.js +126 -0
  114. package/dist/diagnostics-Dw5PzR78.cjs +5 -0
  115. package/dist/diagnostics.cjs +1 -0
  116. package/dist/diagnostics.d.ts +10 -0
  117. package/dist/diagnostics.js +14 -0
  118. package/dist/edge-1WCVZ0J7.cjs +1 -0
  119. package/dist/edge-CSjifIhA.js +2709 -0
  120. package/dist/edge-Dr41JdrQ.cjs +34 -0
  121. package/dist/edge-h_ge9f1E.js +512 -0
  122. package/dist/edge.cjs +1 -0
  123. package/dist/edge.d.ts +10 -0
  124. package/dist/edge.js +26 -0
  125. package/dist/folio.cjs +9 -0
  126. package/dist/folio.js +21895 -0
  127. package/dist/hooks/use-auto-toc.d.ts +31 -0
  128. package/dist/hooks/use-discrete-step-navigation.d.ts +26 -0
  129. package/dist/hooks/use-dynamic-section-numbers.d.ts +30 -0
  130. package/dist/hooks/use-hash-route.d.ts +36 -0
  131. package/dist/hooks/use-scroll.d.ts +22 -0
  132. package/dist/hooks/use-scrollspy.d.ts +19 -0
  133. package/dist/hooks/useChartTooltip.d.ts +25 -0
  134. package/dist/hooks/useContent.d.ts +36 -0
  135. package/dist/hooks/useDeveloperMode.d.ts +1 -0
  136. package/dist/hooks/useDocumentCanvas.d.ts +53 -0
  137. package/dist/hooks/useDrivePhotoSync.d.ts +15 -0
  138. package/dist/hooks/useImageLoader.d.ts +12 -0
  139. package/dist/hooks/useLightboxHistory.d.ts +14 -0
  140. package/dist/hooks/useNodeCanvas.d.ts +2 -0
  141. package/dist/hooks/useSheetChartData.d.ts +31 -0
  142. package/dist/hooks/useSourcePoint.d.ts +35 -0
  143. package/dist/hooks/useSwipeGesture.d.ts +30 -0
  144. package/dist/hooks/useUndoRedo.d.ts +9 -0
  145. package/dist/hooks/useUnsavedChangesPrompt.d.ts +18 -0
  146. package/dist/index.d.ts +53 -0
  147. package/dist/main.d.ts +1 -0
  148. package/dist/services/canvasLayoutService.d.ts +158 -0
  149. package/dist/services/chartSourceService.d.ts +128 -0
  150. package/dist/services/devLockService.d.ts +76 -0
  151. package/dist/services/draftService.d.ts +129 -0
  152. package/dist/services/drivePhotoSyncService.d.ts +60 -0
  153. package/dist/services/driveVerificationService.d.ts +41 -0
  154. package/dist/services/edgePreBakeService.d.ts +81 -0
  155. package/dist/services/historyService.d.ts +215 -0
  156. package/dist/services/historyStorage.d.ts +17 -0
  157. package/dist/services/mediaService.d.ts +25 -0
  158. package/dist/services/sheetsDataService.d.ts +59 -0
  159. package/dist/services/sheetsVerificationService.d.ts +87 -0
  160. package/dist/services/sourceService.d.ts +43 -0
  161. package/dist/services/undoRedoService.d.ts +63 -0
  162. package/dist/services/unsavedChangesService.d.ts +32 -0
  163. package/dist/style.css +1 -0
  164. package/dist/types/canvas.d.ts +115 -0
  165. package/dist/types/chart.d.ts +117 -0
  166. package/dist/types/developer.d.ts +144 -0
  167. package/dist/types/draft.d.ts +21 -0
  168. package/dist/types/edge.d.ts +232 -0
  169. package/dist/types/history.d.ts +81 -0
  170. package/dist/types/media.d.ts +16 -0
  171. package/dist/types/navigation.d.ts +19 -0
  172. package/dist/types/node.d.ts +51 -0
  173. package/dist/types/source.d.ts +88 -0
  174. package/dist/utils/canvasDefaults.d.ts +43 -0
  175. package/dist/utils/chartColors.d.ts +48 -0
  176. package/dist/utils/chartDimensions.d.ts +50 -0
  177. package/dist/utils/chartMath.d.ts +142 -0
  178. package/dist/utils/chartSanitizer.d.ts +84 -0
  179. package/dist/utils/contentDb.d.ts +86 -0
  180. package/dist/utils/devSecurity.d.ts +84 -0
  181. package/dist/utils/mediaUrl.d.ts +32 -0
  182. package/dist/utils/modalActions.d.ts +32 -0
  183. package/dist/utils/node-sections.d.ts +15 -0
  184. package/dist/utils/page-sections.d.ts +1 -0
  185. package/dist/utils/runtime-env.d.ts +21 -0
  186. package/dist/utils/scrollLock.d.ts +10 -0
  187. package/dist/utils/smooth-scroll.d.ts +24 -0
  188. package/dist/utils/source.d.ts +25 -0
  189. package/dist/utils/storage.d.ts +13 -0
  190. package/dist/utils/supabase-config.d.ts +29 -0
  191. package/dist/utils/supabase-write-guard.d.ts +15 -0
  192. package/package.json +68 -4
  193. package/README.md +0 -3
@@ -0,0 +1,34 @@
1
+ "use strict";const d=require("./edge-1WCVZ0J7.cjs");function L(e){return e.type==="section"}function p(e){return e.type==="subsection"}function V(e){return e.type==="text"||e.type==="photo"||e.type==="gallery"||e.type==="chart"}function x(e){return e.type==="text"}function y(e){return e.type==="photo"}function K(e){return e.type==="gallery"}function Q(e){return e.type==="chart"}const u=[320,400,600,800,1200,1600],g=800,f=/^[a-zA-Z0-9_-]{10,64}$/;function A(e){if(typeof e!="number"||isNaN(e)||e<=0)return g;if(e<=u[0])return u[0];if(e>=u[u.length-1])return u[u.length-1];let t=g,n=1/0;for(const r of u){const s=Math.abs(r-e);s<=n&&(n=s,t=r)}return t}function m(e){if(!e||typeof e!="string")return null;const t=e.trim();if(f.test(t))return t;const n=t.match(/[?&]id=([a-zA-Z0-9_-]{10,64})/);if(n!=null&&n[1]&&f.test(n[1]))return n[1];const r=t.match(/\/(?:d|folders)\/([a-zA-Z0-9_-]{10,64})/);return r!=null&&r[1]&&f.test(r[1])?r[1]:null}function T(e,t={}){const n=m(e);if(!n)return e||"";const r=A(t.width??g),s=`/api/media/drive/${n}?w=${r}`;return t.format&&t.format!=="auto"?`${s}&fmt=${t.format}`:s}function S(e,t=[400,800,1200,1600]){const n=m(e);return n?t.map(r=>{const s=A(r);return`${T(n,{width:s})} ${s}w`}).join(", "):""}const I=[{chartId:"chart-access-enrolment",title:"Operational Activity Volume",subtitle:"Monthly processed transaction volume across regional units (units)",unit:"units",asOfDate:"2026-Q1",chartType:"bar",nodeId:"access",visualConfig:{unit:"units",excludeSummaryRows:!0,yMin:0,orientation:"vertical",barOrientation:"vertical"},categories:["Unit 1","Unit 2","Unit 3","Unit 4","Unit 5","Unit 6"],series:[{name:"Completed Tasks",data:[420,510,630,590,710,680],color:"#0284c7"},{name:"Pending Tasks",data:[390,480,580,560,670,640],color:"#38bdf8"}],sanitizedCsvContent:`# Title: Operational Activity Volume (units)
2
+ Category,Completed Tasks,Pending Tasks
3
+ Unit 1,420,390
4
+ Unit 2,510,480
5
+ Unit 3,630,580
6
+ Unit 4,590,560
7
+ Unit 5,710,670
8
+ Unit 6,680,640`},{chartId:"chart-equity-assistance",title:"Resource Allocation by Department",subtitle:"Percentage distribution of standard operational expenditure",unit:"%",asOfDate:"2026-Q1",chartType:"donut",nodeId:"equity",visualConfig:{unit:"%",excludeSummaryRows:!0,donutVariant:"donut"},categories:["Operations","Logistics","Administration","Planning","Support"],series:[{name:"Allocation",data:[32,26,20,14,8],color:"#881337"}],sanitizedCsvContent:`# Title: Resource Allocation by Department (%)
9
+ Category,Allocation
10
+ Operations,32
11
+ Logistics,26
12
+ Administration,20
13
+ Planning,14
14
+ Support,8`},{chartId:"chart-quality-mps",title:"Quarterly Performance Index",subtitle:"Standard performance indicators recorded over consecutive quarters",unit:"pts",asOfDate:"2026-Q1",chartType:"line",nodeId:"quality",visualConfig:{unit:"pts",excludeSummaryRows:!0,yMin:0,curveInterpolation:"smooth",showAreaFill:!0},categories:["Q1","Q2","Q3","Q4","Q5"],series:[{name:"Primary Indicator",data:[48,41,33,26,19],color:"#f59e0b"},{name:"Secondary Indicator",data:[82,69,54,42,31],color:"#b45309"}],sanitizedCsvContent:`# Title: Quarterly Performance Index (pts)
15
+ Quarter,Primary Indicator,Secondary Indicator
16
+ Q1,48,82
17
+ Q2,41,69
18
+ Q3,33,54
19
+ Q4,26,42
20
+ Q5,19,31`},{chartId:"chart-resiliency-drrm",title:"Response Time Distribution",subtitle:"Distribution of response completion times across standard requests",unit:"ms",asOfDate:"2026-Q1",chartType:"bar",nodeId:"resiliency",visualConfig:{unit:"ms",excludeSummaryRows:!0,yMin:0},categories:["0-10ms","10-20ms","20-30ms","30-40ms","40-50ms",">50ms"],series:[{name:"Recorded Responses",data:[142,89,45,12,4,1],color:"#15803d"}],sanitizedCsvContent:`# Title: Response Time Distribution (ms)
21
+ Bucket,Recorded Responses
22
+ 0-10ms,142
23
+ 10-20ms,89
24
+ 20-30ms,45
25
+ 30-40ms,12
26
+ 40-50ms,4
27
+ >50ms,1`},{chartId:"chart-governance-mooe",title:"Scheduled Tasks & Administrative Reviews",subtitle:"Weekly completed reviews and administrative filings",unit:"tasks",asOfDate:"2026-Q1",chartType:"bar",nodeId:"governance",visualConfig:{unit:"tasks",excludeSummaryRows:!0,yMin:0},categories:["Week 1","Week 2","Week 3","Week 4","Week 5","Week 6"],series:[{name:"Scheduled Tasks",data:[120,145,160,185,210,230],color:"#d97706"},{name:"Completed Reviews",data:[18,22,28,31,35,42],color:"#b45309"}],sanitizedCsvContent:`# Title: Scheduled Tasks & Administrative Reviews (tasks)
28
+ Week,Scheduled Tasks,Completed Reviews
29
+ Week 1,120,18
30
+ Week 2,145,22
31
+ Week 3,160,28
32
+ Week 4,185,31
33
+ Week 5,210,35
34
+ Week 6,230,42`}],v={},C=[400,800,1600],b="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 800px",k="16/9";function c(e){if(typeof process<"u"&&(process!=null&&process.env))return process.env[e]}function h(e){if(!e||!Array.isArray(e.sections))return e;const t=JSON.parse(JSON.stringify(e));return t.sections=t.sections.map(n=>{if(!n||!Array.isArray(n.elements))return n;const r=n.elements.map(s=>{if(p(s)){const a=s;if(Array.isArray(a.elements)){const i=a.elements.map(o=>y(o)?E(o):o);return{...a,elements:i}}return a}return y(s)?E(s):s});return{...n,elements:r}}),t}function E(e){if(!e.src||typeof e.src!="string")return e;const t=e.src.trim(),n=m(t);if(!n)return e;const r=T(n,{width:800}),s=S(n,C),a=e.sizes||b,i=e.aspectRatio||k;return{...e,src:r,srcSet:s,sizes:a,aspectRatio:i,rawDriveUrl:e.rawDriveUrl||t}}function D(e,t){const n={};if(Array.isArray(I))for(const r of I)r&&r.chartId&&(!r.nodeId||r.nodeId.toLowerCase()===e.toLowerCase())&&(n[r.chartId]=r);if(t)for(const[r,s]of Object.entries(t))n[r]=s;return n}function P(e,t){const n={},r=v;if(r&&typeof r=="object")for(const[s,a]of Object.entries(r))s.toLowerCase().includes(e.toLowerCase())&&(n[s]={pointId:s,folderUrl:a.folderUrl,folderTitle:a.folderTitle,description:a.description,lastSyncedAt:a.lastVerified});if(t)for(const[s,a]of Object.entries(t))n[s]=a;return n}function O(e,t,n){var l;const r=((l=t.canvases)==null?void 0:l[e])||{nodeId:e,version:t.schemaVersion||1,sections:[],updatedAt:t.createdAt},s=h(r),a=D(e,n==null?void 0:n.chartDatasets),i=P(e,n==null?void 0:n.sourceMetadata),o={nodeId:e,snapshotId:t.id,version:t.schemaVersion||1,updatedAt:t.createdAt,canvas:s,chartDatasets:a,sourceMetadata:i};return d.PublicNodePayloadSchema.parse(o),o}function _(e,t){const n=t&&t.length>0?t:e.canvases&&Object.keys(e.canvases).length>0?Object.keys(e.canvases):[...d.VALID_NODES],r={activeSnapshotId:e.id,publishedAt:e.createdAt,nodeIds:n,schemaVersion:e.schemaVersion||1};return d.PublicPortalManifestPayloadSchema.parse(r),r}async function R(e,t){const n=(t==null?void 0:t.accountId)||c("CLOUDFLARE_ACCOUNT_ID")||c("CF_ACCOUNT_ID"),r=(t==null?void 0:t.namespaceId)||c("CLOUDFLARE_KV_NAMESPACE_ID")||c("CF_KV_NAMESPACE_ID")||c("KV_ENGINE_PUBLIC_ID")||c("KV_PUBLIC_ID"),s=(t==null?void 0:t.apiToken)||c("CLOUDFLARE_API_TOKEN")||c("CF_API_TOKEN");if(!n||!r||!s)return{success:!0,deployedCount:0,warning:`Cloudflare KV credentials (${[!n&&"account ID",!r&&"KV namespace ID",!s&&"API token"].filter(Boolean).join(", ")}) not configured. Skipped remote edge deployment (local fallback mode).`};const a=`https://api.cloudflare.com/client/v4/accounts/${n}/storage/kv/namespaces/${r}/bulk`;try{const i=await fetch(a,{method:"PUT",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok){const o=await i.text();return console.warn(`[edgePreBakeService] Cloudflare KV bulk API returned HTTP ${i.status}:`,o),{success:!1,deployedCount:0,error:`Cloudflare KV upload returned HTTP ${i.status}: ${o}`}}return{success:!0,deployedCount:e.length}}catch(i){const o=i instanceof Error?i.message:"Network error during Cloudflare KV bulk deployment";return console.warn("[edgePreBakeService] Cloudflare KV bulk dispatch failure:",o),{success:!1,deployedCount:0,error:o}}}async function M(e,t){const n=[],r=[],s=t!=null&&t.nodeIds&&t.nodeIds.length>0?t.nodeIds:e.canvases&&Object.keys(e.canvases).length>0?Object.keys(e.canvases):[...d.VALID_NODES];for(const o of s){const l=O(o,e,t),w=JSON.stringify(l);n.push({key:`node:${o}`,value:w}),r.push(o);for(const[U,N]of Object.entries(l.chartDatasets))n.push({key:`chart:${U}`,value:JSON.stringify(N)})}const a=_(e,s);n.push({key:"portal:manifest",value:JSON.stringify(a)});const i=await R(n,t==null?void 0:t.credentials);return{success:i.success,snapshotId:e.id,transformedNodes:r,totalKvKeys:n.length,deployResult:i}}exports.ALLOWED_EDGE_WIDTHS=u;exports.DEFAULT_PHOTO_ASPECT_RATIO=k;exports.DEFAULT_SIZES_ATTRIBUTE=b;exports.TRANSFORM_BREAKPOINTS=C;exports.bakedChartsData=I;exports.baselineSourcesRaw=v;exports.buildEdgeMediaUrl=T;exports.buildEdgeSrcSet=S;exports.compileAndDeployToEdgeKV=M;exports.compilePortalManifest=_;exports.compilePublicNodePayload=O;exports.deployPayloadsToCloudflareKV=R;exports.extractDriveFileId=m;exports.gatherIndicatorDatasets=D;exports.gatherSourceMetadata=P;exports.isChartElement=Q;exports.isGalleryElement=K;exports.isLeafElement=V;exports.isPhotoElement=y;exports.isSectionElement=L;exports.isSubsectionElement=p;exports.isTextElement=x;exports.normalizeEdgeWidth=A;exports.transformCanvasAst=h;
@@ -0,0 +1,512 @@
1
+ import { V as v, P as T, d as S } from "./edge-CSjifIhA.js";
2
+ function Q(e) {
3
+ return e.type === "section";
4
+ }
5
+ function h(e) {
6
+ return e.type === "subsection";
7
+ }
8
+ function K(e) {
9
+ return e.type === "text" || e.type === "photo" || e.type === "gallery" || e.type === "chart";
10
+ }
11
+ function $(e) {
12
+ return e.type === "text";
13
+ }
14
+ function y(e) {
15
+ return e.type === "photo";
16
+ }
17
+ function z(e) {
18
+ return e.type === "gallery";
19
+ }
20
+ function W(e) {
21
+ return e.type === "chart";
22
+ }
23
+ const u = [320, 400, 600, 800, 1200, 1600], f = 800, l = /^[a-zA-Z0-9_-]{10,64}$/;
24
+ function I(e) {
25
+ if (typeof e != "number" || isNaN(e) || e <= 0)
26
+ return f;
27
+ if (e <= u[0])
28
+ return u[0];
29
+ if (e >= u[u.length - 1])
30
+ return u[u.length - 1];
31
+ let t = f, n = 1 / 0;
32
+ for (const r of u) {
33
+ const s = Math.abs(r - e);
34
+ s <= n && (n = s, t = r);
35
+ }
36
+ return t;
37
+ }
38
+ function m(e) {
39
+ if (!e || typeof e != "string") return null;
40
+ const t = e.trim();
41
+ if (l.test(t))
42
+ return t;
43
+ const n = t.match(/[?&]id=([a-zA-Z0-9_-]{10,64})/);
44
+ if (n != null && n[1] && l.test(n[1]))
45
+ return n[1];
46
+ const r = t.match(/\/(?:d|folders)\/([a-zA-Z0-9_-]{10,64})/);
47
+ return r != null && r[1] && l.test(r[1]) ? r[1] : null;
48
+ }
49
+ function A(e, t = {}) {
50
+ const n = m(e);
51
+ if (!n) return e || "";
52
+ const r = I(t.width ?? f), s = `/api/media/drive/${n}?w=${r}`;
53
+ return t.format && t.format !== "auto" ? `${s}&fmt=${t.format}` : s;
54
+ }
55
+ function E(e, t = [400, 800, 1200, 1600]) {
56
+ const n = m(e);
57
+ return n ? t.map((r) => {
58
+ const s = I(r);
59
+ return `${A(n, { width: s })} ${s}w`;
60
+ }).join(", ") : "";
61
+ }
62
+ const g = [
63
+ {
64
+ chartId: "chart-access-enrolment",
65
+ title: "Operational Activity Volume",
66
+ subtitle: "Monthly processed transaction volume across regional units (units)",
67
+ unit: "units",
68
+ asOfDate: "2026-Q1",
69
+ chartType: "bar",
70
+ nodeId: "access",
71
+ visualConfig: {
72
+ unit: "units",
73
+ excludeSummaryRows: !0,
74
+ yMin: 0,
75
+ orientation: "vertical",
76
+ barOrientation: "vertical"
77
+ },
78
+ categories: [
79
+ "Unit 1",
80
+ "Unit 2",
81
+ "Unit 3",
82
+ "Unit 4",
83
+ "Unit 5",
84
+ "Unit 6"
85
+ ],
86
+ series: [
87
+ {
88
+ name: "Completed Tasks",
89
+ data: [
90
+ 420,
91
+ 510,
92
+ 630,
93
+ 590,
94
+ 710,
95
+ 680
96
+ ],
97
+ color: "#0284c7"
98
+ },
99
+ {
100
+ name: "Pending Tasks",
101
+ data: [
102
+ 390,
103
+ 480,
104
+ 580,
105
+ 560,
106
+ 670,
107
+ 640
108
+ ],
109
+ color: "#38bdf8"
110
+ }
111
+ ],
112
+ sanitizedCsvContent: `# Title: Operational Activity Volume (units)
113
+ Category,Completed Tasks,Pending Tasks
114
+ Unit 1,420,390
115
+ Unit 2,510,480
116
+ Unit 3,630,580
117
+ Unit 4,590,560
118
+ Unit 5,710,670
119
+ Unit 6,680,640`
120
+ },
121
+ {
122
+ chartId: "chart-equity-assistance",
123
+ title: "Resource Allocation by Department",
124
+ subtitle: "Percentage distribution of standard operational expenditure",
125
+ unit: "%",
126
+ asOfDate: "2026-Q1",
127
+ chartType: "donut",
128
+ nodeId: "equity",
129
+ visualConfig: {
130
+ unit: "%",
131
+ excludeSummaryRows: !0,
132
+ donutVariant: "donut"
133
+ },
134
+ categories: [
135
+ "Operations",
136
+ "Logistics",
137
+ "Administration",
138
+ "Planning",
139
+ "Support"
140
+ ],
141
+ series: [
142
+ {
143
+ name: "Allocation",
144
+ data: [
145
+ 32,
146
+ 26,
147
+ 20,
148
+ 14,
149
+ 8
150
+ ],
151
+ color: "#881337"
152
+ }
153
+ ],
154
+ sanitizedCsvContent: `# Title: Resource Allocation by Department (%)
155
+ Category,Allocation
156
+ Operations,32
157
+ Logistics,26
158
+ Administration,20
159
+ Planning,14
160
+ Support,8`
161
+ },
162
+ {
163
+ chartId: "chart-quality-mps",
164
+ title: "Quarterly Performance Index",
165
+ subtitle: "Standard performance indicators recorded over consecutive quarters",
166
+ unit: "pts",
167
+ asOfDate: "2026-Q1",
168
+ chartType: "line",
169
+ nodeId: "quality",
170
+ visualConfig: {
171
+ unit: "pts",
172
+ excludeSummaryRows: !0,
173
+ yMin: 0,
174
+ curveInterpolation: "smooth",
175
+ showAreaFill: !0
176
+ },
177
+ categories: [
178
+ "Q1",
179
+ "Q2",
180
+ "Q3",
181
+ "Q4",
182
+ "Q5"
183
+ ],
184
+ series: [
185
+ {
186
+ name: "Primary Indicator",
187
+ data: [
188
+ 48,
189
+ 41,
190
+ 33,
191
+ 26,
192
+ 19
193
+ ],
194
+ color: "#f59e0b"
195
+ },
196
+ {
197
+ name: "Secondary Indicator",
198
+ data: [
199
+ 82,
200
+ 69,
201
+ 54,
202
+ 42,
203
+ 31
204
+ ],
205
+ color: "#b45309"
206
+ }
207
+ ],
208
+ sanitizedCsvContent: `# Title: Quarterly Performance Index (pts)
209
+ Quarter,Primary Indicator,Secondary Indicator
210
+ Q1,48,82
211
+ Q2,41,69
212
+ Q3,33,54
213
+ Q4,26,42
214
+ Q5,19,31`
215
+ },
216
+ {
217
+ chartId: "chart-resiliency-drrm",
218
+ title: "Response Time Distribution",
219
+ subtitle: "Distribution of response completion times across standard requests",
220
+ unit: "ms",
221
+ asOfDate: "2026-Q1",
222
+ chartType: "bar",
223
+ nodeId: "resiliency",
224
+ visualConfig: {
225
+ unit: "ms",
226
+ excludeSummaryRows: !0,
227
+ yMin: 0
228
+ },
229
+ categories: [
230
+ "0-10ms",
231
+ "10-20ms",
232
+ "20-30ms",
233
+ "30-40ms",
234
+ "40-50ms",
235
+ ">50ms"
236
+ ],
237
+ series: [
238
+ {
239
+ name: "Recorded Responses",
240
+ data: [
241
+ 142,
242
+ 89,
243
+ 45,
244
+ 12,
245
+ 4,
246
+ 1
247
+ ],
248
+ color: "#15803d"
249
+ }
250
+ ],
251
+ sanitizedCsvContent: `# Title: Response Time Distribution (ms)
252
+ Bucket,Recorded Responses
253
+ 0-10ms,142
254
+ 10-20ms,89
255
+ 20-30ms,45
256
+ 30-40ms,12
257
+ 40-50ms,4
258
+ >50ms,1`
259
+ },
260
+ {
261
+ chartId: "chart-governance-mooe",
262
+ title: "Scheduled Tasks & Administrative Reviews",
263
+ subtitle: "Weekly completed reviews and administrative filings",
264
+ unit: "tasks",
265
+ asOfDate: "2026-Q1",
266
+ chartType: "bar",
267
+ nodeId: "governance",
268
+ visualConfig: {
269
+ unit: "tasks",
270
+ excludeSummaryRows: !0,
271
+ yMin: 0
272
+ },
273
+ categories: [
274
+ "Week 1",
275
+ "Week 2",
276
+ "Week 3",
277
+ "Week 4",
278
+ "Week 5",
279
+ "Week 6"
280
+ ],
281
+ series: [
282
+ {
283
+ name: "Scheduled Tasks",
284
+ data: [
285
+ 120,
286
+ 145,
287
+ 160,
288
+ 185,
289
+ 210,
290
+ 230
291
+ ],
292
+ color: "#d97706"
293
+ },
294
+ {
295
+ name: "Completed Reviews",
296
+ data: [
297
+ 18,
298
+ 22,
299
+ 28,
300
+ 31,
301
+ 35,
302
+ 42
303
+ ],
304
+ color: "#b45309"
305
+ }
306
+ ],
307
+ sanitizedCsvContent: `# Title: Scheduled Tasks & Administrative Reviews (tasks)
308
+ Week,Scheduled Tasks,Completed Reviews
309
+ Week 1,120,18
310
+ Week 2,145,22
311
+ Week 3,160,28
312
+ Week 4,185,31
313
+ Week 5,210,35
314
+ Week 6,230,42`
315
+ }
316
+ ], D = {}, P = [400, 800, 1600], O = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 800px", _ = "16/9";
317
+ function c(e) {
318
+ if (typeof process < "u" && (process != null && process.env))
319
+ return process.env[e];
320
+ }
321
+ function w(e) {
322
+ if (!e || !Array.isArray(e.sections))
323
+ return e;
324
+ const t = JSON.parse(JSON.stringify(e));
325
+ return t.sections = t.sections.map((n) => {
326
+ if (!n || !Array.isArray(n.elements)) return n;
327
+ const r = n.elements.map((s) => {
328
+ if (h(s)) {
329
+ const a = s;
330
+ if (Array.isArray(a.elements)) {
331
+ const i = a.elements.map((o) => y(o) ? p(o) : o);
332
+ return {
333
+ ...a,
334
+ elements: i
335
+ };
336
+ }
337
+ return a;
338
+ }
339
+ return y(s) ? p(s) : s;
340
+ });
341
+ return {
342
+ ...n,
343
+ elements: r
344
+ };
345
+ }), t;
346
+ }
347
+ function p(e) {
348
+ if (!e.src || typeof e.src != "string")
349
+ return e;
350
+ const t = e.src.trim(), n = m(t);
351
+ if (!n)
352
+ return e;
353
+ const r = A(n, { width: 800 }), s = E(n, P), a = e.sizes || O, i = e.aspectRatio || _;
354
+ return {
355
+ ...e,
356
+ src: r,
357
+ srcSet: s,
358
+ sizes: a,
359
+ aspectRatio: i,
360
+ rawDriveUrl: e.rawDriveUrl || t
361
+ };
362
+ }
363
+ function R(e, t) {
364
+ const n = {};
365
+ if (Array.isArray(g))
366
+ for (const r of g)
367
+ r && r.chartId && (!r.nodeId || r.nodeId.toLowerCase() === e.toLowerCase()) && (n[r.chartId] = r);
368
+ if (t)
369
+ for (const [r, s] of Object.entries(t))
370
+ n[r] = s;
371
+ return n;
372
+ }
373
+ function U(e, t) {
374
+ const n = {}, r = D;
375
+ if (r && typeof r == "object")
376
+ for (const [s, a] of Object.entries(r))
377
+ s.toLowerCase().includes(e.toLowerCase()) && (n[s] = {
378
+ pointId: s,
379
+ folderUrl: a.folderUrl,
380
+ folderTitle: a.folderTitle,
381
+ description: a.description,
382
+ lastSyncedAt: a.lastVerified
383
+ });
384
+ if (t)
385
+ for (const [s, a] of Object.entries(t))
386
+ n[s] = a;
387
+ return n;
388
+ }
389
+ function N(e, t, n) {
390
+ var d;
391
+ const r = ((d = t.canvases) == null ? void 0 : d[e]) || {
392
+ nodeId: e,
393
+ version: t.schemaVersion || 1,
394
+ sections: [],
395
+ updatedAt: t.createdAt
396
+ }, s = w(r), a = R(e, n == null ? void 0 : n.chartDatasets), i = U(e, n == null ? void 0 : n.sourceMetadata), o = {
397
+ nodeId: e,
398
+ snapshotId: t.id,
399
+ version: t.schemaVersion || 1,
400
+ updatedAt: t.createdAt,
401
+ canvas: s,
402
+ chartDatasets: a,
403
+ sourceMetadata: i
404
+ };
405
+ return T.parse(o), o;
406
+ }
407
+ function V(e, t) {
408
+ const n = t && t.length > 0 ? t : e.canvases && Object.keys(e.canvases).length > 0 ? Object.keys(e.canvases) : [...v], r = {
409
+ activeSnapshotId: e.id,
410
+ publishedAt: e.createdAt,
411
+ nodeIds: n,
412
+ schemaVersion: e.schemaVersion || 1
413
+ };
414
+ return S.parse(r), r;
415
+ }
416
+ async function L(e, t) {
417
+ const n = (t == null ? void 0 : t.accountId) || c("CLOUDFLARE_ACCOUNT_ID") || c("CF_ACCOUNT_ID"), r = (t == null ? void 0 : t.namespaceId) || c("CLOUDFLARE_KV_NAMESPACE_ID") || c("CF_KV_NAMESPACE_ID") || c("KV_ENGINE_PUBLIC_ID") || c("KV_PUBLIC_ID"), s = (t == null ? void 0 : t.apiToken) || c("CLOUDFLARE_API_TOKEN") || c("CF_API_TOKEN");
418
+ if (!n || !r || !s)
419
+ return {
420
+ success: !0,
421
+ deployedCount: 0,
422
+ warning: `Cloudflare KV credentials (${[
423
+ !n && "account ID",
424
+ !r && "KV namespace ID",
425
+ !s && "API token"
426
+ ].filter(Boolean).join(", ")}) not configured. Skipped remote edge deployment (local fallback mode).`
427
+ };
428
+ const a = `https://api.cloudflare.com/client/v4/accounts/${n}/storage/kv/namespaces/${r}/bulk`;
429
+ try {
430
+ const i = await fetch(a, {
431
+ method: "PUT",
432
+ headers: {
433
+ Authorization: `Bearer ${s}`,
434
+ "Content-Type": "application/json"
435
+ },
436
+ body: JSON.stringify(e)
437
+ });
438
+ if (!i.ok) {
439
+ const o = await i.text();
440
+ return console.warn(`[edgePreBakeService] Cloudflare KV bulk API returned HTTP ${i.status}:`, o), {
441
+ success: !1,
442
+ deployedCount: 0,
443
+ error: `Cloudflare KV upload returned HTTP ${i.status}: ${o}`
444
+ };
445
+ }
446
+ return {
447
+ success: !0,
448
+ deployedCount: e.length
449
+ };
450
+ } catch (i) {
451
+ const o = i instanceof Error ? i.message : "Network error during Cloudflare KV bulk deployment";
452
+ return console.warn("[edgePreBakeService] Cloudflare KV bulk dispatch failure:", o), {
453
+ success: !1,
454
+ deployedCount: 0,
455
+ error: o
456
+ };
457
+ }
458
+ }
459
+ async function j(e, t) {
460
+ const n = [], r = [], s = t != null && t.nodeIds && t.nodeIds.length > 0 ? t.nodeIds : e.canvases && Object.keys(e.canvases).length > 0 ? Object.keys(e.canvases) : [...v];
461
+ for (const o of s) {
462
+ const d = N(o, e, t), C = JSON.stringify(d);
463
+ n.push({
464
+ key: `node:${o}`,
465
+ value: C
466
+ }), r.push(o);
467
+ for (const [k, b] of Object.entries(d.chartDatasets))
468
+ n.push({
469
+ key: `chart:${k}`,
470
+ value: JSON.stringify(b)
471
+ });
472
+ }
473
+ const a = V(e, s);
474
+ n.push({
475
+ key: "portal:manifest",
476
+ value: JSON.stringify(a)
477
+ });
478
+ const i = await L(n, t == null ? void 0 : t.credentials);
479
+ return {
480
+ success: i.success,
481
+ snapshotId: e.id,
482
+ transformedNodes: r,
483
+ totalKvKeys: n.length,
484
+ deployResult: i
485
+ };
486
+ }
487
+ export {
488
+ u as A,
489
+ _ as D,
490
+ P as T,
491
+ A as a,
492
+ g as b,
493
+ j as c,
494
+ D as d,
495
+ m as e,
496
+ E as f,
497
+ z as g,
498
+ K as h,
499
+ W as i,
500
+ y as j,
501
+ Q as k,
502
+ h as l,
503
+ $ as m,
504
+ O as n,
505
+ V as o,
506
+ N as p,
507
+ L as q,
508
+ R as r,
509
+ U as s,
510
+ I as t,
511
+ w as u
512
+ };
package/dist/edge.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./edge-1WCVZ0J7.cjs"),e=require("./edge-Dr41JdrQ.cjs");exports.CachedIndicatorDatasetSchema=a.CachedIndicatorDatasetSchema;exports.NodeCanvasDocumentSchema=a.NodeCanvasDocumentSchema;exports.PublicNodePayloadSchema=a.PublicNodePayloadSchema;exports.PublicPortalManifestPayloadSchema=a.PublicPortalManifestPayloadSchema;exports.SyncedSourceMetadataSchema=a.SyncedSourceMetadataSchema;exports.VALID_NODES=a.VALID_NODES;exports.computeWeakEtag=a.computeWeakEtag;exports.ALLOWED_EDGE_WIDTHS=e.ALLOWED_EDGE_WIDTHS;exports.DEFAULT_PHOTO_ASPECT_RATIO=e.DEFAULT_PHOTO_ASPECT_RATIO;exports.DEFAULT_SIZES_ATTRIBUTE=e.DEFAULT_SIZES_ATTRIBUTE;exports.TRANSFORM_BREAKPOINTS=e.TRANSFORM_BREAKPOINTS;exports.buildEdgeMediaUrl=e.buildEdgeMediaUrl;exports.buildEdgeSrcSet=e.buildEdgeSrcSet;exports.compileAndDeployToEdgeKV=e.compileAndDeployToEdgeKV;exports.compilePortalManifest=e.compilePortalManifest;exports.compilePublicNodePayload=e.compilePublicNodePayload;exports.deployPayloadsToCloudflareKV=e.deployPayloadsToCloudflareKV;exports.extractDriveFileId=e.extractDriveFileId;exports.gatherIndicatorDatasets=e.gatherIndicatorDatasets;exports.gatherSourceMetadata=e.gatherSourceMetadata;exports.normalizeEdgeWidth=e.normalizeEdgeWidth;exports.transformCanvasAst=e.transformCanvasAst;
package/dist/edge.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Folio Engine — Edge & Cloudflare Worker Entry Point
3
+ * Location: src/edge.ts
4
+ *
5
+ * Dedicated zero-DOM, zero-React entry point for Cloudflare Pages Functions,
6
+ * Workers, and Node.js prebake scripts.
7
+ */
8
+ export * from './types/edge';
9
+ export * from './services/edgePreBakeService';
10
+ export * from './utils/mediaUrl';
package/dist/edge.js ADDED
@@ -0,0 +1,26 @@
1
+ import { C as s, N as o, P as t, d, S as c, V as l, e as r } from "./edge-CSjifIhA.js";
2
+ import { A as i, D as E, n as m, T, a as D, f as P, c as n, o as A, p as u, q as h, e as p, r as I, s as _, t as f, u as g } from "./edge-h_ge9f1E.js";
3
+ export {
4
+ i as ALLOWED_EDGE_WIDTHS,
5
+ s as CachedIndicatorDatasetSchema,
6
+ E as DEFAULT_PHOTO_ASPECT_RATIO,
7
+ m as DEFAULT_SIZES_ATTRIBUTE,
8
+ o as NodeCanvasDocumentSchema,
9
+ t as PublicNodePayloadSchema,
10
+ d as PublicPortalManifestPayloadSchema,
11
+ c as SyncedSourceMetadataSchema,
12
+ T as TRANSFORM_BREAKPOINTS,
13
+ l as VALID_NODES,
14
+ D as buildEdgeMediaUrl,
15
+ P as buildEdgeSrcSet,
16
+ n as compileAndDeployToEdgeKV,
17
+ A as compilePortalManifest,
18
+ u as compilePublicNodePayload,
19
+ r as computeWeakEtag,
20
+ h as deployPayloadsToCloudflareKV,
21
+ p as extractDriveFileId,
22
+ I as gatherIndicatorDatasets,
23
+ _ as gatherSourceMetadata,
24
+ f as normalizeEdgeWidth,
25
+ g as transformCanvasAst
26
+ };