@objectstack/console 9.4.0 → 9.5.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 (155) hide show
  1. package/dist/assets/{AdapterProvider-BNNEwHx0.js → AdapterProvider-BrKPQ1rE.js} +1 -1
  2. package/dist/assets/{AiPendingActionsPage-DOSHy962.js → AiPendingActionsPage-BcncanbT.js} +1 -1
  3. package/dist/assets/{ApiConsolePage-CruwU0Up.js → ApiConsolePage-C6tVqeCx.js} +1 -1
  4. package/dist/assets/AppDocsIndex-D--pdm0E.js +1 -0
  5. package/dist/assets/{AppManagementPage-BohnYqad.js → AppManagementPage-B66TgUPL.js} +1 -1
  6. package/dist/assets/{ApprovalsInboxPage-BGmv2uNL.js → ApprovalsInboxPage-C8mv1Yo5.js} +1 -1
  7. package/dist/assets/{AuditLogPage-KrpMMNiw.js → AuditLogPage-CS-Jundr.js} +1 -1
  8. package/dist/assets/{ComponentNavView-JMyYlvFq.js → ComponentNavView-Br-wa130.js} +1 -1
  9. package/dist/assets/{ConsoleFloatingChatbot-C7wdj16w.js → ConsoleFloatingChatbot-CIsrrZv4.js} +1 -1
  10. package/dist/assets/{DashboardView-DUqOAEyx.js → DashboardView-HNhMjAZZ.js} +1 -1
  11. package/dist/assets/{DashboardWidgetInspector-Dhe9hv9A.js → DashboardWidgetInspector-Cr6cJ0BC.js} +1 -1
  12. package/dist/assets/{DeveloperHubPage-D4ErhCeD.js → DeveloperHubPage-B3I-35Xy.js} +1 -1
  13. package/dist/assets/{ExpressionProvider-Cj6XEnZF.js → ExpressionProvider-CqfGEBur.js} +1 -1
  14. package/dist/assets/{FlowRunsPage-CJsr4xgF.js → FlowRunsPage-CATcsy8B.js} +1 -1
  15. package/dist/assets/{IntegrationsPage-zbcGFqxM.js → IntegrationsPage-Cq1qq5jk.js} +1 -1
  16. package/dist/assets/{InterfaceListPage-BJRTel_h.js → InterfaceListPage-OHu23CRA.js} +1 -1
  17. package/dist/assets/{ManagedByBadge-DOMbPlbf.js → ManagedByBadge-BodEaDXN.js} +1 -1
  18. package/dist/assets/{MarketplaceInstalledPage-CSgqJuot.js → MarketplaceInstalledPage-B5oYOVdC.js} +1 -1
  19. package/dist/assets/{MarketplacePackagePage-0TU_eJIx.js → MarketplacePackagePage-DnmqDFCq.js} +1 -1
  20. package/dist/assets/{MarketplacePage-YO75QMEO.js → MarketplacePage-C5lziiq9.js} +1 -1
  21. package/dist/assets/{MetadataInspector-CamKLf7x.js → MetadataInspector-BMHaVCoM.js} +1 -1
  22. package/dist/assets/{MetadataProvider-Bxendsnd.js → MetadataProvider-Cvue7gQ0.js} +1 -1
  23. package/dist/assets/{PageView-z1PfFaQS.js → PageView-H7j3JwJI.js} +1 -1
  24. package/dist/assets/{ProfilePage-5QuBSV4z.js → ProfilePage-BBeI_CPu.js} +1 -1
  25. package/dist/assets/{PublicFormsPage-CMTz6MfD.js → PublicFormsPage-Bhp5KfIY.js} +1 -1
  26. package/dist/assets/{RecordDetailView-DOcGflPY.js → RecordDetailView-CGxfnls1.js} +1 -1
  27. package/dist/assets/{RecordFormPage-C1M3jdnG.js → RecordFormPage-B8sjq5K3.js} +1 -1
  28. package/dist/assets/{ReportDefaultInspector-DDBJTAYx.js → ReportDefaultInspector-CmSJUILm.js} +1 -1
  29. package/dist/assets/{ReportView-CItKDFSn.js → ReportView-_NBbKT5l.js} +1 -1
  30. package/dist/assets/{RuntimeDraftBar-QF3pF8K2.js → RuntimeDraftBar-DroTFTnx.js} +1 -1
  31. package/dist/assets/{SearchResultsPage-Mdphx8Ca.js → SearchResultsPage-D9HdE2xf.js} +1 -1
  32. package/dist/assets/{SettingsHub-CtfOIqOJ.js → SettingsHub-Ca4TQg_Q.js} +1 -1
  33. package/dist/assets/{SettingsView-One2JiPG.js → SettingsView-6GSnMLNA.js} +1 -1
  34. package/dist/assets/{SystemHubPage-Dzi5_s3T.js → SystemHubPage-maebng1S.js} +1 -1
  35. package/dist/assets/architecture-7EHR7CIX-BdMnUPE0.js +1 -0
  36. package/dist/assets/architectureDiagram-3BPJPVTR-SscyJlk0.js +36 -0
  37. package/dist/assets/blockDiagram-GPEHLZMM-D6-9deBJ.js +132 -0
  38. package/dist/assets/c4Diagram-AAUBKEIU-VLeNt7tD.js +10 -0
  39. package/dist/assets/channel-ByUUDCyR.js +1 -0
  40. package/dist/assets/chunk-2J33WTMH-DyXQVMuc.js +1 -0
  41. package/dist/assets/chunk-3OPIFGDE-3g0dk_di.js +62 -0
  42. package/dist/assets/chunk-4BX2VUAB-BpAZJ7ZC.js +1 -0
  43. package/dist/assets/chunk-55IACEB6-BhOjfCrn.js +1 -0
  44. package/dist/assets/chunk-5ZQYHXKU-DG12s6lW.js +2 -0
  45. package/dist/assets/chunk-727SXJPM-DwSFE_v-.js +206 -0
  46. package/dist/assets/chunk-AQP2D5EJ-DWgSztUW.js +231 -0
  47. package/dist/assets/chunk-BSJP7CBP-okvguKD4.js +1 -0
  48. package/dist/assets/chunk-CSCIHK7Q-DfSAlgJl.js +124 -0
  49. package/dist/assets/chunk-FMBD7UC4-CZzqt4RW.js +15 -0
  50. package/dist/assets/chunk-KSCS5N6A-IxEh4Ag5.js +10 -0
  51. package/dist/assets/chunk-L5ZTLDWV-DW1lPBoG.js +1 -0
  52. package/dist/assets/chunk-LZXEDZCA-C_-aaYcd.js +1 -0
  53. package/dist/assets/chunk-ND2GUHAM-C1toj0H3.js +1 -0
  54. package/dist/assets/chunk-NNHCCRGN-Ud6GGuM7.js +159 -0
  55. package/dist/assets/chunk-NZK2D7GU-H2MwBqQV.js +1 -0
  56. package/dist/assets/chunk-O5CBEL6O-BzyWPZhZ.js +70 -0
  57. package/dist/assets/chunk-QZHKN3VN-ujroCBCz.js +1 -0
  58. package/dist/assets/chunk-WU5MYG2G-DwQt8tuZ.js +1 -0
  59. package/dist/assets/chunk-XPW4576I-DPNxFY7Q.js +32 -0
  60. package/dist/assets/classDiagram-4FO5ZUOK-B7mTyEXp.js +1 -0
  61. package/dist/assets/classDiagram-v2-Q7XG4LA2-B7mTyEXp.js +1 -0
  62. package/dist/assets/cose-bilkent-S5V4N54A-HKJWDQRL.js +1 -0
  63. package/dist/assets/cytoscape.esm-h6BdjjI9.js +321 -0
  64. package/dist/assets/dagre-BM42HDAG-CU8nx02l.js +4 -0
  65. package/dist/assets/dagre-Bx709z4p.js +1 -0
  66. package/dist/assets/{data-adapter-Dl2IvbPC.js → data-adapter-SqbPGFBI.js} +1 -1
  67. package/dist/assets/diagram-2AECGRRQ-CormMz8j.js +43 -0
  68. package/dist/assets/diagram-5GNKFQAL-Dh1SagBx.js +10 -0
  69. package/dist/assets/diagram-KO2AKTUF-DcG6Z05V.js +3 -0
  70. package/dist/assets/diagram-LMA3HP47-DrVLZ6ZE.js +24 -0
  71. package/dist/assets/diagram-OG6HWLK6-C4_MMUc2.js +24 -0
  72. package/dist/assets/dist-Cna34lZe.js +1 -0
  73. package/dist/assets/erDiagram-TEJ5UH35-BZH_OrBL.js +85 -0
  74. package/dist/assets/eventmodeling-FCH6USID-CFiyy8DS.js +1 -0
  75. package/dist/assets/flowDiagram-I6XJVG4X-CnjHQUK0.js +162 -0
  76. package/dist/assets/{framework-D7UWfRl4.js → framework-CVigpa4L.js} +11 -11
  77. package/dist/assets/ganttDiagram-6RSMTGT7-rVbHlqzo.js +292 -0
  78. package/dist/assets/gitGraph-WXDBUCRP-9vsQCBlr.js +1 -0
  79. package/dist/assets/gitGraphDiagram-PVQCEYII-CH2LgClA.js +106 -0
  80. package/dist/assets/graphlib-B8gBHxth.js +1 -0
  81. package/dist/assets/{highlighted-body-OFNGDK62-Dgcl8-h_.js → highlighted-body-OFNGDK62-B0SlzSfX.js} +1 -1
  82. package/dist/assets/index-TlmJdKxQ.js +4 -0
  83. package/dist/assets/index-mrmp6qU6.css +2 -0
  84. package/dist/assets/info-J43DQDTF-CfWeH1Bg.js +1 -0
  85. package/dist/assets/infoDiagram-5YYISTIA-CRC7ojj-.js +2 -0
  86. package/dist/assets/ishikawaDiagram-YF4QCWOH-8v73fBR1.js +70 -0
  87. package/dist/assets/journeyDiagram-JHISSGLW-DbRK-WaU.js +139 -0
  88. package/dist/assets/kanban-definition-UN3LZRKU-BggLxHvZ.js +89 -0
  89. package/dist/assets/katex-Vhh-h91d.js +257 -0
  90. package/dist/assets/{marketplaceApi-Do90JxGv.js → marketplaceApi-Cw1CUgrg.js} +1 -1
  91. package/dist/assets/mergeServerFields-DKhjl-pc.js +7 -0
  92. package/dist/assets/mermaid-GHXKKRXX-DOu_26de.js +1 -0
  93. package/dist/assets/mermaid-parser.core-iuxcj-n_.js +3 -0
  94. package/dist/assets/mermaid.core-C41Aiku8.js +8 -0
  95. package/dist/assets/metadata-admin-2GXysZST.js +19 -0
  96. package/dist/assets/mindmap-definition-RKZ34NQL-kqhi9XCR.js +96 -0
  97. package/dist/assets/packet-YPE3B663-C0xexAqH.js +1 -0
  98. package/dist/assets/pie-LRSECV5Y-DbQVOiyX.js +1 -0
  99. package/dist/assets/pieDiagram-4H26LBE5-9fHcPmFE.js +30 -0
  100. package/dist/assets/{plugin-calendar-DSvXqOQV.js → plugin-calendar-BWXBFRkE.js} +1 -1
  101. package/dist/assets/plugin-charts-Ck5EMx6H.js +7 -0
  102. package/dist/assets/{plugin-chatbot-D6s22V14.js → plugin-chatbot-CBg5Zd15.js} +7 -7
  103. package/dist/assets/{plugin-dashboard-PEMuLOVn.js → plugin-dashboard-DJturdHm.js} +1 -1
  104. package/dist/assets/plugin-form-CM6RvRf2.js +1 -0
  105. package/dist/assets/{plugin-gantt-CB1bbY8J.js → plugin-gantt-DO7NQ-4h.js} +1 -1
  106. package/dist/assets/plugin-grid-BsA9XQ8Q.js +6 -0
  107. package/dist/assets/{plugin-kanban-BxxI6fit.js → plugin-kanban-DTWtfUzv.js} +1 -1
  108. package/dist/assets/{plugin-map-B-TiJAz8.js → plugin-map-B-PDDoET.js} +1 -1
  109. package/dist/assets/plugin-markdown--e1MOP0x.js +113 -0
  110. package/dist/assets/{plugin-report-jQPIUbaf.js → plugin-report-BTvuqkOa.js} +1 -1
  111. package/dist/assets/{plugin-timeline-BNRp2sKQ.js → plugin-timeline-Dmqt8jd_.js} +1 -1
  112. package/dist/assets/{plugin-view-BeiRMGis.js → plugin-view-CmAdMV7R.js} +1 -1
  113. package/dist/assets/{plugins-views-D0zS0yz2.js → plugins-views-BP1sk9hy.js} +1 -1
  114. package/dist/assets/quadrantDiagram-W4KKPZXB-CaMxia_k.js +7 -0
  115. package/dist/assets/radar-GUYGQ44K-DapGfmwo.js +1 -0
  116. package/dist/assets/requirementDiagram-4Y6WPE33-CXwY4Gdd.js +84 -0
  117. package/dist/assets/{resolveActionParams-eRBdMG9b.js → resolveActionParams-CWIOgcoF.js} +1 -1
  118. package/dist/assets/rough.esm-CSKSodPl.js +1 -0
  119. package/dist/assets/runtime-config-BeHVOPm3.js +1 -0
  120. package/dist/assets/sankeyDiagram-5OEKKPKP-KEb3hSPZ.js +40 -0
  121. package/dist/assets/sequenceDiagram-3UESZ5HK-BfbOOh3M.js +162 -0
  122. package/dist/assets/{skeletons-DNzeXHI1.js → skeletons-D42JPA2I.js} +1 -1
  123. package/dist/assets/{src-LBsSMdO2.js → src-B-bY4wJT.js} +1 -1
  124. package/dist/assets/src-CVz7aDdY.js +1 -0
  125. package/dist/assets/stateDiagram-AJRCARHV-BLJI6xj_.js +1 -0
  126. package/dist/assets/stateDiagram-v2-BHNVJYJU-DPQJ1_JB.js +1 -0
  127. package/dist/assets/timeline-definition-PNZ67QCA-aiklZXLq.js +120 -0
  128. package/dist/assets/treeView-BLDUP644-Byr_7ESV.js +1 -0
  129. package/dist/assets/treemap-LRROVOQU-B6DiJnlo.js +1 -0
  130. package/dist/assets/{types-D2P-aXxM.js → types-HYNWZWMw.js} +1 -1
  131. package/dist/assets/ui-components-BK0FqwOC.js +42 -0
  132. package/dist/assets/{ui-layout-DYMEUX5t.js → ui-layout-DM7b0Gu1.js} +1 -1
  133. package/dist/assets/{useActionModal-VGsmP3uO.js → useActionModal-DcFjU7Dq.js} +1 -1
  134. package/dist/assets/vendor-charts-fo4ZbB_t.js +39 -0
  135. package/dist/assets/vendor-i18n-Bz5UncqE.js +1 -0
  136. package/dist/assets/{vendor-markdown-BXE1apAC.js → vendor-markdown-DIJxJfmj.js} +3 -3
  137. package/dist/assets/vennDiagram-CIIHVFJN-DsKC4yvC.js +34 -0
  138. package/dist/assets/wardley-L42UT6IY-f1iiSYpj.js +1 -0
  139. package/dist/assets/wardleyDiagram-YWT4CUSO-DbrUmWlY.js +78 -0
  140. package/dist/assets/xychartDiagram-2RQKCTM6-B4biX1Sz.js +7 -0
  141. package/dist/index.html +4 -4
  142. package/package.json +1 -1
  143. package/dist/assets/index-BjfDho4T.js +0 -4
  144. package/dist/assets/index-CJFqfWpW.css +0 -2
  145. package/dist/assets/mergeServerFields-Co1NIO7_.js +0 -7
  146. package/dist/assets/mermaid-GHXKKRXX-BY4z2Mh6.js +0 -1
  147. package/dist/assets/metadata-admin-B-99o4dC.js +0 -19
  148. package/dist/assets/plugin-charts-EoSn84Ag.js +0 -7
  149. package/dist/assets/plugin-form-MXrWd_1Z.js +0 -1
  150. package/dist/assets/plugin-grid-D9HjQh3d.js +0 -6
  151. package/dist/assets/plugin-markdown-BUIHw2kZ.js +0 -113
  152. package/dist/assets/runtime-config-ir5bt3TX.js +0 -1
  153. package/dist/assets/ui-components-Clv7N77v.js +0 -42
  154. package/dist/assets/vendor-charts-DAigH0Ti.js +0 -39
  155. package/dist/assets/vendor-i18n-CdF5ccW5.js +0 -1
@@ -0,0 +1,96 @@
1
+ import{n as e,r as t}from"./src-CVz7aDdY.js";import{b as n,et as r,f as i,k as a,rt as o,tt as s,x as c,z as l}from"./chunk-CSCIHK7Q-DfSAlgJl.js";import"./chunk-5ZQYHXKU-DG12s6lW.js";import"./chunk-O5CBEL6O-BzyWPZhZ.js";import"./chunk-BSJP7CBP-okvguKD4.js";import"./chunk-L5ZTLDWV-DW1lPBoG.js";import{t as u}from"./chunk-55IACEB6-BhOjfCrn.js";import{t as d}from"./chunk-2J33WTMH-DyXQVMuc.js";import"./chunk-NZK2D7GU-H2MwBqQV.js";import"./chunk-3OPIFGDE-3g0dk_di.js";import"./chunk-KSCS5N6A-IxEh4Ag5.js";import{r as f,t as p}from"./chunk-LZXEDZCA-C_-aaYcd.js";var m=[];for(let e=0;e<256;++e)m.push((e+256).toString(16).slice(1));function h(e,t=0){return(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+`-`+m[e[t+4]]+m[e[t+5]]+`-`+m[e[t+6]]+m[e[t+7]]+`-`+m[e[t+8]]+m[e[t+9]]+`-`+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase()}var g,_=new Uint8Array(16);function v(){if(!g){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);g=crypto.getRandomValues.bind(crypto)}return g(_)}var y={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function b(e,t,n){if(y.randomUUID&&!t&&!e)return y.randomUUID();e||={};let r=e.random??e.rng?.()??v();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return h(r)}var x=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,13],i=[1,12],a=[1,15],o=[1,16],s=[1,20],c=[1,19],l=[6,7,8],u=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,6,13,15,16,19,22],h=[1,33],g=[1,34],_=[1,6,7,11,13,15,16,19,22],v={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`MINDMAP`,11:`EOF`,13:`SPACELIST`,15:`ICON`,16:`CLASS`,19:`NODE_DSTART`,20:`NODE_DESCR`,21:`NODE_DEND`,22:`NODE_ID`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace(`SPACELIST`);break;case 19:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:14,15:a,16:o,17:17,18:18,19:s,22:c},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,15:a,16:o,17:17,18:18,19:s,22:c},{6:r,9:22,12:11,13:i,14:14,15:a,16:o,17:17,18:18,19:s,22:c},{6:u,7:d,10:23,11:f},t(p,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:c}),t(p,[2,18]),t(p,[2,19]),t(p,[2,20]),t(p,[2,21]),t(p,[2,23]),t(p,[2,24]),t(p,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:d,10:32,11:f},{1:[2,7],6:r,12:21,13:i,14:14,15:a,16:o,17:17,18:18,19:s,22:c},t(m,[2,14],{7:h,11:g}),t(_,[2,8]),t(_,[2,9]),t(_,[2,10]),t(p,[2,15]),t(p,[2,16]),t(p,[2,17]),{20:[1,35]},{21:[1,36]},t(m,[2,13],{7:h,11:g}),t(_,[2,11]),t(_,[2,12]),{21:[1,37]},t(p,[2,25]),t(p,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
+ `+h.showPosition()+`
3
+ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};v.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
+ `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
5
+ `+t+`^`},`showPosition`),test_match:e(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:e(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e===!1?!1:e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
6
+ `+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:e(function(){return this.next()||this.lex()},`lex`),begin:e(function(e){this.conditionStack.push(e)},`begin`),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:e(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:e(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:e(function(e){this.begin(e)},`pushState`),stateStackSize:e(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:e(function(e,t,n,r){switch(n){case 0:return e.getLogger().trace(`Found comment`,t.yytext),6;case 1:return 8;case 2:this.begin(`CLASS`);break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:e.getLogger().trace(`Begin icon`),this.begin(`ICON`);break;case 6:return e.getLogger().trace(`SPACELINE`),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace(`end icon`),this.popState();break;case 10:return e.getLogger().trace(`Exploding node`),this.begin(`NODE`),19;case 11:return e.getLogger().trace(`Cloud`),this.begin(`NODE`),19;case 12:return e.getLogger().trace(`Explosion Bang`),this.begin(`NODE`),19;case 13:return e.getLogger().trace(`Cloud Bang`),this.begin(`NODE`),19;case 14:return this.begin(`NODE`),19;case 15:return this.begin(`NODE`),19;case 16:return this.begin(`NODE`),19;case 17:return this.begin(`NODE`),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin(`NSTR2`);break;case 22:return`NODE_DESCR`;case 23:this.popState();break;case 24:e.getLogger().trace(`Starting NSTR`),this.begin(`NSTR`);break;case 25:return e.getLogger().trace(`description:`,t.yytext),`NODE_DESCR`;case 26:this.popState();break;case 27:return this.popState(),e.getLogger().trace(`node end ))`),`NODE_DEND`;case 28:return this.popState(),e.getLogger().trace(`node end )`),`NODE_DEND`;case 29:return this.popState(),e.getLogger().trace(`node end ...`,t.yytext),`NODE_DEND`;case 30:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 31:return this.popState(),e.getLogger().trace(`node end (-`),`NODE_DEND`;case 32:return this.popState(),e.getLogger().trace(`node end (-`),`NODE_DEND`;case 33:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 34:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 35:return e.getLogger().trace(`Long description:`,t.yytext),20;case 36:return e.getLogger().trace(`Long description:`,t.yytext),20}},`anonymous`),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}})();function y(){this.yy={}}return e(y,`Parser`),y.prototype=v,v.Parser=y,new y})();x.parser=x;var S=x,C=12,w={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},T=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=w,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{e(this,`MindmapDB`)}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let t=this.nodes.length-1;t>=0;t--)if(this.nodes[t].level<e)return this.nodes[t];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,n,r,a){t.info(`addNode`,e,n,r,a);let o=!1;this.nodes.length===0?(this.baseLevel=e,e=0,o=!0):this.baseLevel!==void 0&&(e-=this.baseLevel,o=!1);let s=c(),u=s.mindmap?.padding??i.mindmap.padding;switch(a){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:u*=2;break}let d={id:this.count++,nodeId:l(n,s),level:e,descr:l(r,s),type:a,children:[],width:s.mindmap?.maxNodeWidth??i.mindmap.maxNodeWidth,padding:u,isRoot:o},f=this.getParent(e);if(f)f.children.push(d),this.nodes.push(d);else if(o)this.nodes.push(d);else throw Error(`There can be only one root. No parent could be found for ("${d.descr}")`)}getType(e,n){switch(t.debug(`In get type`,e,n),e){case`[`:return this.nodeType.RECT;case`(`:return n===`)`?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case`((`:return this.nodeType.CIRCLE;case`)`:return this.nodeType.CLOUD;case`))`:return this.nodeType.BANG;case`{{`:return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;let t=c(),n=this.nodes[this.nodes.length-1];e.icon&&(n.icon=l(e.icon,t)),e.class&&(n.class=l(e.class,t))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return`no-border`;case this.nodeType.RECT:return`rect`;case this.nodeType.ROUNDED_RECT:return`rounded-rect`;case this.nodeType.CIRCLE:return`circle`;case this.nodeType.CLOUD:return`cloud`;case this.nodeType.BANG:return`bang`;case this.nodeType.HEXAGON:return`hexgon`;default:return`no-border`}}assignSections(e,t){if(e.level===0?e.section=void 0:e.section=t,e.children)for(let[n,r]of e.children.entries()){let i=e.level===0?n%(C-1):t;this.assignSections(r,i)}}flattenNodes(t,n){let r=c(),i=[`mindmap-node`];t.isRoot===!0?i.push(`section-root`,`section--1`):t.section!==void 0&&i.push(`section-${t.section}`),t.class&&i.push(t.class);let a=i.join(` `),o=e(e=>{let t=(r.theme?.toLowerCase()??``).includes(`redux`);switch(e){case w.CIRCLE:return`mindmapCircle`;case w.RECT:return`rect`;case w.ROUNDED_RECT:return`rounded`;case w.CLOUD:return`cloud`;case w.BANG:return`bang`;case w.HEXAGON:return`hexagon`;case w.DEFAULT:return t?`rounded`:`defaultMindmapNode`;case w.NO_BORDER:default:return`rect`}},`getShapeFromType`),s={id:t.id.toString(),domId:`node_`+t.id.toString(),label:t.descr,labelType:`markdown`,isGroup:!1,shape:o(t.type),width:t.width,height:t.height??0,padding:t.padding,cssClasses:a,cssStyles:[],look:r.look,icon:t.icon,x:t.x,y:t.y,level:t.level,nodeId:t.nodeId,type:t.type,section:t.section};if(n.push(s),t.children)for(let e of t.children)this.flattenNodes(e,n)}generateEdges(e,t){if(!e.children)return;let n=c();for(let r of e.children){let i=`edge`;r.section!==void 0&&(i+=` section-edge-${r.section}`);let a=e.level+1;i+=` edge-depth-${a}`;let o={id:`edge_${e.id}_${r.id}`,start:e.id.toString(),end:r.id.toString(),type:`normal`,curve:`basis`,thickness:`normal`,look:n.look,classes:i,depth:e.level,section:r.section};t.push(o),this.generateEdges(r,t)}}getData(){let e=this.getMindmap(),n=c(),r=a().layout!==void 0,i=n;if(r||(i.layout=`cose-bilkent`),!e)return{nodes:[],edges:[],config:i};t.debug(`getData: mindmapRoot`,e,n),this.assignSections(e);let o=[],s=[];this.flattenNodes(e,o),this.generateEdges(e,s),t.debug(`getData: processed ${o.length} nodes and ${s.length} edges`);let l=new Map;for(let e of o)l.set(e.id,{shape:e.shape,width:e.width,height:e.height,padding:e.padding});return{nodes:o,edges:s,config:i,rootNode:e,markers:[`point`],direction:`TB`,nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(l),type:`mindmap`,diagramId:`mindmap-`+b()}}getLogger(){return t}},E={draw:e(async(e,r,a,o)=>{t.debug(`Rendering mindmap diagram
7
+ `+e);let s=o.db,c=s.getData(),l=u(r,c.config.securityLevel);if(c.type=o.type,c.layoutAlgorithm=p(c.config.layout,{fallback:`cose-bilkent`}),c.diagramId=r,!s.getMindmap())return;c.nodes.forEach(e=>{e.shape===`rounded`?(e.radius=15,e.taper=15,e.stroke=`none`,e.width=0,e.padding=15):e.shape===`circle`?e.padding=10:e.shape===`rect`?(e.width=0,e.padding=10):e.shape===`hexagon`&&(e.width=0,e.height=0)}),await f(c,l);let{themeVariables:m}=n(),{useGradient:h,gradientStart:g,gradientStop:_}=m;if(h&&g&&_){let e=l.attr(`id`),t=l.append(`defs`).append(`linearGradient`).attr(`id`,`${e}-gradient`).attr(`gradientUnits`,`objectBoundingBox`).attr(`x1`,`0%`).attr(`y1`,`0%`).attr(`x2`,`100%`).attr(`y2`,`0%`);t.append(`stop`).attr(`offset`,`0%`).attr(`stop-color`,g).attr(`stop-opacity`,1),t.append(`stop`).attr(`offset`,`100%`).attr(`stop-color`,_).attr(`stop-opacity`,1)}d(l,c.config.mindmap?.padding??i.mindmap.padding,`mindmapDiagram`,c.config.mindmap?.useMaxWidth??i.mindmap.useMaxWidth)},`draw`)},D=e(e=>{let{theme:t,look:n}=e,i=``;for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e[`lineColor`+t]=e[`lineColor`+t]||e[`cScaleInv`+t],o(e[`lineColor`+t])?e[`lineColor`+t]=s(e[`lineColor`+t],20):e[`lineColor`+t]=r(e[`lineColor`+t],20);for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let a=``+(n===`neo`?Math.max(10-(r-1)*2,2):17-3*r);i+=`
8
+ .section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
9
+ fill: ${e[`cScale`+r]};
10
+ }
11
+ .section-${r-1} text {
12
+ fill: ${e[`cScaleLabel`+r]};
13
+ }
14
+ .section-${r-1} span {
15
+ color: ${e[`cScaleLabel`+r]};
16
+ }
17
+ .node-icon-${r-1} {
18
+ font-size: 40px;
19
+ color: ${e[`cScaleLabel`+r]};
20
+ }
21
+ .section-edge-${r-1}{
22
+ stroke: ${e[`cScale`+r]};
23
+ }
24
+ .edge-depth-${r-1}{
25
+ stroke-width: ${a};
26
+ }
27
+ .section-${r-1} line {
28
+ stroke: ${e[`cScaleInv`+r]} ;
29
+ stroke-width: 3;
30
+ }
31
+
32
+ .disabled, .disabled circle, .disabled text {
33
+ fill: lightgray;
34
+ }
35
+ .disabled text {
36
+ fill: #efefef;
37
+ }
38
+ [data-look="neo"].mindmap-node.section-${r-1} rect, [data-look="neo"].mindmap-node.section-${r-1} path, [data-look="neo"].mindmap-node.section-${r-1} circle, [data-look="neo"].mindmap-node.section-${r-1} polygon {
39
+ fill: ${t===`redux`||t===`redux-dark`||t===`neutral`?e.mainBkg:e[`cScale`+r]};
40
+ stroke: ${t===`redux`||t===`redux-dark`?e.nodeBorder:e[`cScale`+r]};
41
+ stroke-width: ${e.strokeWidth??2}px;
42
+ }
43
+ [data-look="neo"].section-edge-${r-1}{
44
+ stroke: ${t?.includes(`redux`)||t===`neo-dark`?e.nodeBorder:e[`cScale`+r]};
45
+ }
46
+ [data-look="neo"].mindmap-node.section-${r-1} text {
47
+ fill: ${t===`redux`||t===`redux-dark`?e.nodeBorder:e[`cScaleLabel`+(t===`neutral`?1:r)]};
48
+ }
49
+ `}return i},`genSections`),O=e((e,t,n)=>{let r=``;for(let i=0;i<e;i++)r+=`
50
+ [data-look="neo"].mindmap-node.section-${i-1} rect, [data-look="neo"].mindmap-node.section-${i-1} path, [data-look="neo"].mindmap-node.section-${i-1} circle, [data-look="neo"].mindmap-node.section-${i-1} polygon {
51
+ stroke: url(${t}-gradient);
52
+ fill: ${n};
53
+ }
54
+ .section-${i-1} line {
55
+ stroke-width: 0;
56
+ }`;return r},`genGradient`),k={get db(){return new T},renderer:E,parser:S,styles:e(e=>{let{theme:t}=e,n=e.svgId,r=e.dropShadow?e.dropShadow.replace(`url(#drop-shadow)`,`url(${n}-drop-shadow)`):`none`;return`
57
+ .edge {
58
+ stroke-width: 3;
59
+ }
60
+ ${D(e)}
61
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
62
+ fill: ${e.git0};
63
+ }
64
+ .section-root text {
65
+ fill: ${e.gitBranchLabel0};
66
+ }
67
+ .section-root span {
68
+ color: ${t?.includes(`redux`)?e.nodeBorder:e.gitBranchLabel0};
69
+ }
70
+ .icon-container {
71
+ height:100%;
72
+ display: flex;
73
+ justify-content: center;
74
+ align-items: center;
75
+ }
76
+ .edge {
77
+ fill: none;
78
+ }
79
+ .mindmap-node-label {
80
+ dy: 1em;
81
+ alignment-baseline: middle;
82
+ text-anchor: middle;
83
+ dominant-baseline: middle;
84
+ text-align: center;
85
+ }
86
+ [data-look="neo"].mindmap-node {
87
+ filter: ${r};
88
+ }
89
+ [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon {
90
+ fill: ${t?.includes(`redux`)?e.mainBkg:e.git0};
91
+ }
92
+ [data-look="neo"].mindmap-node.section-root .text-inner-tspan {
93
+ fill: ${t?.includes(`redux`)?e.nodeBorder:e[`cScaleLabel`+ +(t===`neutral`)]};
94
+ }
95
+ ${e.useGradient&&n&&e.mainBkg?O(e.THEME_COLOR_LIMIT,n,e.mainBkg):``}
96
+ `},`getStyles`)};export{k as diagram};
@@ -0,0 +1 @@
1
+ import"./chunk-NNHCCRGN-Ud6GGuM7.js";import{p as e}from"./mermaid-parser.core-iuxcj-n_.js";export{e as createPacketServices};
@@ -0,0 +1 @@
1
+ import"./chunk-NNHCCRGN-Ud6GGuM7.js";import{d as e}from"./mermaid-parser.core-iuxcj-n_.js";export{e as createPieServices};
@@ -0,0 +1,30 @@
1
+ import{Ot as e,it as t,jt as n}from"./vendor-charts-fo4ZbB_t.js";import{t as r}from"./mermaid-parser.core-iuxcj-n_.js";import{n as i,r as a}from"./src-CVz7aDdY.js";import{H as o,K as s,U as c,a as l,c as u,f as d,v as f,w as p,x as m,y as h}from"./chunk-CSCIHK7Q-DfSAlgJl.js";import{t as g}from"./chunk-WU5MYG2G-DwQt8tuZ.js";import{i as _,p as v}from"./chunk-5ZQYHXKU-DG12s6lW.js";import{t as y}from"./chunk-4BX2VUAB-BpAZJ7ZC.js";var b=d.pie,x={sections:new Map,showData:!1,config:b},S=x.sections,C=x.showData,w=structuredClone(b),T={getConfig:i(()=>structuredClone(w),`getConfig`),clear:i(()=>{S=new Map,C=x.showData,l()},`clear`),setDiagramTitle:s,getDiagramTitle:p,setAccTitle:c,getAccTitle:h,setAccDescription:o,getAccDescription:f,addSection:i(({label:e,value:t})=>{if(t<0)throw Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);S.has(e)||(S.set(e,t),a.debug(`added new section: ${e}, with value: ${t}`))},`addSection`),getSections:i(()=>S,`getSections`),setShowData:i(e=>{C=e},`setShowData`),getShowData:i(()=>C,`getShowData`)},E=i((e,t)=>{y(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},`populateDb`),D={parse:i(async e=>{let t=await r(`pie`,e);a.debug(t),E(t,T)},`parse`)},O=i(e=>`
2
+ .pieCircle{
3
+ stroke: ${e.pieStrokeColor};
4
+ stroke-width : ${e.pieStrokeWidth};
5
+ opacity : ${e.pieOpacity};
6
+ }
7
+ .pieOuterCircle{
8
+ stroke: ${e.pieOuterStrokeColor};
9
+ stroke-width: ${e.pieOuterStrokeWidth};
10
+ fill: none;
11
+ }
12
+ .pieTitleText {
13
+ text-anchor: middle;
14
+ font-size: ${e.pieTitleTextSize};
15
+ fill: ${e.pieTitleTextColor};
16
+ font-family: ${e.fontFamily};
17
+ }
18
+ .slice {
19
+ font-family: ${e.fontFamily};
20
+ fill: ${e.pieSectionTextColor};
21
+ font-size:${e.pieSectionTextSize};
22
+ // fill: white;
23
+ }
24
+ .legend text {
25
+ fill: ${e.pieLegendTextColor};
26
+ font-family: ${e.fontFamily};
27
+ font-size: ${e.pieLegendTextSize};
28
+ }
29
+ `,`getStyles`),k=i(t=>{let n=[...t.values()].reduce((e,t)=>e+t,0),r=[...t.entries()].map(([e,t])=>({label:e,value:t})).filter(e=>e.value/n*100>=1);return e().value(e=>e.value).sort(null)(r)},`createPieArcs`),A={parser:D,db:T,renderer:{draw:i((e,r,i,o)=>{a.debug(`rendering pie chart
30
+ `+e);let s=o.db,c=m(),l=_(s.getConfig(),c.pie),d=g(r),f=d.append(`g`);f.attr(`transform`,`translate(225,225)`);let{themeVariables:p}=c,[h]=v(p.pieOuterStrokeWidth);h??=2;let y=l.textPosition,b=n().innerRadius(0).outerRadius(185),x=n().innerRadius(185*y).outerRadius(185*y);f.append(`circle`).attr(`cx`,0).attr(`cy`,0).attr(`r`,185+h/2).attr(`class`,`pieOuterCircle`);let S=s.getSections(),C=k(S),w=[p.pie1,p.pie2,p.pie3,p.pie4,p.pie5,p.pie6,p.pie7,p.pie8,p.pie9,p.pie10,p.pie11,p.pie12],T=0;S.forEach(e=>{T+=e});let E=C.filter(e=>(e.data.value/T*100).toFixed(0)!==`0`),D=t(w).domain([...S.keys()]);f.selectAll(`mySlices`).data(E).enter().append(`path`).attr(`d`,b).attr(`fill`,e=>D(e.data.label)).attr(`class`,`pieCircle`),f.selectAll(`mySlices`).data(E).enter().append(`text`).text(e=>(e.data.value/T*100).toFixed(0)+`%`).attr(`transform`,e=>`translate(`+x.centroid(e)+`)`).style(`text-anchor`,`middle`).attr(`class`,`slice`);let O=f.append(`text`).text(s.getDiagramTitle()).attr(`x`,0).attr(`y`,-400/2).attr(`class`,`pieTitleText`),A=[...S.entries()].map(([e,t])=>({label:e,value:t})),j=f.selectAll(`.legend`).data(A).enter().append(`g`).attr(`class`,`legend`).attr(`transform`,(e,t)=>{let n=22*A.length/2;return`translate(216,`+(t*22-n)+`)`});j.append(`rect`).attr(`width`,18).attr(`height`,18).style(`fill`,e=>D(e.label)).style(`stroke`,e=>D(e.label)),j.append(`text`).attr(`x`,22).attr(`y`,14).text(e=>s.getShowData()?`${e.label} [${e.value}]`:e.label);let M=512+Math.max(...j.selectAll(`text`).nodes().map(e=>e?.getBoundingClientRect().width??0)),N=O.node()?.getBoundingClientRect().width??0,P=450/2-N/2,F=450/2+N/2,I=Math.min(0,P),L=Math.max(M,F)-I;d.attr(`viewBox`,`${I} 0 ${L} 450`),u(d,450,L,l.useMaxWidth)},`draw`)},styles:O};export{A as diagram};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,t as r}from"./vendor-react-DR370ovB.js";import{F as i,G as a,lt as o,mt as s,r as c,ut as l}from"./framework-D7UWfRl4.js";import{$t as u,Bn as d,Bt as f,Hi as p,Hn as m,Ht as h,Ln as g,Ns as _,Nt as v,Qn as y,Rn as b,Ss as x,Ut as S,Vn as C,Vt as w,Wt as T,en as E,hr as D,lc as O,nn as k,on as A,tn as j,xs as ee,zn as te}from"./ui-components-Clv7N77v.js";import{a as M,i as ne}from"./plugins-views-D0zS0yz2.js";import{a as re}from"./plugin-grid-D9HjQh3d.js";var N=e(n(),1),P=r(),F=`bg-blue-100 text-blue-900 border border-blue-200`,ie=new Date,I=[`bg-blue-100 text-blue-900 border border-blue-200`,`bg-emerald-100 text-emerald-900 border border-emerald-200`,`bg-amber-100 text-amber-900 border border-amber-200`,`bg-rose-100 text-rose-900 border border-rose-200`,`bg-violet-100 text-violet-900 border border-violet-200`,`bg-cyan-100 text-cyan-900 border border-cyan-200`,`bg-orange-100 text-orange-900 border border-orange-200`,`bg-fuchsia-100 text-fuchsia-900 border border-fuchsia-200`],L=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,R=/(^|\s)(bg|text|from|to|via)-/;function z(e){if(!e)return{className:F};if(L.test(e))return{className:`text-white`,inlineColor:e};if(R.test(e))return{className:e};let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return{className:I[Math.abs(t)%I.length]}}var B={"calendar.today":`Today`,"calendar.month":`Month`,"calendar.week":`Week`,"calendar.day":`Day`,"calendar.newEvent":`New event`,"calendar.moreEvents":`+{{count}} more`,"calendar.allDay":`all-day`};function V(){try{let e=c();return e.t(`calendar.today`)===`calendar.today`?{t:(e,t)=>{let n=B[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}:{t:e.t,language:e.language}}catch{return{t:(e,t)=>{let n=B[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}}}function H({events:e=[],view:t=`month`,currentDate:n=ie,locale:r=`default`,onEventClick:i,onDateClick:a,onViewChange:o,onNavigate:s,onAddClick:c,onEventDrop:l,onTimeRangeSelect:d,slotMinutes:m=30,className:g}){let[v,b]=N.useState(t),[C,k]=N.useState(n),{t:A,language:te}=V(),M=r==="default"?te:r;N.useEffect(()=>{k(n)},[n]),N.useEffect(()=>{b(t)},[t]);let ne=N.useRef(o);ne.current=o,N.useEffect(()=>{let e=window.matchMedia(`(max-width: 639px)`),t=e=>{e.matches&&(b(`day`),ne.current?.(`day`))};return t(e),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let re=()=>{let e=new Date(C);v===`month`?e.setMonth(e.getMonth()-1):v===`week`?e.setDate(e.getDate()-7):e.setDate(e.getDate()-1),k(e),s?.(e)},F=()=>{let e=new Date(C);v===`month`?e.setMonth(e.getMonth()+1):v===`week`?e.setDate(e.getDate()+7):e.setDate(e.getDate()+1),k(e),s?.(e)},I=()=>{let e=new Date;k(e),s?.(e)},L=e=>{b(e),o?.(e)},R=()=>{if(v===`month`)return C.toLocaleDateString(M,{month:`long`,year:`numeric`});if(v===`week`){let e=ae(C),t=new Date(e);return t.setDate(t.getDate()+6),`${e.toLocaleDateString(M,{month:`short`,day:`numeric`})} - ${t.toLocaleDateString(M,{month:`short`,day:`numeric`,year:`numeric`})}`}else return C.toLocaleDateString(M,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})},z=N.useRef(0);return(0,P.jsxs)(`div`,{role:`region`,"aria-label":`Calendar`,className:O(`flex flex-col h-full bg-background min-w-0 overflow-hidden`,g),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 p-2 sm:p-4 border-b min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center bg-muted/50 rounded-lg p-1 gap-1`,children:[(0,P.jsx)(D,{variant:`ghost`,size:`sm`,onClick:I,className:`h-8`,"aria-label":`Go to today`,children:A(`calendar.today`)}),(0,P.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Previous period`,onClick:re,className:`h-8 w-8`,children:(0,P.jsx)(x,{className:`h-4 w-4`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Next period`,onClick:F,className:`h-8 w-8`,children:(0,P.jsx)(ee,{className:`h-4 w-4`})})]}),(0,P.jsxs)(u,{children:[(0,P.jsx)(j,{asChild:!0,children:(0,P.jsxs)(D,{variant:`ghost`,"aria-label":`Current date: ${R()}`,className:O(`text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors`,`flex items-center gap-2`),children:[(0,P.jsx)(_,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsx)(`span`,{children:R()})]})}),(0,P.jsx)(E,{className:`w-auto p-0`,align:`start`,children:(0,P.jsx)(y,{mode:`single`,selected:C,onSelect:e=>{e&&(k(e),s?.(e))},autoFocus:!0,startMonth:new Date(2e3,0),endMonth:new Date(2050,11)})})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(f,{value:v,onValueChange:L,children:[(0,P.jsx)(S,{className:`w-32 bg-background`,children:(0,P.jsx)(T,{})}),(0,P.jsxs)(w,{children:[(0,P.jsx)(h,{value:`day`,children:A(`calendar.day`)}),(0,P.jsx)(h,{value:`week`,children:A(`calendar.week`)}),(0,P.jsx)(h,{value:`month`,children:A(`calendar.month`)})]})]}),c&&(0,P.jsxs)(D,{onClick:c,size:`sm`,className:`gap-1`,children:[(0,P.jsx)(p,{className:`h-4 w-4`}),A(`calendar.newEvent`)]})]})]}),(0,P.jsxs)(`div`,{className:`flex-1 overflow-auto`,onTouchStart:e=>{z.current=e.touches[0].clientX},onTouchEnd:e=>{let t=z.current-e.changedTouches[0].clientX;if(Math.abs(t)>50){let e=new Date(C);v===`day`?e.setDate(e.getDate()+(t>0?1:-1)):v===`week`?e.setDate(e.getDate()+(t>0?7:-7)):e.setMonth(e.getMonth()+(t>0?1:-1)),k(e),s?.(e)}},children:[v===`month`&&(0,P.jsx)(W,{date:C,events:e,locale:M,onEventClick:i,onDateClick:a,onEventDrop:l}),v===`week`&&(0,P.jsx)(Y,{mode:`week`,date:C,events:e,locale:M,slotMinutes:m,onEventClick:i,onEventDrop:l,onTimeRangeSelect:d}),v===`day`&&(0,P.jsx)(Y,{mode:`day`,date:C,events:e,locale:M,slotMinutes:m,onEventClick:i,onEventDrop:l,onTimeRangeSelect:d})]})]})}function ae(e){let t=new Date(e),n=t.getDay(),r=t.getDate()-n;return t.setDate(r),t}function oe(e){let t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n,1),i=new Date(t,n+1,0),a=r.getDay(),o=[];for(let e=a-1;e>=0;e--){let t=new Date(r.getTime());t.setDate(t.getDate()-(e+1)),o.push(t)}for(let e=1;e<=i.getDate();e++)o.push(new Date(t,n,e));let s=42-o.length;for(let e=1;e<=s;e++){let t=new Date(i.getTime());t.setDate(t.getDate()+e),o.push(t)}return o}function U(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function W({date:e,events:t,locale:n=`default`,onEventClick:r,onDateClick:i,onEventDrop:a}){let o=N.useMemo(()=>oe(e),[e.getFullYear(),e.getMonth()]),s=N.useMemo(()=>new Date,[]),{t:c}=V(),l=N.useMemo(()=>{let e=new Date(2024,0,7);return Array.from({length:7},(t,r)=>{let i=new Date(e);return i.setDate(i.getDate()+r),i.toLocaleDateString(n,{weekday:`short`})})},[n]),[u,d]=N.useState(null),[f,p]=N.useState(null),m=N.useMemo(()=>{let e=new Map;for(let n of t){let t=new Date(n.start),r=n.end?new Date(n.end):new Date(t);t.setHours(0,0,0,0),r.setHours(0,0,0,0);let i=new Date(t);for(;i<=r;){let a=`${i.getFullYear()}-${i.getMonth()}-${i.getDate()}`,o=i.getTime()===t.getTime(),s=i.getTime()===r.getTime(),c=o||s||i.getDay()===0,l=e.get(a),u={event:n,isTitleDay:c,isSpanStart:o,isSpanEnd:s};l?l.push(u):e.set(a,[u]),i.setDate(i.getDate()+1)}}return e},[t]),h=(e,t,n=`move`,r)=>{d(t.id),e.dataTransfer.effectAllowed=`move`;let i={id:t.id,mode:n,...r?{sourceDay:`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`}:{}};e.dataTransfer.setData(`text/plain`,JSON.stringify(i)),n===`resize-end`&&e.stopPropagation()},g=()=>{d(null),p(null)},_=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,p(t)},v=e=>{e.currentTarget.contains(e.relatedTarget)||p(null)},y=(e,n)=>{if(e.preventDefault(),p(null),d(null),!a)return;let r=e.dataTransfer.getData(`text/plain`),i;try{i=JSON.parse(r)}catch{i={id:r,mode:`move`}}let o=t.find(e=>String(e.id)===String(i.id));if(!o)return;let s=new Date(n);if(s.setHours(0,0,0,0),i.mode===`resize-end`){let e=o.end?new Date(o.end):new Date(o.start),t=new Date(e);if(t.setHours(0,0,0,0),s.getTime()===t.getTime())return;let n=new Date(o.start);if(n.setHours(0,0,0,0),s.getTime()<n.getTime())return;let r=new Date(s);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0),a(o,new Date(o.start),r);return}let c=new Date(o.start),l;if(i.sourceDay){let[e,t,n]=i.sourceDay.split(`-`).map(e=>parseInt(e,10));l=new Date(e,t,n)}else l=new Date(c);l.setHours(0,0,0,0);let u=s.getTime()-l.getTime();if(u===0)return;let f=new Date(c.getTime()+u),m;o.end&&(m=new Date(new Date(o.end).getTime()+u)),a(o,f,m)};return(0,P.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,P.jsx)(`div`,{role:`row`,className:`grid grid-cols-7 border-b`,children:l.map(e=>(0,P.jsx)(`div`,{role:`columnheader`,className:`p-2 text-center text-sm font-medium text-muted-foreground border-r last:border-r-0`,children:e},e))}),(0,P.jsx)(`div`,{role:`grid`,"aria-label":`Calendar grid`,className:`grid grid-cols-7 flex-1 auto-rows-fr`,children:o.map((t,n)=>{let o=`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`,l=m.get(o)||[],d=t.getMonth()===e.getMonth(),p=U(t,s);return(0,P.jsxs)(`div`,{role:`gridcell`,"aria-label":`${t.toLocaleDateString(`default`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}${l.length>0?`, ${l.length} event${l.length>1?`s`:``}`:``}`,className:O(`border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50`,!d&&`bg-muted/50 text-muted-foreground opacity-50`,f===n&&`ring-2 ring-primary`),onClick:()=>i?.(t),onDragOver:e=>_(e,n),onDragLeave:v,onDrop:e=>y(e,t),children:[(0,P.jsx)(`div`,{className:O(`text-sm font-medium mb-2`,p&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6`),...p?{"aria-current":`date`}:{},children:t.getDate()}),(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[l.slice(0,4).map(({event:e,isTitleDay:n,isSpanStart:i,isSpanEnd:o},s)=>{let c=!n,{className:l,inlineColor:d}=z(e.color),f=!!a&&o;return(0,P.jsxs)(`div`,{role:`button`,title:e.title,"aria-label":e.title,draggable:!!a,onDragStart:n=>h(n,e,`move`,t),onDragEnd:g,className:O(`relative text-xs hover:opacity-80 truncate`,a?`cursor-move`:`cursor-pointer`,c?`h-1.5`:`px-2 py-0.5`,i?`rounded-l`:`rounded-l-none`,o?`rounded-r`:`rounded-r-none`,!o&&`-mr-2`,l,u===e.id&&`opacity-50`),style:d?{backgroundColor:d}:void 0,onClick:t=>{t.stopPropagation(),r?.(e)},children:[c?``:e.title,f&&(0,P.jsx)(`span`,{role:`separator`,"aria-label":`Resize event end`,title:`Drag to change end date`,draggable:!0,onDragStart:n=>h(n,e,`resize-end`,t),onDragEnd:g,onClick:e=>e.stopPropagation(),className:`absolute inset-y-0 right-0 w-2 cursor-ew-resize bg-black/25 hover:bg-black/50 rounded-r`})]},`${e.id}-${s}`)}),l.length>4&&(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground px-2`,children:c(`calendar.moreEvents`,{count:l.length-4})})]})]},n)})})]})}var G=48;function K(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function q(e){return e.getHours()*60+e.getMinutes()}function J(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function Y({mode:e,date:t,events:n,locale:r=`default`,slotMinutes:i=30,onEventClick:a,onEventDrop:o,onTimeRangeSelect:s}){let{t:c}=V(),l=G*i/60,u=G*24,d=N.useMemo(()=>{if(e===`day`)return[K(t)];let n=ae(t);return Array.from({length:7},(e,t)=>{let r=new Date(n);return r.setDate(n.getDate()+t),K(r)})},[e,t.getFullYear(),t.getMonth(),t.getDate()]),f=N.useMemo(()=>new Date,[]),p=N.useCallback(e=>{if(e.allDay)return!0;let t=new Date(e.start),n=e.end?new Date(e.end):new Date(t),r=t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0,i=n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0,a=n.getTime()-t.getTime();return!!(r&&i||a>=1440*60*1e3)},[]),{allDayEvents:m,timedEvents:h}=N.useMemo(()=>{let e=[],t=[];for(let r of n)p(r)?e.push(r):t.push(r);return{allDayEvents:e,timedEvents:t}},[n,p]),g=N.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of m){let n=K(new Date(t.start)),r=t.end?new Date(t.end):new Date(t.start),i=K(r);r.getHours()===0&&r.getMinutes()===0&&r.getSeconds()===0&&r.getTime()>n.getTime()&&(i=new Date(i),i.setDate(i.getDate()-1));for(let r of d){let a=K(r);a<n||a>i||e.get(J(r)).push({event:t,isStart:a.getTime()===n.getTime(),isEnd:a.getTime()===i.getTime()})}}return e},[d,m]),_=N.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of h){let n=new Date(t.start),r=t.end?new Date(t.end):new Date(n.getTime()+3600*1e3);for(let i of d){let a=K(i),o=new Date(a);if(o.setDate(o.getDate()+1),r<=a||n>=o)continue;let s=n<a?a:n,c=r>o?o:r,l=q(s),u=c.getTime()===o.getTime()?1440:q(c);e.get(J(i)).push({event:t,startMin:l,endMin:Math.max(u,l+15),isStart:s.getTime()===n.getTime(),isEnd:c.getTime()===r.getTime()})}}return e},[d,h]),v=N.useMemo(()=>{let e=new Map;for(let[t,n]of _){let r=[...n].sort((e,t)=>e.startMin-t.startMin||e.endMin-t.endMin),i=[],a=[],o=[];for(let e of r){let t=0;for(;i[t]&&i[t].endMin>e.startMin;)t++;i[t]={endMin:e.endMin},a.push({entry:e,col:t})}for(let e=0;e<a.length;e++){let t=a[e],n=t.col;for(let r=0;r<a.length;r++){if(r===e)continue;let i=a[r];i.entry.startMin<t.entry.endMin&&i.entry.endMin>t.entry.startMin&&i.col>n&&(n=i.col)}o.push({...t.entry,col:t.col,cols:n+1})}e.set(t,o)}return e},[_]),y=N.useRef(null),b=N.useRef([]),[x,S]=N.useState(null),C=N.useRef(null);C.current=x;let w=N.useRef(!1),T=N.useCallback((e,t)=>{let n=b.current[t];if(!n)return 0;let r=(e-n.getBoundingClientRect().top+n.scrollTop)/G*60,a=Math.round(r/i)*i;return Math.max(0,Math.min(1440,a))},[i]),E=N.useCallback(e=>{for(let t=0;t<b.current.length;t++){let n=b.current[t];if(!n)continue;let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right)return t}return-1},[]);N.useEffect(()=>{if(!x)return;let e=e=>{let t=x.kind===`select`||x.kind===`move`?E(e.clientX):x.dayIndex,n=t<0?x.dayIndex??0:t,r=T(e.clientY,n);S(e=>e&&(e.kind===`select`?{...e,dayIndex:n>=0?n:e.dayIndex,headMinutes:r}:e.kind===`move`?{...e,dayIndex:n,minutes:r}:{...e,minutes:r}))},t=e=>{let t=C.current;if(!t){S(null);return}try{if(t.kind===`select`&&s){let e=Math.min(t.anchorMinutes,t.headMinutes),n=Math.max(t.anchorMinutes,t.headMinutes),r=e,a=n===e?Math.min(1440,e+i):n,o=d[t.dayIndex]??d[0],c=new Date(o);c.setHours(0,Math.round(r),0,0);let l=new Date(o);l.setHours(0,Math.round(a),0,0),w.current=!0,s(c,l)}else if(t.kind===`move`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=t.dayIndex<0?0:t.dayIndex,r=t.minutes-t.grabMinuteOffset,a=Math.max(0,Math.min(1440-t.durationMin,Math.round(r/i)*i)),s=d[n]??d[0],c=new Date(s);c.setHours(0,a,0,0);let l=new Date(c.getTime()+t.durationMin*60*1e3);w.current=!0,o(e,c,l)}}else if(t.kind===`resize-top`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.min(t.anchorEndMin-i,Math.max(0,t.minutes)),a=new Date(n);a.setHours(0,r,0,0);let s=new Date(n);s.setHours(0,t.anchorEndMin,0,0),w.current=!0,o(e,a,s)}}else if(t.kind===`resize-bottom`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.max(t.anchorStartMin+i,Math.min(1440,t.minutes)),a=new Date(n);a.setHours(0,t.anchorStartMin,0,0);let s=new Date(n);s.setHours(0,r,0,0),w.current=!0,o(e,a,s)}}}finally{S(null),setTimeout(()=>{w.current=!1},50)}};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[x,d,n,i,o,s,E,T]);let D=N.useMemo(()=>d.map(e=>({weekday:e.toLocaleDateString(r,{weekday:`short`}),day:e.getDate(),month:e.toLocaleDateString(r,{month:`short`}),isToday:U(e,f)})),[d,r,f]),k=N.useMemo(()=>Array.from({length:24},(e,t)=>new Date(2024,0,1,t,0).toLocaleTimeString(r,{hour:`numeric`})),[r]),A=(e,t,n,r)=>{if(!o||e.button!==0)return;e.stopPropagation(),e.preventDefault();let i=T(e.clientY,n);S(r===`body`?{kind:`move`,eventId:t.event.id,grabMinuteOffset:Math.max(0,i-t.startMin),durationMin:t.endMin-t.startMin,dayIndex:n,minutes:i}:r===`top`?{kind:`resize-top`,eventId:t.event.id,anchorEndMin:t.endMin,dayIndex:n,minutes:i}:{kind:`resize-bottom`,eventId:t.event.id,anchorStartMin:t.startMin,dayIndex:n,minutes:i})},j=(e,t)=>{if(!s||e.button!==0)return;e.preventDefault();let n=T(e.clientY,t);S({kind:`select`,dayIndex:t,anchorMinutes:n,headMinutes:n})},ee=e=>{if(!x)return null;if(x.kind===`select`&&x.dayIndex===e){let t=Math.min(x.anchorMinutes,x.headMinutes),n=Math.max(x.anchorMinutes,x.headMinutes);return(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded bg-primary/30 border border-primary pointer-events-none z-10`,style:{top:t/60*G,height:Math.max(l,(n-t)/60*G)},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],t,n,r)})})}if(x.kind===`move`&&x.dayIndex===e){let t=x.minutes-x.grabMinuteOffset,n=Math.max(0,Math.min(1440-x.durationMin,Math.round(t/i)*i));return(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:n/60*G,height:x.durationMin/60*G},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],n,n+x.durationMin,r)})})}if((x.kind===`resize-top`||x.kind===`resize-bottom`)&&x.dayIndex===e){let t,n;return x.kind===`resize-top`?(t=Math.min(x.anchorEndMin-i,Math.max(0,x.minutes)),n=x.anchorEndMin):(t=x.anchorStartMin,n=Math.max(x.anchorStartMin+i,Math.min(1440,x.minutes))),(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:t/60*G,height:(n-t)/60*G},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],t,n,r)})})}return null};return(0,P.jsxs)(`div`,{className:`flex flex-col h-full`,ref:y,children:[(0,P.jsxs)(`div`,{className:`flex border-b sticky top-0 bg-background z-20`,children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r`,"aria-hidden":!0}),D.map((e,t)=>(0,P.jsxs)(`div`,{role:`columnheader`,className:O(`flex-1 p-2 text-center text-sm border-r last:border-r-0`,e.isToday&&`bg-primary/5`),children:[(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.weekday}),(0,P.jsx)(`div`,{className:O(`font-medium`,e.isToday&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6 mx-auto`),children:e.day})]},t))]}),m.length>0&&(0,P.jsxs)(`div`,{className:`flex border-b bg-muted/20 max-h-[140px] overflow-y-auto`,children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r flex items-start justify-end pr-1 pt-1 text-[10px] text-muted-foreground sticky left-0 bg-muted/20`,children:c(`calendar.allDay`)===`calendar.allDay`?`all-day`:c(`calendar.allDay`)}),d.map(e=>{let t=J(e);return(0,P.jsx)(`div`,{className:`flex-1 border-r last:border-r-0 min-h-[28px] p-0.5 space-y-0.5`,children:(g.get(t)??[]).map(({event:e,isStart:t,isEnd:n},r)=>{let{className:i,inlineColor:o}=z(e.color);return(0,P.jsx)(`div`,{role:`button`,title:e.title,onClick:t=>{t.stopPropagation(),a?.(e)},className:O(`text-[11px] px-2 py-0.5 truncate cursor-pointer hover:opacity-80`,t?`rounded-l`:`rounded-l-none -ml-0.5`,n?`rounded-r`:`rounded-r-none -mr-0.5`,i),style:o?{backgroundColor:o}:void 0,children:t?e.title:`\xA0`},`${e.id}-${r}`)})},t)})]}),(0,P.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,P.jsxs)(`div`,{className:`flex`,style:{height:u},children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r relative`,children:k.map((e,t)=>(0,P.jsx)(`div`,{className:`absolute right-1 text-[10px] text-muted-foreground -translate-y-1/2`,style:{top:t*G},children:t===0?``:e},t))}),d.map((e,t)=>{let n=J(e),s=v.get(n)??[];return(0,P.jsxs)(`div`,{ref:e=>{b.current[t]=e},className:`flex-1 border-r last:border-r-0 relative select-none`,style:{height:u},onPointerDown:e=>j(e,t),"aria-label":e.toLocaleDateString(r,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}),children:[Array.from({length:24},(e,t)=>(0,P.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-muted/60 pointer-events-none`,style:{top:t*G}},t)),i<60&&Array.from({length:Math.floor(1440/i)},(e,t)=>{let n=t*i;return n%60==0?null:(0,P.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-dashed border-muted/30 pointer-events-none`,style:{top:n/60*G}},t)}),s.map(n=>{let i=n.startMin/60*G,s=Math.max(l,(n.endMin-n.startMin)/60*G),c=100/n.cols,u=n.col*c,{className:d,inlineColor:f}=z(n.event.color),p=x&&x.eventId===n.event.id;return(0,P.jsxs)(`div`,{role:`button`,tabIndex:0,title:n.event.title,"aria-label":n.event.title,onPointerDown:e=>A(e,n,t,`body`),onClick:e=>{if(w.current){e.stopPropagation();return}e.stopPropagation(),a?.(n.event)},className:O(`absolute rounded text-xs px-2 py-1 overflow-hidden shadow-sm`,o?`cursor-move`:`cursor-pointer`,d,p&&`opacity-40`),style:{top:i,height:s,left:`calc(${u}% + 2px)`,width:`calc(${c}% - 4px)`,...f?{backgroundColor:f}:{}},children:[(0,P.jsx)(`div`,{className:`font-medium truncate`,children:n.event.title}),(0,P.jsx)(`div`,{className:`text-[10px] opacity-80 truncate`,children:X(e,n.startMin,n.endMin,r)}),o&&n.isStart&&(0,P.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`top`),className:`absolute top-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize start`}),o&&n.isEnd&&(0,P.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`bottom`),className:`absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize end`})]},`${n.event.id}-${n.startMin}`)}),ee(t)]},n)})]})})]})}function X(e,t,n,r){let i=new Date(e);i.setHours(0,Math.round(t),0,0);let a=new Date(e);a.setHours(0,Math.round(n),0,0);let o=e=>e.toLocaleTimeString(r,{hour:`numeric`,minute:`2-digit`});return`${o(i)} – ${o(a)}`}function se(e){return`data`in e&&e.data?e.data:`staticData`in e&&e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function ce(e){if(e){if(typeof e==`string`){let t=e.split(` `),n=t[0],r=t[1]?.toLowerCase()===`desc`?`desc`:`asc`;return{[n]:r}}if(Array.isArray(e))return e.reduce((e,t)=>(t.field&&t.order&&(e[t.field]=t.order),e),{})}}function le(e){return`filter`in e&&e.filter&&typeof e.filter==`object`&&`calendar`in e.filter?e.filter.calendar:e.calendar?e.calendar:e.startDateField||e.dateField?{startDateField:e.startDateField||e.dateField,endDateField:e.endDateField||e.endField,titleField:e.titleField,colorField:e.colorField,allDayField:e.allDayField}:null}var Z=({schema:e,dataSource:t,className:n,data:r,loading:a,onEventClick:s,onRowClick:c,onDateClick:u,onNavigate:f,onViewChange:p,onEventDrop:h,locale:_})=>{let y=Array.isArray(r),[x,S]=(0,N.useState)(y?r:[]),[w,T]=(0,N.useState)(y?a??!1:!0),[E,O]=(0,N.useState)(null),[j,ee]=(0,N.useState)(null),[F,ie]=(0,N.useState)(new Date),I=v(),L=e.defaultView,[R,z]=(0,N.useState)(()=>{let e=L===`day`||!L;return typeof window<`u`&&window.innerWidth<768&&e?`month`:L||`month`});(0,N.useEffect)(()=>{I&&R===`day`&&(L===`day`||!L)&&z(`month`)},[I]);let[B,V]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!y&&!(!t?.onMutation||!e.objectName))return t.onMutation(t=>{t.resource===e.objectName&&V(e=>e+1)})},[t,e.objectName,y]);let{ref:ae,isRefreshing:oe,pullDistance:U}=re({onRefresh:(0,N.useCallback)(async()=>{V(e=>e+1)},[]),enabled:!!t&&!!e.objectName}),W=(0,N.useMemo)(()=>se(e),[e.data,e.staticData,e.objectName]),G=(0,N.useMemo)(()=>le(e),[e.filter,e.calendar,e.dateField,e.endField,e.titleField,e.colorField]),K=W?.provider===`value`,q=(0,N.useRef)(null);q.current=j,(0,N.useEffect)(()=>{y&&S(r)},[r,y]),(0,N.useEffect)(()=>{y&&a!==void 0&&T(a)},[a,y]),(0,N.useEffect)(()=>{if(y)return;let n=!0;return(async()=>{try{if(!n)return;if(T(!0),K&&W?.provider===`value`){n&&(S(W.items),T(!1));return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(W?.provider===`object`){let r=W.object,i=o(q.current?.fields),a=l(await t.find(r,{$filter:e.filter,$orderby:ce(e.sort),...i.length>0?{$expand:i}:{}}));n&&S(a)}else W?.provider===`api`&&(console.warn(`API provider not yet implemented for ObjectCalendar`),n&&S([]));n&&T(!1)}catch(e){console.error(`[ObjectCalendar] Error fetching data:`,e),n&&(O(e),T(!1))}})(),()=>{n=!1}},[y,W,t,K,e.filter,e.sort,B]),(0,N.useEffect)(()=>{!K&&t&&(async()=>{try{if(!t)return;let n=W?.provider===`object`?W.object:e.objectName;if(!n)return;ee(await t.getObjectSchema(n))}catch(e){console.error(`Failed to fetch object schema:`,e)}})()},[e.objectName,t,K,W]);let J=(0,N.useMemo)(()=>{if(!G||!x.length)return[];let{startDateField:e,endDateField:t,titleField:n,colorField:r}=G,i=j?.titleFormat,a=typeof i==`string`?i:i&&typeof i==`object`&&typeof i.source==`string`?i.source:void 0,o=j?.NAME_FIELD_KEY,s=[`name`,`full_name`,`fullName`,`title`,`subject`,`label`,`display_name`,`displayName`],c=(e,t)=>{let n=`[-\\u2013\\u2014|/·,:]`,r=!1,i=e.replace(/\{([^{}]+)\}/g,(e,n)=>{let i=t[n.trim()];return i!=null&&i!==``?(r=!0,String(i)):`\0`});return r?i.replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\0`,`g`),``).replace(/\s+/g,` `).trim():``},l=e=>{let t;if(n&&(t=e[n],typeof t==`string`&&(t=t.trim())),!t&&a){let n=c(a,e);n&&(t=n)}if(!t&&o){let n=e[o];typeof n==`string`?t=n.trim():n&&(t=n)}if(!t)for(let n of s){let r=e[n],i=typeof r==`string`?r.trim():r;if(i){t=i;break}}return t||`Untitled`};return x.map((n,i)=>{let a=n[e],o=t?n[t]:null,s=l(n),c=r?n[r]:void 0;return{id:n.id||n._id||`event-${i}`,title:s,start:a?new Date(a):new Date,end:o?new Date(o):void 0,color:c,allDay:!o,data:n}}).filter(e=>!isNaN(e.start.getTime()))},[x,G,j]);(0,N.useCallback)(()=>{u?.(new Date)},[u]);let Y=e.navigation??{mode:`drawer`,width:`min(960px, 60vw)`},X=Y.mode===`drawer`||Y.mode===`modal`||Y.mode===`split`||Y.mode===`popover`,Z=i({navigation:Y,objectName:e.objectName,onRowClick:X?void 0:c}),ue=(0,N.useCallback)(async(n,r,i)=>{if(!G)return;let{startDateField:a,endDateField:o}=G,s=n?.id??n?._id;if(!s||!e.objectName||!t?.update)return;let c={[a]:r.toISOString()};o&&i&&(c[o]=i.toISOString());let l=x;S(e=>e.map(e=>(e?.id??e?._id)===s?{...e,...c}:e));try{await t.update(e.objectName,s,c)}catch(e){S(l),console.error(`[ObjectCalendar] Failed to persist drag-and-drop reschedule:`,e)}},[G,e.objectName,t,x]),[Q,$]=(0,N.useState)(null),de=(0,N.useCallback)(n=>{!G||!e.objectName||!t?.create||$({start:n,title:``,submitting:!1})},[G,e.objectName,t]),fe=(0,N.useCallback)((n,r)=>{!G||!e.objectName||!t?.create||$({start:n,end:r,title:``,submitting:!1})},[G,e.objectName,t]),pe=(0,N.useCallback)(async()=>{if(!Q||!G)return;let n=Q.title.trim();if(!n){$(e=>e&&{...e,error:`Title is required`});return}if(!e.objectName||!t?.create)return;$(e=>e&&{...e,submitting:!0,error:void 0});let{startDateField:r,endDateField:i,titleField:a}=G,o={[a||`name`]:n,[r]:Q.start.toISOString()};i&&(o[i]=(Q.end??Q.start).toISOString());let s=j?.fields;if(s&&typeof s==`object`){let e=Array.isArray(s)?s.map(e=>[e.name??e.apiName,e]):Object.entries(s);for(let[t,n]of e){if(!t||t in o||!n?.required)continue;if(n.defaultValue!==void 0&&n.defaultValue!==null){o[t]=n.defaultValue;continue}let e=n.type;if(e===`select`||e===`picklist`||e===`status`){let e=(n.options||n.choices||[])[0];e!==void 0&&(o[t]=typeof e==`object`?e.value??e.id:e)}else e===`boolean`||e===`checkbox`?o[t]=!1:(e===`number`||e===`integer`||e===`decimal`||e===`currency`||e===`percent`)&&(o[t]=0)}}try{let n=await t.create(e.objectName,o),r=(n&&(n.record||n.data||n))??null;r&&(r.id!==void 0||r._id!==void 0)&&S(e=>[...e,r]),$(null)}catch(e){let t=e?.message||String(e);$(e=>e&&{...e,submitting:!1,error:t}),console.error(`[ObjectCalendar] Quick-create failed:`,e)}},[Q,G,e.objectName,t,j]);return w?(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading calendar...`})})}):E?(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,E.message]})})}):G?(0,P.jsxs)(`div`,{ref:ae,className:n,children:[U>0&&(0,P.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:U},children:oe?`Refreshing…`:`Pull to refresh`}),(0,P.jsx)(`div`,{className:`bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]`,children:(0,P.jsx)(H,{events:J,currentDate:F,view:R,locale:_,onEventClick:e=>{Z.handleClick(e.data),X||s?.(e.data)},onDateClick:e=>{u?u(e):de(e)},onNavigate:e=>{ie(e),f?.(e)},onViewChange:e=>{z(e),p?.(e)},onAddClick:void 0,onEventDrop:(e,t,n)=>{h?h(e.data,t,n):ue(e.data,t,n)},onTimeRangeSelect:fe})}),(0,P.jsx)(g,{open:!!Q,onOpenChange:e=>{e||$(null)},children:(0,P.jsxs)(b,{className:`sm:max-w-md`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(m,{children:`New event`}),(0,P.jsx)(te,{children:Q&&(()=>{let e=Q.end&&Q.end.getTime()!==Q.start.getTime(),t=Q.start.toLocaleDateString(_,{year:`numeric`,month:`long`,day:`numeric`});if(e){let e=e=>e.toLocaleTimeString(_,{hour:`numeric`,minute:`2-digit`});return(0,P.jsxs)(P.Fragment,{children:[t,` · `,e(Q.start),` – `,e(Q.end)]})}return(0,P.jsxs)(P.Fragment,{children:[`On `,t]})})()})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(A,{htmlFor:`quick-create-title`,children:`Title`}),(0,P.jsx)(k,{id:`quick-create-title`,autoFocus:!0,value:Q?.title??``,onChange:e=>$(t=>t&&{...t,title:e.target.value,error:void 0}),onKeyDown:e=>{e.key===`Enter`&&!Q?.submitting&&(e.preventDefault(),pe())},placeholder:`What's this event about?`,disabled:Q?.submitting}),Q?.error&&(0,P.jsx)(`p`,{className:`text-sm text-destructive`,children:Q.error})]}),(0,P.jsxs)(d,{children:[(0,P.jsx)(D,{variant:`outline`,onClick:()=>$(null),disabled:Q?.submitting,children:`Cancel`}),(0,P.jsx)(D,{onClick:()=>void pe(),disabled:Q?.submitting||!Q?.title.trim(),children:Q?.submitting?`Creating…`:`Create`})]})]})}),Z.isOverlay&&Z.isOpen&&Z.selectedRecord&&(()=>{let n=W?.provider===`object`?W.object:e.objectName,r=Z.selectedRecord,i=r.id??r._id;if(!n||i==null)return null;let a=G?.titleField?String(r[G.titleField]??`Event Details`):`Event Details`;return(0,P.jsx)(ne,{open:!0,onClose:Z.close,title:a,record:r,objectName:n,recordId:i,dataSource:t,objectSchema:j,width:Z.width??`min(960px, 60vw)`,fullPageHref:M(n,i)??void 0,onFieldSave:async(e,r)=>{t?.update&&(await t.update(n,String(i),{[e]:r}),S(t=>t.map(t=>String(t.id??t._id)===String(i)?{...t,[e]:r}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(n,String(i)),S(e=>e.filter(e=>String(e.id??e._id)!==String(i))))}})})()]}):(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsx)(`div`,{className:`text-muted-foreground`,children:`Calendar configuration required. Please specify startDateField and titleField.`})})})};s.register(`calendar-view`,({schema:e,className:t,onAction:n,...r})=>{let i=N.useMemo(()=>!e.data||!Array.isArray(e.data)?[]:e.data.map((t,n)=>{let r=e.titleField||`title`,i=e.startDateField||`start`,a=e.endDateField||`end`,o=e.colorField||`color`,s=e.allDayField||`allDay`;return{id:t.id||t._id||n,title:t[r]||`Untitled Event`,start:new Date(t[i]),end:t[a]?new Date(t[a]):void 0,allDay:t[s],color:t[o],data:t}}),[e.data,e.titleField,e.startDateField,e.endDateField,e.colorField,e.allDayField]);return(0,P.jsx)(H,{className:t,events:i,onEventClick:e=>{n?.({type:`event-click`,payload:e})},...r})},{namespace:`plugin-calendar`,label:`Calendar View`,inputs:[{name:`data`,type:`array`,label:`Data`,description:`Array of record objects to display as events`},{name:`titleField`,type:`string`,label:`Title Field`,defaultValue:`title`,description:`Field name to use for event title`},{name:`startDateField`,type:`string`,label:`Start Date Field`,defaultValue:`start`,description:`Field name for event start date`},{name:`endDateField`,type:`string`,label:`End Date Field`,defaultValue:`end`,description:`Field name for event end date (optional)`},{name:`allDayField`,type:`string`,label:`All Day Field`,defaultValue:`allDay`,description:`Field name for all-day flag`},{name:`colorField`,type:`string`,label:`Color Field`,defaultValue:`color`,description:`Field name for event color`},{name:`colorMapping`,type:`object`,label:`Color Mapping`,description:`Map field values to colors (e.g., {meeting: "blue", deadline: "red"})`},{name:`view`,type:`enum`,enum:[`month`,`week`,`day`],defaultValue:`month`,label:`View Mode`,description:`Calendar view mode (month, week, or day)`},{name:`currentDate`,type:`string`,label:`Current Date`,description:`ISO date string for initial calendar date`},{name:`allowCreate`,type:`boolean`,label:`Allow Create`,defaultValue:!1,description:`Allow creating events by clicking on dates`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{view:`month`,titleField:`title`,startDateField:`start`,endDateField:`end`,allDayField:`allDay`,colorField:`color`,allowCreate:!1,data:[{id:1,title:`Team Meeting`,start:new Date(new Date().setHours(10,0,0,0)).toISOString(),end:new Date(new Date().setHours(11,0,0,0)).toISOString(),color:`#3b82f6`,allDay:!1},{id:2,title:`Project Deadline`,start:new Date(new Date().setDate(new Date().getDate()+3)).toISOString(),color:`#ef4444`,allDay:!0},{id:3,title:`Conference`,start:new Date(new Date().setDate(new Date().getDate()+7)).toISOString(),end:new Date(new Date().setDate(new Date().getDate()+9)).toISOString(),color:`#10b981`,allDay:!0}],className:`h-[600px] border rounded-lg`}});var ue=t({CalendarView:()=>H,ObjectCalendar:()=>Z,ObjectCalendarRenderer:()=>Q}),Q=({schema:e,...t})=>{let{dataSource:n}=a()||{};return(0,P.jsx)(Z,{schema:e,dataSource:n,...t})};s.register(`object-calendar`,Q,{namespace:`plugin-calendar`,label:`Object Calendar`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]}),s.register(`calendar`,Q,{namespace:`view`,label:`Calendar View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]});export{ue as t};
1
+ import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,t as r}from"./vendor-react-DR370ovB.js";import{F as i,G as a,lt as o,mt as s,r as c,ut as l}from"./framework-CVigpa4L.js";import{$t as u,Bn as d,Bt as f,Hi as p,Hn as m,Ht as h,Ln as g,Ns as _,Nt as v,Qn as y,Rn as b,Ss as x,Ut as S,Vn as C,Vt as w,Wt as T,en as E,hr as D,lc as O,nn as k,on as A,tn as j,xs as ee,zn as te}from"./ui-components-BK0FqwOC.js";import{a as M,i as ne}from"./plugins-views-BP1sk9hy.js";import{a as re}from"./plugin-grid-BsA9XQ8Q.js";var N=e(n(),1),P=r(),F=`bg-blue-100 text-blue-900 border border-blue-200`,ie=new Date,I=[`bg-blue-100 text-blue-900 border border-blue-200`,`bg-emerald-100 text-emerald-900 border border-emerald-200`,`bg-amber-100 text-amber-900 border border-amber-200`,`bg-rose-100 text-rose-900 border border-rose-200`,`bg-violet-100 text-violet-900 border border-violet-200`,`bg-cyan-100 text-cyan-900 border border-cyan-200`,`bg-orange-100 text-orange-900 border border-orange-200`,`bg-fuchsia-100 text-fuchsia-900 border border-fuchsia-200`],L=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,R=/(^|\s)(bg|text|from|to|via)-/;function z(e){if(!e)return{className:F};if(L.test(e))return{className:`text-white`,inlineColor:e};if(R.test(e))return{className:e};let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return{className:I[Math.abs(t)%I.length]}}var B={"calendar.today":`Today`,"calendar.month":`Month`,"calendar.week":`Week`,"calendar.day":`Day`,"calendar.newEvent":`New event`,"calendar.moreEvents":`+{{count}} more`,"calendar.allDay":`all-day`};function V(){try{let e=c();return e.t(`calendar.today`)===`calendar.today`?{t:(e,t)=>{let n=B[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}:{t:e.t,language:e.language}}catch{return{t:(e,t)=>{let n=B[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}}}function H({events:e=[],view:t=`month`,currentDate:n=ie,locale:r=`default`,onEventClick:i,onDateClick:a,onViewChange:o,onNavigate:s,onAddClick:c,onEventDrop:l,onTimeRangeSelect:d,slotMinutes:m=30,className:g}){let[v,b]=N.useState(t),[C,k]=N.useState(n),{t:A,language:te}=V(),M=r==="default"?te:r;N.useEffect(()=>{k(n)},[n]),N.useEffect(()=>{b(t)},[t]);let ne=N.useRef(o);ne.current=o,N.useEffect(()=>{let e=window.matchMedia(`(max-width: 639px)`),t=e=>{e.matches&&(b(`day`),ne.current?.(`day`))};return t(e),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let re=()=>{let e=new Date(C);v===`month`?e.setMonth(e.getMonth()-1):v===`week`?e.setDate(e.getDate()-7):e.setDate(e.getDate()-1),k(e),s?.(e)},F=()=>{let e=new Date(C);v===`month`?e.setMonth(e.getMonth()+1):v===`week`?e.setDate(e.getDate()+7):e.setDate(e.getDate()+1),k(e),s?.(e)},I=()=>{let e=new Date;k(e),s?.(e)},L=e=>{b(e),o?.(e)},R=()=>{if(v===`month`)return C.toLocaleDateString(M,{month:`long`,year:`numeric`});if(v===`week`){let e=ae(C),t=new Date(e);return t.setDate(t.getDate()+6),`${e.toLocaleDateString(M,{month:`short`,day:`numeric`})} - ${t.toLocaleDateString(M,{month:`short`,day:`numeric`,year:`numeric`})}`}else return C.toLocaleDateString(M,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})},z=N.useRef(0);return(0,P.jsxs)(`div`,{role:`region`,"aria-label":`Calendar`,className:O(`flex flex-col h-full bg-background min-w-0 overflow-hidden`,g),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 p-2 sm:p-4 border-b min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center bg-muted/50 rounded-lg p-1 gap-1`,children:[(0,P.jsx)(D,{variant:`ghost`,size:`sm`,onClick:I,className:`h-8`,"aria-label":`Go to today`,children:A(`calendar.today`)}),(0,P.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Previous period`,onClick:re,className:`h-8 w-8`,children:(0,P.jsx)(x,{className:`h-4 w-4`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Next period`,onClick:F,className:`h-8 w-8`,children:(0,P.jsx)(ee,{className:`h-4 w-4`})})]}),(0,P.jsxs)(u,{children:[(0,P.jsx)(j,{asChild:!0,children:(0,P.jsxs)(D,{variant:`ghost`,"aria-label":`Current date: ${R()}`,className:O(`text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors`,`flex items-center gap-2`),children:[(0,P.jsx)(_,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsx)(`span`,{children:R()})]})}),(0,P.jsx)(E,{className:`w-auto p-0`,align:`start`,children:(0,P.jsx)(y,{mode:`single`,selected:C,onSelect:e=>{e&&(k(e),s?.(e))},autoFocus:!0,startMonth:new Date(2e3,0),endMonth:new Date(2050,11)})})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(f,{value:v,onValueChange:L,children:[(0,P.jsx)(S,{className:`w-32 bg-background`,children:(0,P.jsx)(T,{})}),(0,P.jsxs)(w,{children:[(0,P.jsx)(h,{value:`day`,children:A(`calendar.day`)}),(0,P.jsx)(h,{value:`week`,children:A(`calendar.week`)}),(0,P.jsx)(h,{value:`month`,children:A(`calendar.month`)})]})]}),c&&(0,P.jsxs)(D,{onClick:c,size:`sm`,className:`gap-1`,children:[(0,P.jsx)(p,{className:`h-4 w-4`}),A(`calendar.newEvent`)]})]})]}),(0,P.jsxs)(`div`,{className:`flex-1 overflow-auto`,onTouchStart:e=>{z.current=e.touches[0].clientX},onTouchEnd:e=>{let t=z.current-e.changedTouches[0].clientX;if(Math.abs(t)>50){let e=new Date(C);v===`day`?e.setDate(e.getDate()+(t>0?1:-1)):v===`week`?e.setDate(e.getDate()+(t>0?7:-7)):e.setMonth(e.getMonth()+(t>0?1:-1)),k(e),s?.(e)}},children:[v===`month`&&(0,P.jsx)(W,{date:C,events:e,locale:M,onEventClick:i,onDateClick:a,onEventDrop:l}),v===`week`&&(0,P.jsx)(Y,{mode:`week`,date:C,events:e,locale:M,slotMinutes:m,onEventClick:i,onEventDrop:l,onTimeRangeSelect:d}),v===`day`&&(0,P.jsx)(Y,{mode:`day`,date:C,events:e,locale:M,slotMinutes:m,onEventClick:i,onEventDrop:l,onTimeRangeSelect:d})]})]})}function ae(e){let t=new Date(e),n=t.getDay(),r=t.getDate()-n;return t.setDate(r),t}function oe(e){let t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n,1),i=new Date(t,n+1,0),a=r.getDay(),o=[];for(let e=a-1;e>=0;e--){let t=new Date(r.getTime());t.setDate(t.getDate()-(e+1)),o.push(t)}for(let e=1;e<=i.getDate();e++)o.push(new Date(t,n,e));let s=42-o.length;for(let e=1;e<=s;e++){let t=new Date(i.getTime());t.setDate(t.getDate()+e),o.push(t)}return o}function U(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function W({date:e,events:t,locale:n=`default`,onEventClick:r,onDateClick:i,onEventDrop:a}){let o=N.useMemo(()=>oe(e),[e.getFullYear(),e.getMonth()]),s=N.useMemo(()=>new Date,[]),{t:c}=V(),l=N.useMemo(()=>{let e=new Date(2024,0,7);return Array.from({length:7},(t,r)=>{let i=new Date(e);return i.setDate(i.getDate()+r),i.toLocaleDateString(n,{weekday:`short`})})},[n]),[u,d]=N.useState(null),[f,p]=N.useState(null),m=N.useMemo(()=>{let e=new Map;for(let n of t){let t=new Date(n.start),r=n.end?new Date(n.end):new Date(t);t.setHours(0,0,0,0),r.setHours(0,0,0,0);let i=new Date(t);for(;i<=r;){let a=`${i.getFullYear()}-${i.getMonth()}-${i.getDate()}`,o=i.getTime()===t.getTime(),s=i.getTime()===r.getTime(),c=o||s||i.getDay()===0,l=e.get(a),u={event:n,isTitleDay:c,isSpanStart:o,isSpanEnd:s};l?l.push(u):e.set(a,[u]),i.setDate(i.getDate()+1)}}return e},[t]),h=(e,t,n=`move`,r)=>{d(t.id),e.dataTransfer.effectAllowed=`move`;let i={id:t.id,mode:n,...r?{sourceDay:`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`}:{}};e.dataTransfer.setData(`text/plain`,JSON.stringify(i)),n===`resize-end`&&e.stopPropagation()},g=()=>{d(null),p(null)},_=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,p(t)},v=e=>{e.currentTarget.contains(e.relatedTarget)||p(null)},y=(e,n)=>{if(e.preventDefault(),p(null),d(null),!a)return;let r=e.dataTransfer.getData(`text/plain`),i;try{i=JSON.parse(r)}catch{i={id:r,mode:`move`}}let o=t.find(e=>String(e.id)===String(i.id));if(!o)return;let s=new Date(n);if(s.setHours(0,0,0,0),i.mode===`resize-end`){let e=o.end?new Date(o.end):new Date(o.start),t=new Date(e);if(t.setHours(0,0,0,0),s.getTime()===t.getTime())return;let n=new Date(o.start);if(n.setHours(0,0,0,0),s.getTime()<n.getTime())return;let r=new Date(s);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0),a(o,new Date(o.start),r);return}let c=new Date(o.start),l;if(i.sourceDay){let[e,t,n]=i.sourceDay.split(`-`).map(e=>parseInt(e,10));l=new Date(e,t,n)}else l=new Date(c);l.setHours(0,0,0,0);let u=s.getTime()-l.getTime();if(u===0)return;let f=new Date(c.getTime()+u),m;o.end&&(m=new Date(new Date(o.end).getTime()+u)),a(o,f,m)};return(0,P.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,P.jsx)(`div`,{role:`row`,className:`grid grid-cols-7 border-b`,children:l.map(e=>(0,P.jsx)(`div`,{role:`columnheader`,className:`p-2 text-center text-sm font-medium text-muted-foreground border-r last:border-r-0`,children:e},e))}),(0,P.jsx)(`div`,{role:`grid`,"aria-label":`Calendar grid`,className:`grid grid-cols-7 flex-1 auto-rows-fr`,children:o.map((t,n)=>{let o=`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`,l=m.get(o)||[],d=t.getMonth()===e.getMonth(),p=U(t,s);return(0,P.jsxs)(`div`,{role:`gridcell`,"aria-label":`${t.toLocaleDateString(`default`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}${l.length>0?`, ${l.length} event${l.length>1?`s`:``}`:``}`,className:O(`border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50`,!d&&`bg-muted/50 text-muted-foreground opacity-50`,f===n&&`ring-2 ring-primary`),onClick:()=>i?.(t),onDragOver:e=>_(e,n),onDragLeave:v,onDrop:e=>y(e,t),children:[(0,P.jsx)(`div`,{className:O(`text-sm font-medium mb-2`,p&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6`),...p?{"aria-current":`date`}:{},children:t.getDate()}),(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[l.slice(0,4).map(({event:e,isTitleDay:n,isSpanStart:i,isSpanEnd:o},s)=>{let c=!n,{className:l,inlineColor:d}=z(e.color),f=!!a&&o;return(0,P.jsxs)(`div`,{role:`button`,title:e.title,"aria-label":e.title,draggable:!!a,onDragStart:n=>h(n,e,`move`,t),onDragEnd:g,className:O(`relative text-xs hover:opacity-80 truncate`,a?`cursor-move`:`cursor-pointer`,c?`h-1.5`:`px-2 py-0.5`,i?`rounded-l`:`rounded-l-none`,o?`rounded-r`:`rounded-r-none`,!o&&`-mr-2`,l,u===e.id&&`opacity-50`),style:d?{backgroundColor:d}:void 0,onClick:t=>{t.stopPropagation(),r?.(e)},children:[c?``:e.title,f&&(0,P.jsx)(`span`,{role:`separator`,"aria-label":`Resize event end`,title:`Drag to change end date`,draggable:!0,onDragStart:n=>h(n,e,`resize-end`,t),onDragEnd:g,onClick:e=>e.stopPropagation(),className:`absolute inset-y-0 right-0 w-2 cursor-ew-resize bg-black/25 hover:bg-black/50 rounded-r`})]},`${e.id}-${s}`)}),l.length>4&&(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground px-2`,children:c(`calendar.moreEvents`,{count:l.length-4})})]})]},n)})})]})}var G=48;function K(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function q(e){return e.getHours()*60+e.getMinutes()}function J(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function Y({mode:e,date:t,events:n,locale:r=`default`,slotMinutes:i=30,onEventClick:a,onEventDrop:o,onTimeRangeSelect:s}){let{t:c}=V(),l=G*i/60,u=G*24,d=N.useMemo(()=>{if(e===`day`)return[K(t)];let n=ae(t);return Array.from({length:7},(e,t)=>{let r=new Date(n);return r.setDate(n.getDate()+t),K(r)})},[e,t.getFullYear(),t.getMonth(),t.getDate()]),f=N.useMemo(()=>new Date,[]),p=N.useCallback(e=>{if(e.allDay)return!0;let t=new Date(e.start),n=e.end?new Date(e.end):new Date(t),r=t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0,i=n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0,a=n.getTime()-t.getTime();return!!(r&&i||a>=1440*60*1e3)},[]),{allDayEvents:m,timedEvents:h}=N.useMemo(()=>{let e=[],t=[];for(let r of n)p(r)?e.push(r):t.push(r);return{allDayEvents:e,timedEvents:t}},[n,p]),g=N.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of m){let n=K(new Date(t.start)),r=t.end?new Date(t.end):new Date(t.start),i=K(r);r.getHours()===0&&r.getMinutes()===0&&r.getSeconds()===0&&r.getTime()>n.getTime()&&(i=new Date(i),i.setDate(i.getDate()-1));for(let r of d){let a=K(r);a<n||a>i||e.get(J(r)).push({event:t,isStart:a.getTime()===n.getTime(),isEnd:a.getTime()===i.getTime()})}}return e},[d,m]),_=N.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of h){let n=new Date(t.start),r=t.end?new Date(t.end):new Date(n.getTime()+3600*1e3);for(let i of d){let a=K(i),o=new Date(a);if(o.setDate(o.getDate()+1),r<=a||n>=o)continue;let s=n<a?a:n,c=r>o?o:r,l=q(s),u=c.getTime()===o.getTime()?1440:q(c);e.get(J(i)).push({event:t,startMin:l,endMin:Math.max(u,l+15),isStart:s.getTime()===n.getTime(),isEnd:c.getTime()===r.getTime()})}}return e},[d,h]),v=N.useMemo(()=>{let e=new Map;for(let[t,n]of _){let r=[...n].sort((e,t)=>e.startMin-t.startMin||e.endMin-t.endMin),i=[],a=[],o=[];for(let e of r){let t=0;for(;i[t]&&i[t].endMin>e.startMin;)t++;i[t]={endMin:e.endMin},a.push({entry:e,col:t})}for(let e=0;e<a.length;e++){let t=a[e],n=t.col;for(let r=0;r<a.length;r++){if(r===e)continue;let i=a[r];i.entry.startMin<t.entry.endMin&&i.entry.endMin>t.entry.startMin&&i.col>n&&(n=i.col)}o.push({...t.entry,col:t.col,cols:n+1})}e.set(t,o)}return e},[_]),y=N.useRef(null),b=N.useRef([]),[x,S]=N.useState(null),C=N.useRef(null);C.current=x;let w=N.useRef(!1),T=N.useCallback((e,t)=>{let n=b.current[t];if(!n)return 0;let r=(e-n.getBoundingClientRect().top+n.scrollTop)/G*60,a=Math.round(r/i)*i;return Math.max(0,Math.min(1440,a))},[i]),E=N.useCallback(e=>{for(let t=0;t<b.current.length;t++){let n=b.current[t];if(!n)continue;let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right)return t}return-1},[]);N.useEffect(()=>{if(!x)return;let e=e=>{let t=x.kind===`select`||x.kind===`move`?E(e.clientX):x.dayIndex,n=t<0?x.dayIndex??0:t,r=T(e.clientY,n);S(e=>e&&(e.kind===`select`?{...e,dayIndex:n>=0?n:e.dayIndex,headMinutes:r}:e.kind===`move`?{...e,dayIndex:n,minutes:r}:{...e,minutes:r}))},t=e=>{let t=C.current;if(!t){S(null);return}try{if(t.kind===`select`&&s){let e=Math.min(t.anchorMinutes,t.headMinutes),n=Math.max(t.anchorMinutes,t.headMinutes),r=e,a=n===e?Math.min(1440,e+i):n,o=d[t.dayIndex]??d[0],c=new Date(o);c.setHours(0,Math.round(r),0,0);let l=new Date(o);l.setHours(0,Math.round(a),0,0),w.current=!0,s(c,l)}else if(t.kind===`move`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=t.dayIndex<0?0:t.dayIndex,r=t.minutes-t.grabMinuteOffset,a=Math.max(0,Math.min(1440-t.durationMin,Math.round(r/i)*i)),s=d[n]??d[0],c=new Date(s);c.setHours(0,a,0,0);let l=new Date(c.getTime()+t.durationMin*60*1e3);w.current=!0,o(e,c,l)}}else if(t.kind===`resize-top`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.min(t.anchorEndMin-i,Math.max(0,t.minutes)),a=new Date(n);a.setHours(0,r,0,0);let s=new Date(n);s.setHours(0,t.anchorEndMin,0,0),w.current=!0,o(e,a,s)}}else if(t.kind===`resize-bottom`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.max(t.anchorStartMin+i,Math.min(1440,t.minutes)),a=new Date(n);a.setHours(0,t.anchorStartMin,0,0);let s=new Date(n);s.setHours(0,r,0,0),w.current=!0,o(e,a,s)}}}finally{S(null),setTimeout(()=>{w.current=!1},50)}};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[x,d,n,i,o,s,E,T]);let D=N.useMemo(()=>d.map(e=>({weekday:e.toLocaleDateString(r,{weekday:`short`}),day:e.getDate(),month:e.toLocaleDateString(r,{month:`short`}),isToday:U(e,f)})),[d,r,f]),k=N.useMemo(()=>Array.from({length:24},(e,t)=>new Date(2024,0,1,t,0).toLocaleTimeString(r,{hour:`numeric`})),[r]),A=(e,t,n,r)=>{if(!o||e.button!==0)return;e.stopPropagation(),e.preventDefault();let i=T(e.clientY,n);S(r===`body`?{kind:`move`,eventId:t.event.id,grabMinuteOffset:Math.max(0,i-t.startMin),durationMin:t.endMin-t.startMin,dayIndex:n,minutes:i}:r===`top`?{kind:`resize-top`,eventId:t.event.id,anchorEndMin:t.endMin,dayIndex:n,minutes:i}:{kind:`resize-bottom`,eventId:t.event.id,anchorStartMin:t.startMin,dayIndex:n,minutes:i})},j=(e,t)=>{if(!s||e.button!==0)return;e.preventDefault();let n=T(e.clientY,t);S({kind:`select`,dayIndex:t,anchorMinutes:n,headMinutes:n})},ee=e=>{if(!x)return null;if(x.kind===`select`&&x.dayIndex===e){let t=Math.min(x.anchorMinutes,x.headMinutes),n=Math.max(x.anchorMinutes,x.headMinutes);return(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded bg-primary/30 border border-primary pointer-events-none z-10`,style:{top:t/60*G,height:Math.max(l,(n-t)/60*G)},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],t,n,r)})})}if(x.kind===`move`&&x.dayIndex===e){let t=x.minutes-x.grabMinuteOffset,n=Math.max(0,Math.min(1440-x.durationMin,Math.round(t/i)*i));return(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:n/60*G,height:x.durationMin/60*G},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],n,n+x.durationMin,r)})})}if((x.kind===`resize-top`||x.kind===`resize-bottom`)&&x.dayIndex===e){let t,n;return x.kind===`resize-top`?(t=Math.min(x.anchorEndMin-i,Math.max(0,x.minutes)),n=x.anchorEndMin):(t=x.anchorStartMin,n=Math.max(x.anchorStartMin+i,Math.min(1440,x.minutes))),(0,P.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:t/60*G,height:(n-t)/60*G},"aria-hidden":!0,children:(0,P.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:X(d[e],t,n,r)})})}return null};return(0,P.jsxs)(`div`,{className:`flex flex-col h-full`,ref:y,children:[(0,P.jsxs)(`div`,{className:`flex border-b sticky top-0 bg-background z-20`,children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r`,"aria-hidden":!0}),D.map((e,t)=>(0,P.jsxs)(`div`,{role:`columnheader`,className:O(`flex-1 p-2 text-center text-sm border-r last:border-r-0`,e.isToday&&`bg-primary/5`),children:[(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.weekday}),(0,P.jsx)(`div`,{className:O(`font-medium`,e.isToday&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6 mx-auto`),children:e.day})]},t))]}),m.length>0&&(0,P.jsxs)(`div`,{className:`flex border-b bg-muted/20 max-h-[140px] overflow-y-auto`,children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r flex items-start justify-end pr-1 pt-1 text-[10px] text-muted-foreground sticky left-0 bg-muted/20`,children:c(`calendar.allDay`)===`calendar.allDay`?`all-day`:c(`calendar.allDay`)}),d.map(e=>{let t=J(e);return(0,P.jsx)(`div`,{className:`flex-1 border-r last:border-r-0 min-h-[28px] p-0.5 space-y-0.5`,children:(g.get(t)??[]).map(({event:e,isStart:t,isEnd:n},r)=>{let{className:i,inlineColor:o}=z(e.color);return(0,P.jsx)(`div`,{role:`button`,title:e.title,onClick:t=>{t.stopPropagation(),a?.(e)},className:O(`text-[11px] px-2 py-0.5 truncate cursor-pointer hover:opacity-80`,t?`rounded-l`:`rounded-l-none -ml-0.5`,n?`rounded-r`:`rounded-r-none -mr-0.5`,i),style:o?{backgroundColor:o}:void 0,children:t?e.title:`\xA0`},`${e.id}-${r}`)})},t)})]}),(0,P.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,P.jsxs)(`div`,{className:`flex`,style:{height:u},children:[(0,P.jsx)(`div`,{className:`w-14 shrink-0 border-r relative`,children:k.map((e,t)=>(0,P.jsx)(`div`,{className:`absolute right-1 text-[10px] text-muted-foreground -translate-y-1/2`,style:{top:t*G},children:t===0?``:e},t))}),d.map((e,t)=>{let n=J(e),s=v.get(n)??[];return(0,P.jsxs)(`div`,{ref:e=>{b.current[t]=e},className:`flex-1 border-r last:border-r-0 relative select-none`,style:{height:u},onPointerDown:e=>j(e,t),"aria-label":e.toLocaleDateString(r,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}),children:[Array.from({length:24},(e,t)=>(0,P.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-muted/60 pointer-events-none`,style:{top:t*G}},t)),i<60&&Array.from({length:Math.floor(1440/i)},(e,t)=>{let n=t*i;return n%60==0?null:(0,P.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-dashed border-muted/30 pointer-events-none`,style:{top:n/60*G}},t)}),s.map(n=>{let i=n.startMin/60*G,s=Math.max(l,(n.endMin-n.startMin)/60*G),c=100/n.cols,u=n.col*c,{className:d,inlineColor:f}=z(n.event.color),p=x&&x.eventId===n.event.id;return(0,P.jsxs)(`div`,{role:`button`,tabIndex:0,title:n.event.title,"aria-label":n.event.title,onPointerDown:e=>A(e,n,t,`body`),onClick:e=>{if(w.current){e.stopPropagation();return}e.stopPropagation(),a?.(n.event)},className:O(`absolute rounded text-xs px-2 py-1 overflow-hidden shadow-sm`,o?`cursor-move`:`cursor-pointer`,d,p&&`opacity-40`),style:{top:i,height:s,left:`calc(${u}% + 2px)`,width:`calc(${c}% - 4px)`,...f?{backgroundColor:f}:{}},children:[(0,P.jsx)(`div`,{className:`font-medium truncate`,children:n.event.title}),(0,P.jsx)(`div`,{className:`text-[10px] opacity-80 truncate`,children:X(e,n.startMin,n.endMin,r)}),o&&n.isStart&&(0,P.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`top`),className:`absolute top-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize start`}),o&&n.isEnd&&(0,P.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`bottom`),className:`absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize end`})]},`${n.event.id}-${n.startMin}`)}),ee(t)]},n)})]})})]})}function X(e,t,n,r){let i=new Date(e);i.setHours(0,Math.round(t),0,0);let a=new Date(e);a.setHours(0,Math.round(n),0,0);let o=e=>e.toLocaleTimeString(r,{hour:`numeric`,minute:`2-digit`});return`${o(i)} – ${o(a)}`}function se(e){return`data`in e&&e.data?e.data:`staticData`in e&&e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function ce(e){if(e){if(typeof e==`string`){let t=e.split(` `),n=t[0],r=t[1]?.toLowerCase()===`desc`?`desc`:`asc`;return{[n]:r}}if(Array.isArray(e))return e.reduce((e,t)=>(t.field&&t.order&&(e[t.field]=t.order),e),{})}}function le(e){return`filter`in e&&e.filter&&typeof e.filter==`object`&&`calendar`in e.filter?e.filter.calendar:e.calendar?e.calendar:e.startDateField||e.dateField?{startDateField:e.startDateField||e.dateField,endDateField:e.endDateField||e.endField,titleField:e.titleField,colorField:e.colorField,allDayField:e.allDayField}:null}var Z=({schema:e,dataSource:t,className:n,data:r,loading:a,onEventClick:s,onRowClick:c,onDateClick:u,onNavigate:f,onViewChange:p,onEventDrop:h,locale:_})=>{let y=Array.isArray(r),[x,S]=(0,N.useState)(y?r:[]),[w,T]=(0,N.useState)(y?a??!1:!0),[E,O]=(0,N.useState)(null),[j,ee]=(0,N.useState)(null),[F,ie]=(0,N.useState)(new Date),I=v(),L=e.defaultView,[R,z]=(0,N.useState)(()=>{let e=L===`day`||!L;return typeof window<`u`&&window.innerWidth<768&&e?`month`:L||`month`});(0,N.useEffect)(()=>{I&&R===`day`&&(L===`day`||!L)&&z(`month`)},[I]);let[B,V]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!y&&!(!t?.onMutation||!e.objectName))return t.onMutation(t=>{t.resource===e.objectName&&V(e=>e+1)})},[t,e.objectName,y]);let{ref:ae,isRefreshing:oe,pullDistance:U}=re({onRefresh:(0,N.useCallback)(async()=>{V(e=>e+1)},[]),enabled:!!t&&!!e.objectName}),W=(0,N.useMemo)(()=>se(e),[e.data,e.staticData,e.objectName]),G=(0,N.useMemo)(()=>le(e),[e.filter,e.calendar,e.dateField,e.endField,e.titleField,e.colorField]),K=W?.provider===`value`,q=(0,N.useRef)(null);q.current=j,(0,N.useEffect)(()=>{y&&S(r)},[r,y]),(0,N.useEffect)(()=>{y&&a!==void 0&&T(a)},[a,y]),(0,N.useEffect)(()=>{if(y)return;let n=!0;return(async()=>{try{if(!n)return;if(T(!0),K&&W?.provider===`value`){n&&(S(W.items),T(!1));return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(W?.provider===`object`){let r=W.object,i=o(q.current?.fields),a=l(await t.find(r,{$filter:e.filter,$orderby:ce(e.sort),...i.length>0?{$expand:i}:{}}));n&&S(a)}else W?.provider===`api`&&(console.warn(`API provider not yet implemented for ObjectCalendar`),n&&S([]));n&&T(!1)}catch(e){console.error(`[ObjectCalendar] Error fetching data:`,e),n&&(O(e),T(!1))}})(),()=>{n=!1}},[y,W,t,K,e.filter,e.sort,B]),(0,N.useEffect)(()=>{!K&&t&&(async()=>{try{if(!t)return;let n=W?.provider===`object`?W.object:e.objectName;if(!n)return;ee(await t.getObjectSchema(n))}catch(e){console.error(`Failed to fetch object schema:`,e)}})()},[e.objectName,t,K,W]);let J=(0,N.useMemo)(()=>{if(!G||!x.length)return[];let{startDateField:e,endDateField:t,titleField:n,colorField:r}=G,i=j?.titleFormat,a=typeof i==`string`?i:i&&typeof i==`object`&&typeof i.source==`string`?i.source:void 0,o=j?.NAME_FIELD_KEY,s=[`name`,`full_name`,`fullName`,`title`,`subject`,`label`,`display_name`,`displayName`],c=(e,t)=>{let n=`[-\\u2013\\u2014|/·,:]`,r=!1,i=e.replace(/\{([^{}]+)\}/g,(e,n)=>{let i=t[n.trim()];return i!=null&&i!==``?(r=!0,String(i)):`\0`});return r?i.replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\0`,`g`),``).replace(/\s+/g,` `).trim():``},l=e=>{let t;if(n&&(t=e[n],typeof t==`string`&&(t=t.trim())),!t&&a){let n=c(a,e);n&&(t=n)}if(!t&&o){let n=e[o];typeof n==`string`?t=n.trim():n&&(t=n)}if(!t)for(let n of s){let r=e[n],i=typeof r==`string`?r.trim():r;if(i){t=i;break}}return t||`Untitled`};return x.map((n,i)=>{let a=n[e],o=t?n[t]:null,s=l(n),c=r?n[r]:void 0;return{id:n.id||n._id||`event-${i}`,title:s,start:a?new Date(a):new Date,end:o?new Date(o):void 0,color:c,allDay:!o,data:n}}).filter(e=>!isNaN(e.start.getTime()))},[x,G,j]);(0,N.useCallback)(()=>{u?.(new Date)},[u]);let Y=e.navigation??{mode:`drawer`,width:`min(960px, 60vw)`},X=Y.mode===`drawer`||Y.mode===`modal`||Y.mode===`split`||Y.mode===`popover`,Z=i({navigation:Y,objectName:e.objectName,onRowClick:X?void 0:c}),ue=(0,N.useCallback)(async(n,r,i)=>{if(!G)return;let{startDateField:a,endDateField:o}=G,s=n?.id??n?._id;if(!s||!e.objectName||!t?.update)return;let c={[a]:r.toISOString()};o&&i&&(c[o]=i.toISOString());let l=x;S(e=>e.map(e=>(e?.id??e?._id)===s?{...e,...c}:e));try{await t.update(e.objectName,s,c)}catch(e){S(l),console.error(`[ObjectCalendar] Failed to persist drag-and-drop reschedule:`,e)}},[G,e.objectName,t,x]),[Q,$]=(0,N.useState)(null),de=(0,N.useCallback)(n=>{!G||!e.objectName||!t?.create||$({start:n,title:``,submitting:!1})},[G,e.objectName,t]),fe=(0,N.useCallback)((n,r)=>{!G||!e.objectName||!t?.create||$({start:n,end:r,title:``,submitting:!1})},[G,e.objectName,t]),pe=(0,N.useCallback)(async()=>{if(!Q||!G)return;let n=Q.title.trim();if(!n){$(e=>e&&{...e,error:`Title is required`});return}if(!e.objectName||!t?.create)return;$(e=>e&&{...e,submitting:!0,error:void 0});let{startDateField:r,endDateField:i,titleField:a}=G,o={[a||`name`]:n,[r]:Q.start.toISOString()};i&&(o[i]=(Q.end??Q.start).toISOString());let s=j?.fields;if(s&&typeof s==`object`){let e=Array.isArray(s)?s.map(e=>[e.name??e.apiName,e]):Object.entries(s);for(let[t,n]of e){if(!t||t in o||!n?.required)continue;if(n.defaultValue!==void 0&&n.defaultValue!==null){o[t]=n.defaultValue;continue}let e=n.type;if(e===`select`||e===`picklist`||e===`status`){let e=(n.options||n.choices||[])[0];e!==void 0&&(o[t]=typeof e==`object`?e.value??e.id:e)}else e===`boolean`||e===`checkbox`?o[t]=!1:(e===`number`||e===`integer`||e===`decimal`||e===`currency`||e===`percent`)&&(o[t]=0)}}try{let n=await t.create(e.objectName,o),r=(n&&(n.record||n.data||n))??null;r&&(r.id!==void 0||r._id!==void 0)&&S(e=>[...e,r]),$(null)}catch(e){let t=e?.message||String(e);$(e=>e&&{...e,submitting:!1,error:t}),console.error(`[ObjectCalendar] Quick-create failed:`,e)}},[Q,G,e.objectName,t,j]);return w?(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading calendar...`})})}):E?(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,E.message]})})}):G?(0,P.jsxs)(`div`,{ref:ae,className:n,children:[U>0&&(0,P.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:U},children:oe?`Refreshing…`:`Pull to refresh`}),(0,P.jsx)(`div`,{className:`bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]`,children:(0,P.jsx)(H,{events:J,currentDate:F,view:R,locale:_,onEventClick:e=>{Z.handleClick(e.data),X||s?.(e.data)},onDateClick:e=>{u?u(e):de(e)},onNavigate:e=>{ie(e),f?.(e)},onViewChange:e=>{z(e),p?.(e)},onAddClick:void 0,onEventDrop:(e,t,n)=>{h?h(e.data,t,n):ue(e.data,t,n)},onTimeRangeSelect:fe})}),(0,P.jsx)(g,{open:!!Q,onOpenChange:e=>{e||$(null)},children:(0,P.jsxs)(b,{className:`sm:max-w-md`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(m,{children:`New event`}),(0,P.jsx)(te,{children:Q&&(()=>{let e=Q.end&&Q.end.getTime()!==Q.start.getTime(),t=Q.start.toLocaleDateString(_,{year:`numeric`,month:`long`,day:`numeric`});if(e){let e=e=>e.toLocaleTimeString(_,{hour:`numeric`,minute:`2-digit`});return(0,P.jsxs)(P.Fragment,{children:[t,` · `,e(Q.start),` – `,e(Q.end)]})}return(0,P.jsxs)(P.Fragment,{children:[`On `,t]})})()})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(A,{htmlFor:`quick-create-title`,children:`Title`}),(0,P.jsx)(k,{id:`quick-create-title`,autoFocus:!0,value:Q?.title??``,onChange:e=>$(t=>t&&{...t,title:e.target.value,error:void 0}),onKeyDown:e=>{e.key===`Enter`&&!Q?.submitting&&(e.preventDefault(),pe())},placeholder:`What's this event about?`,disabled:Q?.submitting}),Q?.error&&(0,P.jsx)(`p`,{className:`text-sm text-destructive`,children:Q.error})]}),(0,P.jsxs)(d,{children:[(0,P.jsx)(D,{variant:`outline`,onClick:()=>$(null),disabled:Q?.submitting,children:`Cancel`}),(0,P.jsx)(D,{onClick:()=>void pe(),disabled:Q?.submitting||!Q?.title.trim(),children:Q?.submitting?`Creating…`:`Create`})]})]})}),Z.isOverlay&&Z.isOpen&&Z.selectedRecord&&(()=>{let n=W?.provider===`object`?W.object:e.objectName,r=Z.selectedRecord,i=r.id??r._id;if(!n||i==null)return null;let a=G?.titleField?String(r[G.titleField]??`Event Details`):`Event Details`;return(0,P.jsx)(ne,{open:!0,onClose:Z.close,title:a,record:r,objectName:n,recordId:i,dataSource:t,objectSchema:j,width:Z.width??`min(960px, 60vw)`,fullPageHref:M(n,i)??void 0,onFieldSave:async(e,r)=>{t?.update&&(await t.update(n,String(i),{[e]:r}),S(t=>t.map(t=>String(t.id??t._id)===String(i)?{...t,[e]:r}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(n,String(i)),S(e=>e.filter(e=>String(e.id??e._id)!==String(i))))}})})()]}):(0,P.jsx)(`div`,{className:n,children:(0,P.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,P.jsx)(`div`,{className:`text-muted-foreground`,children:`Calendar configuration required. Please specify startDateField and titleField.`})})})};s.register(`calendar-view`,({schema:e,className:t,onAction:n,...r})=>{let i=N.useMemo(()=>!e.data||!Array.isArray(e.data)?[]:e.data.map((t,n)=>{let r=e.titleField||`title`,i=e.startDateField||`start`,a=e.endDateField||`end`,o=e.colorField||`color`,s=e.allDayField||`allDay`;return{id:t.id||t._id||n,title:t[r]||`Untitled Event`,start:new Date(t[i]),end:t[a]?new Date(t[a]):void 0,allDay:t[s],color:t[o],data:t}}),[e.data,e.titleField,e.startDateField,e.endDateField,e.colorField,e.allDayField]);return(0,P.jsx)(H,{className:t,events:i,onEventClick:e=>{n?.({type:`event-click`,payload:e})},...r})},{namespace:`plugin-calendar`,label:`Calendar View`,inputs:[{name:`data`,type:`array`,label:`Data`,description:`Array of record objects to display as events`},{name:`titleField`,type:`string`,label:`Title Field`,defaultValue:`title`,description:`Field name to use for event title`},{name:`startDateField`,type:`string`,label:`Start Date Field`,defaultValue:`start`,description:`Field name for event start date`},{name:`endDateField`,type:`string`,label:`End Date Field`,defaultValue:`end`,description:`Field name for event end date (optional)`},{name:`allDayField`,type:`string`,label:`All Day Field`,defaultValue:`allDay`,description:`Field name for all-day flag`},{name:`colorField`,type:`string`,label:`Color Field`,defaultValue:`color`,description:`Field name for event color`},{name:`colorMapping`,type:`object`,label:`Color Mapping`,description:`Map field values to colors (e.g., {meeting: "blue", deadline: "red"})`},{name:`view`,type:`enum`,enum:[`month`,`week`,`day`],defaultValue:`month`,label:`View Mode`,description:`Calendar view mode (month, week, or day)`},{name:`currentDate`,type:`string`,label:`Current Date`,description:`ISO date string for initial calendar date`},{name:`allowCreate`,type:`boolean`,label:`Allow Create`,defaultValue:!1,description:`Allow creating events by clicking on dates`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{view:`month`,titleField:`title`,startDateField:`start`,endDateField:`end`,allDayField:`allDay`,colorField:`color`,allowCreate:!1,data:[{id:1,title:`Team Meeting`,start:new Date(new Date().setHours(10,0,0,0)).toISOString(),end:new Date(new Date().setHours(11,0,0,0)).toISOString(),color:`#3b82f6`,allDay:!1},{id:2,title:`Project Deadline`,start:new Date(new Date().setDate(new Date().getDate()+3)).toISOString(),color:`#ef4444`,allDay:!0},{id:3,title:`Conference`,start:new Date(new Date().setDate(new Date().getDate()+7)).toISOString(),end:new Date(new Date().setDate(new Date().getDate()+9)).toISOString(),color:`#10b981`,allDay:!0}],className:`h-[600px] border rounded-lg`}});var ue=t({CalendarView:()=>H,ObjectCalendar:()=>Z,ObjectCalendarRenderer:()=>Q}),Q=({schema:e,...t})=>{let{dataSource:n}=a()||{};return(0,P.jsx)(Z,{schema:e,dataSource:n,...t})};s.register(`object-calendar`,Q,{namespace:`plugin-calendar`,label:`Object Calendar`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]}),s.register(`calendar`,Q,{namespace:`view`,label:`Calendar View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]});export{ue as t};
@@ -0,0 +1,7 @@
1
+ import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,m as r,t as i}from"./vendor-react-DR370ovB.js";import{B as a,H as o,J as s,K as c,W as l,X as u,Y as d,Z as f,mt as p,q as m,ut as h}from"./framework-CVigpa4L.js";import{A as g,C as ee,D as _,E as v,F as y,I as b,L as x,M as S,N as C,O as w,P as T,R as E,S as te,T as D,_ as O,b as k,ct as A,g as j,h as M,j as N,k as P,m as F,p as I,st as L,v as ne,w as R,x as z,y as re}from"./vendor-charts-fo4ZbB_t.js";import{Ft as B,Hn as V,Ln as ie,Lt as ae,Mt as oe,N as se,Pt as ce,Rn as le,Rt as ue,Vn as de,_s as fe,fc as pe}from"./ui-components-BK0FqwOC.js";var H=e(n(),1),U=i(),W=(...e)=>e.filter(Boolean).join(` `),me={light:``,dark:`.dark`},he=H.createContext(null);function ge(){let e=H.useContext(he);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function G({id:e,className:t,children:n,config:r,...i}){let a=H.useId(),o=`chart-${e||a.replace(/:/g,``)}`;return(0,U.jsx)(he.Provider,{value:{config:r},children:(0,U.jsxs)(`div`,{"data-slot":`chart`,"data-chart":o,className:W(`block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...i.style},...i,children:[(0,U.jsx)(_e,{id:o,config:r}),(0,U.jsx)(A,{width:`100%`,height:`100%`,children:n})]})})}var _e=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(me).map(([t,r])=>`
2
+ ${r} [data-chart=${e}] {
3
+ ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
4
+ `)}
5
+ }
6
+ `).join(`
7
+ `)}}):null},K=E;function q({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=ge(),m=H.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=ve(p,e,`${f||e?.dataKey||e?.name||`value`}`),r=!f&&typeof o==`string`?p[o]?.label||o:n?.label;return s?(0,U.jsx)(`div`,{className:W(`font-medium`,c),children:s(r,t)}):r?(0,U.jsx)(`div`,{className:W(`font-medium`,c),children:r}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,U.jsxs)(`div`,{className:W(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,U.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=ve(p,e,`${d||e.name||e.dataKey||`value`}`),i=u||e.payload.fill||e.color;return(0,U.jsx)(`div`,{className:W(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,r===`dot`?`items-center`:``),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,U.jsxs)(U.Fragment,{children:[n?.icon?(0,U.jsx)(n.icon,{}):!a&&(0,U.jsx)(`div`,{className:W(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,r===`dot`?`h-2.5 w-2.5`:``,r===`line`?`w-1`:``,r===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,h&&r===`dashed`?`my-0.5`:``),style:{"--color-bg":i,"--color-border":i}}),(0,U.jsxs)(`div`,{className:W(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,U.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}var J=L;function Y({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i}){let{config:a}=ge();return n?.length?(0,U.jsx)(`div`,{className:W(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=ve(a,e,`${i||e.dataKey||`value`}`);return(0,U.jsxs)(`div`,{className:W(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,U.jsx)(n.icon,{}):(0,U.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function ve(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var ye=t({default:()=>Se}),be=`hsl(var(--primary))`,xe={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},X=e=>xe[e]||e,Z=(e,t)=>e?.variant===`comparison`?{strokeOpacity:typeof e.opacity==`number`?e.opacity:t===`line`||t===`scatter`?.5:.6,fillOpacity:typeof e.opacity==`number`?e.opacity:t===`bar`?.4:t===`area`?.2:.5,strokeDasharray:e.dashArray??(t===`line`||t===`area`?`4 4`:void 0)}:null;function Se({chartType:e=`bar`,data:t=[],config:n={},xAxisKey:r=`name`,series:i=[],className:a=``,onChartClick:o}){let s=e===`column`?`bar`:e,c=Array.isArray(t)?t:[],[l,u]=H.useState(!1),d=H.useCallback(e=>{if(!o||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;o({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[o]),f=H.useCallback(e=>{if(!o||!e)return;let t=e.payload?.[r],n=i[0]?.dataKey||`value`;o({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[o,r,i]),p=o?{onClick:d,style:{cursor:`pointer`}}:{},m=o?{onClick:f,style:{cursor:`pointer`}}:{};H.useEffect(()=>{let e=()=>u(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let h={bar:z,"horizontal-bar":z,line:te,area:M,pie:k,donut:k,radar:O,scatter:j,funnel:I,combo:z,treemap:z,sankey:z}[s]||z,A=H.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(t)){let e=new Date(t);if(!Number.isNaN(e.getTime())){let t=(c.length>1?Math.abs(new Date(String(c[c.length-1][r]??``)).getTime()-new Date(String(c[0][r]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return l&&t.length>8?t.slice(0,8)+`…`:t},[c,r,l]),L=H.useMemo(()=>c.some(e=>String(e[r]||``).length>5),[c,r]),B=()=>[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],V=H.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`number`?e:Number(e);if(!Number.isFinite(t))return String(e);try{return new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(t)}catch{return String(t)}},[]),ie=H.useMemo(()=>({tickLine:!1,tickMargin:10,axisLine:!1,interval:`preserveStartEnd`,minTickGap:l?32:48,tickFormatter:A,...!l&&L&&{angle:-35,textAnchor:`end`,height:60}}),[l,L,A]);if(s===`pie`||s===`donut`){let e=s===`donut`?60:0,t=B(),o={...n};return c.forEach((e,n)=>{let i=e?.[r];if(i==null||i===``)return;let a=String(i);o[a]||(o[a]={label:a,color:t[n%t.length]})}),(0,U.jsx)(G,{config:o,className:a,children:(0,U.jsxs)(k,{children:[(0,U.jsx)(K,{cursor:!1,content:(0,U.jsx)(q,{hideLabel:!0})}),(0,U.jsx)(S,{data:c,dataKey:i[0]?.dataKey||`value`,nameKey:r||`name`,innerRadius:e,strokeWidth:5,paddingAngle:2,outerRadius:80,...m,children:c.map((e,n)=>{let i=o[String(e[r])]?.color;return i||=t[n%t.length],(0,U.jsx)(x,{fill:X(i)},`cell-${n}`)})}),(0,U.jsx)(J,{verticalAlign:`bottom`,wrapperStyle:{fontSize:l?`11px`:`12px`,paddingTop:`8px`},content:(0,U.jsx)(Y,{nameKey:r,className:`flex-wrap`})})]})})}if(s===`funnel`){let e=i[0]?.dataKey||`value`,t=B(),s=o?t=>{t&&o({category:t?.payload?.[r]??t?.[r],value:t?.payload?.[e]??t?.[e]})}:void 0,l=s?{onClick:s,style:{cursor:`pointer`}}:{},u=[...c].sort((t,n)=>{let r=Number(t?.[e]??0);return Number(n?.[e]??0)-r});return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsxs)(I,{children:[(0,U.jsx)(K,{content:(0,U.jsx)(q,{})}),(0,U.jsxs)(F,{dataKey:e,data:u,nameKey:r,isAnimationActive:!0,...l,children:[(0,U.jsx)(b,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:r}),u.map((e,n)=>(0,U.jsx)(x,{fill:X(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(s===`treemap`){let e=i[0]?.dataKey||`value`,t=B(),o=c.map((n,i)=>({name:String(n?.[r]??``),size:Number(n?.[e])||0,fill:X(t[i%t.length])}));return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsx)(re,{data:o,dataKey:`size`,nameKey:`name`,isAnimationActive:!0,content:(0,U.jsx)(e=>{let{x:t,y:n,width:r,height:i,name:a,fill:o}=e;return r<=0||i<=0?null:(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:t,y:n,width:r,height:i,fill:o,stroke:`hsl(var(--background))`,strokeWidth:2}),r>48&&i>18?(0,U.jsx)(`text`,{x:t+6,y:n+18,fill:`#fff`,fontSize:12,className:`pointer-events-none`,children:a}):null]})},{}),children:(0,U.jsx)(E,{})})})}if(s===`sankey`){let e=i[0]?.dataKey||`value`,t=i[0]?.label||e,o=c.filter(t=>(Number(t?.[e])||0)>0),s=[{name:t},...o.map(e=>({name:String(e?.[r]??``)}))],l=o.map((t,n)=>({source:0,target:n+1,value:Number(t?.[e])||0}));return l.length===0?(0,U.jsx)(`div`,{className:a}):(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsx)(ne,{data:{nodes:s,links:l},nodePadding:24,link:{stroke:`hsl(var(--muted-foreground))`,strokeOpacity:.25},node:{fill:`hsl(var(--chart-1))`},children:(0,U.jsx)(E,{})})})}if(s===`radar`)return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsxs)(O,{data:c,children:[(0,U.jsx)(y,{}),(0,U.jsx)(C,{dataKey:r}),(0,U.jsx)(T,{}),(0,U.jsx)(K,{content:(0,U.jsx)(q,{})}),(0,U.jsx)(J,{content:(0,U.jsx)(Y,{}),...l&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map(e=>{let t=X(n[e.dataKey]?.color||be);return(0,U.jsx)(N,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(s===`scatter`)return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsxs)(j,{children:[(0,U.jsx)(g,{vertical:!1}),(0,U.jsx)(D,{type:`number`,dataKey:r,name:String(n[r]?.label||r),tickLine:!1,axisLine:!1,minTickGap:l?32:48}),(0,U.jsx)(R,{type:`number`,dataKey:i[0]?.dataKey||`value`,name:String(n[i[0]?.dataKey]?.label||i[0]?.dataKey),tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,U.jsx)(ee,{type:`number`,range:[60,400]}),(0,U.jsx)(K,{content:(0,U.jsx)(q,{})}),(0,U.jsx)(J,{content:(0,U.jsx)(Y,{}),...l&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let r=B(),i=X(n[e.dataKey]?.color||r[t%r.length]),a=Z(e,`scatter`);return(0,U.jsx)(v,{name:n[e.dataKey]?.label||e.dataKey,data:c,fill:i,fillOpacity:a?.fillOpacity},e.dataKey)})]})});if(s===`combo`)return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsxs)(z,{data:c,children:[(0,U.jsx)(g,{vertical:!1}),(0,U.jsx)(D,{dataKey:r,...ie}),(0,U.jsx)(R,{yAxisId:`left`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,U.jsx)(R,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,U.jsx)(K,{content:(0,U.jsx)(q,{})}),(0,U.jsx)(J,{content:(0,U.jsx)(Y,{}),...l&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let r=X(n[e.dataKey]?.color||be),i=e.chartType||(t===0?`bar`:`line`),a=i===`bar`?`left`:`right`,o=Z(e,i);return i===`line`?(0,U.jsx)(P,{yAxisId:a,type:`monotone`,dataKey:e.dataKey,stroke:r,strokeWidth:2,dot:!1,strokeOpacity:o?.strokeOpacity,strokeDasharray:o?.strokeDasharray},e.dataKey):i===`area`?(0,U.jsx)(w,{yAxisId:a,type:`monotone`,dataKey:e.dataKey,fill:r,stroke:r,fillOpacity:o?.fillOpacity??.4,strokeOpacity:o?.strokeOpacity,strokeDasharray:o?.strokeDasharray},e.dataKey):(0,U.jsx)(_,{yAxisId:a,dataKey:e.dataKey,fill:r,radius:4,fillOpacity:o?.fillOpacity},e.dataKey)})]})});let ae=s===`horizontal-bar`;return(0,U.jsx)(G,{config:n,className:a,children:(0,U.jsxs)(h,{data:c,layout:ae?`vertical`:`horizontal`,...p,children:[(0,U.jsx)(g,{vertical:!1}),ae?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(D,{type:`number`,tickLine:!1,axisLine:!1,tickFormatter:V}),(0,U.jsx)(R,{type:`category`,dataKey:r,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...c.map(e=>String(e[r]??``).length))*7)),tickFormatter:A})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(D,{dataKey:r,...ie}),(0,U.jsx)(R,{tickLine:!1,axisLine:!1,tickFormatter:V,width:48})]}),(0,U.jsx)(K,{content:(0,U.jsx)(q,{})}),(0,U.jsx)(J,{content:(0,U.jsx)(Y,{}),...l&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let r=B(),a=e.variant===`comparison`,o=a?i.slice(0,t).find(e=>e.variant!==`comparison`)||i[0]:e,l=a?i.indexOf(o):t,u=X(n[o.dataKey]?.color||r[l%r.length]||be);if(s===`bar`||s===`horizontal-bar`){let t=i.filter(e=>e.variant!==`comparison`).length===1&&!a&&i.length===1&&c.length>1,n=Z(e,`bar`);return(0,U.jsx)(_,{dataKey:e.dataKey,fill:u,radius:4,fillOpacity:n?.fillOpacity,children:t&&c.map((e,t)=>(0,U.jsx)(x,{fill:X(r[t%r.length])},`cell-${t}`))},e.dataKey)}if(s===`line`){let t=Z(e,`line`);return(0,U.jsx)(P,{type:`monotone`,dataKey:e.dataKey,stroke:u,strokeWidth:2,dot:!1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray},e.dataKey)}if(s===`area`){let t=Z(e,`area`);return(0,U.jsx)(w,{type:`monotone`,dataKey:e.dataKey,fill:u,stroke:u,fillOpacity:t?.fillOpacity??.4,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray},e.dataKey)}return null})]})})}var Ce=t({default:()=>Ee});function we(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}function Te({x:e,y:t,payload:n}){let r=String(n?.value??``),i=we(r);return(0,U.jsx)(`g`,{transform:`translate(${e},${t})`,children:(0,U.jsxs)(`text`,{dy:10,textAnchor:`end`,transform:`rotate(-32)`,fill:`hsl(var(--muted-foreground))`,fontSize:11,fontFamily:`monospace`,children:[r!==i&&(0,U.jsx)(`title`,{children:r}),i]})})}function Ee({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:i=``,color:a=`hsl(var(--primary))`}){let o=e.map(e=>String(e?.[n]??``)),s=o.length>4||o.some(e=>e.length>8);return(0,U.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,children:(0,U.jsx)(A,{width:`100%`,height:r,children:(0,U.jsxs)(z,{data:e,margin:{top:10,right:10,left:10,bottom:s?24:5},children:[(0,U.jsxs)(`defs`,{children:[(0,U.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:a,stopOpacity:1}),(0,U.jsx)(`stop`,{offset:`90%`,stopColor:a,stopOpacity:.6}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:a,stopOpacity:.3})]}),(0,U.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,U.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,U.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,U.jsx)(`feFlood`,{floodColor:a,floodOpacity:`0.5`,result:`offsetColor`}),(0,U.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,U.jsxs)(`feMerge`,{children:[(0,U.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,U.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,U.jsx)(g,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,U.jsx)(D,{dataKey:n,tick:s?(0,U.jsx)(Te,{}):{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},interval:s?0:`preserveStartEnd`,height:s?56:void 0,dy:s?void 0:10}),(0,U.jsx)(R,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,U.jsx)(E,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,U.jsx)(L,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,U.jsx)(_,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var De=H.lazy(()=>r(()=>Promise.resolve().then(()=>Ce),void 0,import.meta.url)),Oe=H.lazy(()=>r(()=>Promise.resolve().then(()=>ye),void 0,import.meta.url)),ke=({schema:e})=>(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(oe,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,U.jsx)(De,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),Q=({schema:e,onChartClick:t})=>{let n=H.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(oe,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,U.jsx)(Oe,{chartType:n.chartType,data:n.data,config:n.config,xAxisKey:n.xAxisKey,series:n.series,className:n.className,onChartClick:t})})};function $(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Ae(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function je(e,t,n,r,i){if(!e.length||!t)return e;let a=i||((e,t)=>t),o=`__raw_${t}`,s=n?.fields?.[t];if(!s){let n=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[t],i=String(r??``),s=n.test(i)?i:$(i);return{...e,[t]:a(i,s),[o]:r}})}let c=s.type;if(c===`select`||c===`picklist`||c===`dropdown`){let n=s.options||[];if(n.length===0)return e.map(e=>{let n=e[t],r=String(n??``),i=$(r);return{...e,[t]:a(r,i),[o]:n}});let r={};for(let e of n)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let n=e[t],i=String(n??``),s=r[i]||$(i);return{...e,[t]:a(i,s),[o]:n}})}if(c===`lookup`||c===`master_detail`){let n=s.reference_to||s.reference;if(!n||!r||typeof r.find!=`function`)return e.map(e=>({...e,[o]:e[t]}));let i=[...new Set(e.map(e=>e[t]).filter(e=>e!=null))];if(i.length===0)return e.map(e=>({...e,[o]:e[t]}));let a=s.id_field||`id`;try{let c=h(await r.find(n,{$filter:{[a]:{$in:i}},$top:i.length})),l=s.reference_field||s.display_field||`name`,u={};for(let e of c){let t=String(e[a]??e.id??e._id??``),n=e[l]||e.name||e.label||e.title||t;t&&(u[t]=String(n))}return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:u[r]||r,[o]:n}})}catch(n){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,n),e.map(e=>({...e,[o]:e[t]}))}}if(c===`date`||c===`datetime`||c===`date_time`||c===`timestamp`||c===`time`)return e.map(e=>({...e,[o]:e[t]}));let l=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:l.test(r)?r:$(r),[o]:n}})}var Me=e=>{let{schema:t}=e,n=(0,H.useContext)(o),r=e.dataSource||n?.dataSource,i=l(t.bind),{fieldOptionLabel:p}=pe(),g=(0,H.useRef)(p);(0,H.useEffect)(()=>{g.current=p},[p]);let[ee,_]=(0,H.useState)([]),[v,y]=(0,H.useState)(()=>!(Array.isArray(t.data)&&t.data.length>0)&&!!t.objectName),[b,x]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),w=(0,H.useMemo)(()=>t.aggregate?JSON.stringify(t.aggregate):``,[t.aggregate]),T=(0,H.useMemo)(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),E=(0,H.useMemo)(()=>t.compareTo?JSON.stringify(t.compareTo):``,[t.compareTo]),te=e=>e!==`pie`&&e!==`donut`&&e!==`funnel`,D=(0,H.useCallback)(async(e,n)=>{if(t.aggregate&&typeof e.aggregate==`function`){let r=t.aggregate.groupBy;if(r&&typeof r==`object`&&!Array.isArray(r)){let i=t.aggregate.field,a=t.aggregate.function,o={function:a,alias:i||a};a!==`count`&&i&&(o.field=i);let s=await e.aggregate(t.objectName,{groupBy:[r],aggregations:[o],where:n});return Array.isArray(s)?s:[]}let i=await e.aggregate(t.objectName,{field:t.aggregate.field,function:t.aggregate.function,groupBy:r,filter:n});return Array.isArray(i)?i:[]}if(typeof e.find==`function`){let r=h(await e.find(t.objectName,{$filter:n}));return t.aggregate&&r.length>0&&(r=Ae(r,t.aggregate)),r}return[]},[t.objectName,w]),O=(0,H.useCallback)(async(e,n)=>{if(!e||!t.objectName){n.current&&y(!1);return}n.current&&(y(!0),x(null));try{let r=s(t.filter),i=t.compareTo,a=!!i&&te(t.chartType),o=a?m(t.filter,i):null,[c,l]=await Promise.all([D(e,r),o?D(e,o):Promise.resolve([])]),u=c,d=t.aggregate?.groupBy,f=d&&typeof d==`object`&&!Array.isArray(d)?d.alias||d.field:d||t.xAxisKey;if(a&&l.length>0&&t.aggregate){let e=t.aggregate.field,n=t.aggregate.function,r=t=>{if(t==null)return null;let r=`${e}_${n}`;return r in t?Number(t[r]):n===`count`&&`${e}_count`in t?Number(t[`${e}_count`]):e in t?Number(t[e]):`value`in t?Number(t.value):`count`in t?Number(t.count):null},i=`${e}__comparison`,a=f;if(a&&u.some(e=>e[a]!=null)&&l.some(e=>e[a]!=null)){let e=new Map;for(let t of l){let n=String(t[a]??``);e.set(n,r(t))}u=u.map(t=>{let n=String(t[a]??``),r=e.get(n);return r==null?t:{...t,[i]:r}});let t=new Set(u.map(e=>String(e[a]??``)));for(let e of l){let n=String(e[a]??``);t.has(n)||u.push({[a]:n,[i]:r(e)})}}else{let e=Math.max(u.length,l.length),t=[];for(let n=0;n<e;n++){let e=u[n]||{},a=l[n];t.push(a?{...e,[i]:r(a)}:e)}u=t}}if(f&&typeof e.getObjectSchema==`function`)try{let n=await e.getObjectSchema(t.objectName);u=await je(u,f,n,e,(e,n)=>g.current(t.objectName,f,e,n))}catch{}n.current&&_(u)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&x(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&y(!1)}},[t.objectName,w,T,E,t.xAxisKey,t.chartType,D]);(0,H.useEffect)(()=>{let e={current:!0};return t.objectName&&!i&&!t.data?O(r,e):e.current&&y(!1),()=>{e.current=!1}},[t.objectName,r,i,t.data,T,w,E,O]);let k=i||t.data||ee,A=Array.isArray(k)?k:[],j=t.drillDown,M=t.aggregate?.groupBy||t.xAxisKey,N=(0,H.useMemo)(()=>{if(!M)return new Map;let e=new Map,t=`__raw_${M}`;for(let n of A){let r=n?.[M];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[A,M]),P=t.compareTo,F=!!P&&te(t.chartType)&&!!t.aggregate&&A.some(e=>e[`${t.aggregate.field}__comparison`]!=null),I=(0,H.useMemo)(()=>{let e=Array.isArray(t.series)?t.series:null;if(!F)return e;let n=e||[{dataKey:t.aggregate.field}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[c(P,t.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:`${t.aggregate.field}__comparison`,label:r,variant:`comparison`}]},[F,t.series,t.aggregate,t.filter,P]),L={...t,data:A,...I?{series:I}:{}};if(v&&A.length===0)return(0,U.jsx)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(t.className||``),"data-testid":`chart-loading`,children:`Loading chart data…`});if(b)return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(t.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,U.jsx)(fe,{className:`h-6 w-6 text-destructive opacity-60`}),(0,U.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:b})]});if(!r&&t.objectName&&A.length===0)return(0,U.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(t.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,t.objectName,`”`]});let ne=u(j)?e=>{let t=e.category,n=t!=null&&N.has(String(t))?N.get(String(t)):t;C({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,R=S&&t.objectName?(()=>{let e=d(j,S,{groupByField:M}),n={...t.filter||{},...e},i=f(j,S,t.title||`Details`),o=j?.target??`drawer`,s=(0,U.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,U.jsx)(a,{schema:{type:`object-data-table`,objectName:t.objectName,filter:n,pagination:!0,pageSize:j?.maxRows,columns:j?.columns?.map(e=>({accessorKey:e,header:e}))},dataSource:r})});return o===`dialog`?(0,U.jsx)(ie,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(le,{className:`max-w-4xl`,children:[(0,U.jsx)(de,{children:(0,U.jsx)(V,{children:i})}),s]})}):(0,U.jsx)(ce,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(B,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,U.jsx)(ae,{children:(0,U.jsx)(ue,{children:i})}),(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:s})]})})})():null;return(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(se,{active:v&&A.length>0}),(0,U.jsx)(Q,{...e,schema:L,onChartClick:ne}),R]})};p.register(`object-chart`,Me,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var Ne=t({ChartBarRenderer:()=>ke,ChartRenderer:()=>Q,ObjectChart:()=>Me,chartComponents:()=>Pe}),Pe={"bar-chart":ke,chart:Q};p.register(`bar-chart`,ke,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),p.register(`chart`,Me,{namespace:`view`,category:`view`,label:`Chart`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),p.register(`chart`,Q,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),p.register(`chart:bar`,Q,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),p.register(`pie-chart`,Q,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),p.register(`donut-chart`,Q,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),p.register(`radar-chart`,Q,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),p.register(`scatter-chart`,Q,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}});export{Ne as t};