@powerhousedao/common 1.1.0

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 (451) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +79 -0
  3. package/dist/.storybook/addons/operations-preset.d.ts +5 -0
  4. package/dist/.storybook/addons/operations.d.ts +1 -0
  5. package/dist/.storybook/create-require.d.ts +1 -0
  6. package/dist/.storybook/main.d.ts +3 -0
  7. package/dist/.storybook/preview.d.ts +4 -0
  8. package/dist/cjs/document-drive.js +131 -0
  9. package/dist/cjs/documentModels.js +1 -0
  10. package/dist/cjs/editors/generic-drive-explorer/editor.js +44 -0
  11. package/dist/cjs/editors/generic-drive-explorer.js +1 -0
  12. package/dist/cjs/editors/hooks.js +1 -0
  13. package/dist/cjs/editors/utils.js +1 -0
  14. package/dist/cjs/editors.js +1 -0
  15. package/dist/cjs/index.js +1 -0
  16. package/dist/cjs/internal/ArrowFilledRight-CdLnbh1Z.js +1 -0
  17. package/dist/cjs/internal/ArrowFilledRight-blx8xu7X-CdLnbh1Z.js +1 -0
  18. package/dist/cjs/internal/ArrowLeft-7pYNK4eX-BztSD5MZ.js +1 -0
  19. package/dist/cjs/internal/ArrowLeft-BztSD5MZ.js +1 -0
  20. package/dist/cjs/internal/ArrowUp-Bbr_dwo_-CdLNuupd.js +1 -0
  21. package/dist/cjs/internal/ArrowUp-CdLNuupd.js +1 -0
  22. package/dist/cjs/internal/BarChart-B0G05Nfd-Dp2lrDt7.js +1 -0
  23. package/dist/cjs/internal/BarChart-Dp2lrDt7.js +1 -0
  24. package/dist/cjs/internal/BaseArrowLeft-BIaGoVNm.js +1 -0
  25. package/dist/cjs/internal/BaseArrowLeft-DBzhFHMt-BIaGoVNm.js +1 -0
  26. package/dist/cjs/internal/BaseArrowRight-BNaqDq8l.js +1 -0
  27. package/dist/cjs/internal/BaseArrowRight-DYQTBWAs-BNaqDq8l.js +1 -0
  28. package/dist/cjs/internal/Braces-N-sH2Zyc-whWd44n5.js +1 -0
  29. package/dist/cjs/internal/Braces-whWd44n5.js +1 -0
  30. package/dist/cjs/internal/Branch-CWdBw1_P-CjqDp6ik.js +1 -0
  31. package/dist/cjs/internal/Branch-DBMUq7Be.js +1 -0
  32. package/dist/cjs/internal/BrickGlobe-67zaG6_H-BPZSrRw1.js +1 -0
  33. package/dist/cjs/internal/BrickGlobe-BPZSrRw1.js +1 -0
  34. package/dist/cjs/internal/Briefcase-CBiNfrHx.js +1 -0
  35. package/dist/cjs/internal/Briefcase-CedW3KRR-CBiNfrHx.js +1 -0
  36. package/dist/cjs/internal/Calendar-C-6HV96D-RADpqN-a.js +1 -0
  37. package/dist/cjs/internal/Calendar-RADpqN-a.js +1 -0
  38. package/dist/cjs/internal/CalendarTime-B6dVE3Vo.js +1 -0
  39. package/dist/cjs/internal/CalendarTime-Bhjzlgn_-B6dVE3Vo.js +1 -0
  40. package/dist/cjs/internal/Caret-BDrIFTBr.js +1 -0
  41. package/dist/cjs/internal/Caret-Ep0j0fz2-BDrIFTBr.js +1 -0
  42. package/dist/cjs/internal/CaretDown-3X7LFYBf-D7RPxYu9.js +1 -0
  43. package/dist/cjs/internal/CaretDown-BvCn0Fhz.js +1 -0
  44. package/dist/cjs/internal/CaretLeft-DFUDq9-g.js +1 -0
  45. package/dist/cjs/internal/CaretLeft-Df3E-68c-DFUDq9-g.js +1 -0
  46. package/dist/cjs/internal/CaretRight-BeYC8ztL.js +1 -0
  47. package/dist/cjs/internal/CaretRight-DSVWUSka-BeYC8ztL.js +1 -0
  48. package/dist/cjs/internal/CaretSort-BWLKg0-u.js +1 -0
  49. package/dist/cjs/internal/CaretSort-BkGdLETT-BWLKg0-u.js +1 -0
  50. package/dist/cjs/internal/Check-13fDRXgb.js +1 -0
  51. package/dist/cjs/internal/Check-DV-U4AEq-13fDRXgb.js +1 -0
  52. package/dist/cjs/internal/CheckCircle-DA-pntuz.js +1 -0
  53. package/dist/cjs/internal/CheckCircle-DI5fEgGd-DA-pntuz.js +1 -0
  54. package/dist/cjs/internal/CheckCircleFill-BFKFsxnE.js +1 -0
  55. package/dist/cjs/internal/CheckCircleFill-C-F0v5mB-BFKFsxnE.js +1 -0
  56. package/dist/cjs/internal/Checkmark-BXnfChpo-DvsdRf2A.js +1 -0
  57. package/dist/cjs/internal/Checkmark-QDhJ9UXt.js +1 -0
  58. package/dist/cjs/internal/ChevronDown-B70QTNR0.js +1 -0
  59. package/dist/cjs/internal/ChevronDown-ouBxrU-k-B70QTNR0.js +1 -0
  60. package/dist/cjs/internal/Circle-DS-uCgZl.js +1 -0
  61. package/dist/cjs/internal/Circle-n3-Wh4HS-DS-uCgZl.js +1 -0
  62. package/dist/cjs/internal/CircleInfo-BhZY3C2Q-CmV_bLmA.js +1 -0
  63. package/dist/cjs/internal/CircleInfo-CmV_bLmA.js +1 -0
  64. package/dist/cjs/internal/Clock-CH2JbdvU.js +1 -0
  65. package/dist/cjs/internal/Clock-DF-XMxha-CH2JbdvU.js +1 -0
  66. package/dist/cjs/internal/ClockFill-Bd0t48q7-CQr2Duwk.js +1 -0
  67. package/dist/cjs/internal/ClockFill-CQr2Duwk.js +1 -0
  68. package/dist/cjs/internal/CloudSlash-B-zJBjaD-KU5Kt4X9.js +1 -0
  69. package/dist/cjs/internal/CloudSlash-KU5Kt4X9.js +1 -0
  70. package/dist/cjs/internal/Collapse-DRDB8Czs-DsoRMkTq.js +1 -0
  71. package/dist/cjs/internal/Collapse-DsoRMkTq.js +1 -0
  72. package/dist/cjs/internal/Connect-Dme-qfKq-BXXoOOed.js +1 -0
  73. package/dist/cjs/internal/Connect-eAdo4Hx7.js +1 -0
  74. package/dist/cjs/internal/Copy-ldv4c9St.js +1 -0
  75. package/dist/cjs/internal/Copy-ms9-7m7Y-ldv4c9St.js +1 -0
  76. package/dist/cjs/internal/CrossCircle-B6ZawoOx-D4Y7qdTL.js +1 -0
  77. package/dist/cjs/internal/CrossCircle-D4Y7qdTL.js +1 -0
  78. package/dist/cjs/internal/Danger-7OjLDAVm.js +1 -0
  79. package/dist/cjs/internal/Danger-KM8BZjue-7OjLDAVm.js +1 -0
  80. package/dist/cjs/internal/Discord-CAS0Cj7s-iahYwFTC.js +1 -0
  81. package/dist/cjs/internal/Discord-Wf7xMoMt.js +1 -0
  82. package/dist/cjs/internal/Drive-BrH7tOs6.js +1 -0
  83. package/dist/cjs/internal/Drive-GMcgBcIY-BrH7tOs6.js +1 -0
  84. package/dist/cjs/internal/Edit-Dr-ZiMSE-NazSGvo6.js +1 -0
  85. package/dist/cjs/internal/Edit-NazSGvo6.js +1 -0
  86. package/dist/cjs/internal/Ellipsis-DP4-vVHS.js +1 -0
  87. package/dist/cjs/internal/Ellipsis-XK8AwMEC-DP4-vVHS.js +1 -0
  88. package/dist/cjs/internal/Error-BmIZ2ZUy-DelEjl70.js +1 -0
  89. package/dist/cjs/internal/Error-DelEjl70.js +1 -0
  90. package/dist/cjs/internal/Exclamation-CVsNS_QS-DkJ3N2VN.js +1 -0
  91. package/dist/cjs/internal/Exclamation-DkJ3N2VN.js +1 -0
  92. package/dist/cjs/internal/File-Ba7ClyaL-KirmxIxE.js +1 -0
  93. package/dist/cjs/internal/File-CJn8SgPd.js +1 -0
  94. package/dist/cjs/internal/FilesEarmark-CyrCQy8E-D9EnVh63.js +1 -0
  95. package/dist/cjs/internal/FilesEarmark-D9EnVh63.js +1 -0
  96. package/dist/cjs/internal/FolderClose-BzvCVJY3.js +1 -0
  97. package/dist/cjs/internal/FolderClose-DG_qHisc-BzvCVJY3.js +1 -0
  98. package/dist/cjs/internal/FolderOpen-i7EPaNAk.js +1 -0
  99. package/dist/cjs/internal/FolderOpen-kDoWFkJO-i7EPaNAk.js +1 -0
  100. package/dist/cjs/internal/FolderPlus-B6YUoFOs.js +1 -0
  101. package/dist/cjs/internal/FolderPlus-CSBSl9lZ-B6YUoFOs.js +1 -0
  102. package/dist/cjs/internal/Forum-DAbn_E5Z.js +1 -0
  103. package/dist/cjs/internal/Forum-DZ-CkLFh-DAbn_E5Z.js +1 -0
  104. package/dist/cjs/internal/Gear-DX2SO77Q.js +1 -0
  105. package/dist/cjs/internal/Gear-cUlHJ4q6-DX2SO77Q.js +1 -0
  106. package/dist/cjs/internal/Github-0PLiINY0-CMo5f5Uh.js +1 -0
  107. package/dist/cjs/internal/Github-CMo5f5Uh.js +1 -0
  108. package/dist/cjs/internal/Globe-B3_r4w92.js +1 -0
  109. package/dist/cjs/internal/Globe-CIYqVkpa-DUO0S1vM.js +1 -0
  110. package/dist/cjs/internal/GlobeWww-DN4yKujh-DRIzLSOr.js +1 -0
  111. package/dist/cjs/internal/GlobeWww-DRIzLSOr.js +1 -0
  112. package/dist/cjs/internal/Hdd-Bpvk6UZo.js +1 -0
  113. package/dist/cjs/internal/Hdd-Dn_LdJIh-Bpvk6UZo.js +1 -0
  114. package/dist/cjs/internal/History-BP4SmaS_-DWAoZ0qu.js +1 -0
  115. package/dist/cjs/internal/History-DWAoZ0qu.js +1 -0
  116. package/dist/cjs/internal/InfoSquare-C98JaLiz-lX0uwCIK.js +1 -0
  117. package/dist/cjs/internal/InfoSquare-lX0uwCIK.js +1 -0
  118. package/dist/cjs/internal/Link-BF7aZjVu-DDK6dy_M.js +1 -0
  119. package/dist/cjs/internal/Link-DDK6dy_M.js +1 -0
  120. package/dist/cjs/internal/Linkedin-D-nw05lH.js +1 -0
  121. package/dist/cjs/internal/Linkedin-DJwIkS6q-D-nw05lH.js +1 -0
  122. package/dist/cjs/internal/Lock-BaCGsppX.js +1 -0
  123. package/dist/cjs/internal/Lock-PyaFHdNS-BaCGsppX.js +1 -0
  124. package/dist/cjs/internal/M-C5952Ned.js +1 -0
  125. package/dist/cjs/internal/M-DozhhPMY-DjdlgSlF.js +1 -0
  126. package/dist/cjs/internal/PackageManager-5kbgWv3Q.js +1 -0
  127. package/dist/cjs/internal/PackageManager-B-MUWliB-CbEgteCV.js +1 -0
  128. package/dist/cjs/internal/Pencil-C3L3Ly8K.js +1 -0
  129. package/dist/cjs/internal/Pencil-D7lvxXIP-C3L3Ly8K.js +1 -0
  130. package/dist/cjs/internal/People-BXgvyPFn.js +1 -0
  131. package/dist/cjs/internal/People-CUB8LYKf-BXgvyPFn.js +1 -0
  132. package/dist/cjs/internal/Person-BPSmnRXQ.js +1 -0
  133. package/dist/cjs/internal/Person-DuL4PQzm-BPSmnRXQ.js +1 -0
  134. package/dist/cjs/internal/Pin-BRoQkCvO.js +1 -0
  135. package/dist/cjs/internal/Pin-DF70btCU-BRoQkCvO.js +1 -0
  136. package/dist/cjs/internal/PinFilled-D0PwF9B7.js +1 -0
  137. package/dist/cjs/internal/PinFilled-vImzS0do-D0PwF9B7.js +1 -0
  138. package/dist/cjs/internal/Plus-2ZPocFkI.js +1 -0
  139. package/dist/cjs/internal/Plus-DPFWGJM4-2ZPocFkI.js +1 -0
  140. package/dist/cjs/internal/PlusCircle-BEnWRjHa-dBGCFo8Z.js +1 -0
  141. package/dist/cjs/internal/PlusCircle-dBGCFo8Z.js +1 -0
  142. package/dist/cjs/internal/PlusSquare-CspgRMoS-DHDOhi18.js +1 -0
  143. package/dist/cjs/internal/PlusSquare-DHDOhi18.js +1 -0
  144. package/dist/cjs/internal/PowerhouseLogoSmall-BkeWSejU.js +1 -0
  145. package/dist/cjs/internal/PowerhouseLogoSmall-CmO95IAS-B3j8LIsL.js +1 -0
  146. package/dist/cjs/internal/Project-BlXuclr0-CwWLGxsS.js +1 -0
  147. package/dist/cjs/internal/Project-CwWLGxsS.js +1 -0
  148. package/dist/cjs/internal/QuestionSquare-B6O9Le7r-DP6UBPx-.js +1 -0
  149. package/dist/cjs/internal/QuestionSquare-DP6UBPx-.js +1 -0
  150. package/dist/cjs/internal/RedoArrow-BJeEsiph-BQh40FmN.js +1 -0
  151. package/dist/cjs/internal/RedoArrow-BQh40FmN.js +1 -0
  152. package/dist/cjs/internal/Reload-6C2CYgrl-CunRqieT.js +1 -0
  153. package/dist/cjs/internal/Reload-CunRqieT.js +1 -0
  154. package/dist/cjs/internal/Renown-6m7hx37h-BW3yEx60.js +1 -0
  155. package/dist/cjs/internal/Renown-BW3yEx60.js +1 -0
  156. package/dist/cjs/internal/RenownHover-CQ0TZHZv-CjvedgXl.js +1 -0
  157. package/dist/cjs/internal/RenownHover-CjvedgXl.js +1 -0
  158. package/dist/cjs/internal/Ring-CEDrFwYP.js +1 -0
  159. package/dist/cjs/internal/Ring-DKv0gnwT-CEDrFwYP.js +1 -0
  160. package/dist/cjs/internal/Save-BBxj68pn-xRbrjpPz.js +1 -0
  161. package/dist/cjs/internal/Save-xRbrjpPz.js +1 -0
  162. package/dist/cjs/internal/Search-DNALFhTU.js +1 -0
  163. package/dist/cjs/internal/Search-YUJuRBLe-DNALFhTU.js +1 -0
  164. package/dist/cjs/internal/Server-0eDgVQU0.js +1 -0
  165. package/dist/cjs/internal/Server-Bfkkjui1-0eDgVQU0.js +1 -0
  166. package/dist/cjs/internal/Settings-B7lMxC-8.js +1 -0
  167. package/dist/cjs/internal/Settings-mbbylBS5-B7lMxC-8.js +1 -0
  168. package/dist/cjs/internal/Synced-CU99z-Ii.js +1 -0
  169. package/dist/cjs/internal/Synced-DKJXzPiw-CU99z-Ii.js +1 -0
  170. package/dist/cjs/internal/Syncing-CMj5KzAD.js +1 -0
  171. package/dist/cjs/internal/Syncing-aT9WSMFf-CMj5KzAD.js +1 -0
  172. package/dist/cjs/internal/Trash-CgSbHk-P-DYAdF_5Q.js +1 -0
  173. package/dist/cjs/internal/Trash-DYAdF_5Q.js +1 -0
  174. package/dist/cjs/internal/TrashFill-C5lRRaw7.js +1 -0
  175. package/dist/cjs/internal/TrashFill-DN50ercb-C5lRRaw7.js +1 -0
  176. package/dist/cjs/internal/TreeViewSlash-BywCsx5o-Ct-NDdPW.js +1 -0
  177. package/dist/cjs/internal/TreeViewSlash-Ct-NDdPW.js +1 -0
  178. package/dist/cjs/internal/TriangleDown-DY6WMAzp.js +1 -0
  179. package/dist/cjs/internal/TriangleDown-eCXwUfu8-DY6WMAzp.js +1 -0
  180. package/dist/cjs/internal/VariantArrowLeft-CfcnlV4w.js +1 -0
  181. package/dist/cjs/internal/VariantArrowLeft-CnuX59_e-CfcnlV4w.js +1 -0
  182. package/dist/cjs/internal/VerticalDots-C8QYf7et-OFxqwEbF.js +1 -0
  183. package/dist/cjs/internal/VerticalDots-OFxqwEbF.js +1 -0
  184. package/dist/cjs/internal/WarningFill-CZYtywR5.js +1 -0
  185. package/dist/cjs/internal/WarningFill-WowAvi5P-CZYtywR5.js +1 -0
  186. package/dist/cjs/internal/XTwitter-9YzUU33n.js +1 -0
  187. package/dist/cjs/internal/XTwitter-k3Pt8itk-9YzUU33n.js +1 -0
  188. package/dist/cjs/internal/Xmark-8qnJCs2Y-C6N4PqFZ.js +1 -0
  189. package/dist/cjs/internal/Xmark-C6N4PqFZ.js +1 -0
  190. package/dist/cjs/internal/XmarkLight-GHzDR5_F-v7Izhl-Y.js +1 -0
  191. package/dist/cjs/internal/XmarkLight-v7Izhl-Y.js +1 -0
  192. package/dist/cjs/internal/Youtube-C4bxUqLV.js +1 -0
  193. package/dist/cjs/internal/Youtube-i8V0IXUU-C4bxUqLV.js +1 -0
  194. package/dist/cjs/internal/index-BHFT2wp6.js +1 -0
  195. package/dist/cjs/internal/index-CK624Dud.js +1 -0
  196. package/dist/cjs/package.json +1 -0
  197. package/dist/cjs/storybook.js +345 -0
  198. package/dist/cjs/utils/lazy-with-preload.js +1 -0
  199. package/dist/document-drive.d.ts +2 -0
  200. package/dist/document-models/document-drive/gen/actions.d.ts +5 -0
  201. package/dist/document-models/document-drive/gen/creators.d.ts +2 -0
  202. package/dist/document-models/document-drive/gen/document-model.d.ts +2 -0
  203. package/dist/document-models/document-drive/gen/drive/actions.d.ts +11 -0
  204. package/dist/document-models/document-drive/gen/drive/creators.d.ts +10 -0
  205. package/dist/document-models/document-drive/gen/drive/error.d.ts +1 -0
  206. package/dist/document-models/document-drive/gen/drive/object.d.ts +13 -0
  207. package/dist/document-models/document-drive/gen/drive/operations.d.ts +13 -0
  208. package/dist/document-models/document-drive/gen/index.d.ts +5 -0
  209. package/dist/document-models/document-drive/gen/node/actions.d.ts +10 -0
  210. package/dist/document-models/document-drive/gen/node/creators.d.ts +9 -0
  211. package/dist/document-models/document-drive/gen/node/error.d.ts +1 -0
  212. package/dist/document-models/document-drive/gen/node/object.d.ts +12 -0
  213. package/dist/document-models/document-drive/gen/node/operations.d.ts +12 -0
  214. package/dist/document-models/document-drive/gen/object.d.ts +17 -0
  215. package/dist/document-models/document-drive/gen/reducer.d.ts +3 -0
  216. package/dist/document-models/document-drive/gen/schema/index.d.ts +2 -0
  217. package/dist/document-models/document-drive/gen/schema/types.d.ts +175 -0
  218. package/dist/document-models/document-drive/gen/schema/zod.d.ts +86 -0
  219. package/dist/document-models/document-drive/gen/types.d.ts +8 -0
  220. package/dist/document-models/document-drive/gen/utils.d.ts +6 -0
  221. package/dist/document-models/document-drive/index.d.ts +60 -0
  222. package/dist/document-models/document-drive/src/reducers/drive.d.ts +2 -0
  223. package/dist/document-models/document-drive/src/reducers/node.d.ts +2 -0
  224. package/dist/document-models/document-drive/src/tests/actions.test.d.ts +1 -0
  225. package/dist/document-models/document-drive/src/tests/base.test.d.ts +1 -0
  226. package/dist/document-models/document-drive/src/tests/document-model.test.d.ts +5 -0
  227. package/dist/document-models/document-drive/src/tests/drive.test.d.ts +5 -0
  228. package/dist/document-models/document-drive/src/tests/node.test.d.ts +5 -0
  229. package/dist/document-models/document-drive/src/tests/utils.test.d.ts +1 -0
  230. package/dist/document-models/document-drive/src/utils.d.ts +33 -0
  231. package/dist/document-models/index.d.ts +1 -0
  232. package/dist/documentModels.d.ts +2 -0
  233. package/dist/editors/generic-drive-explorer/components/create-document.d.ts +7 -0
  234. package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts +11 -0
  235. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts +16 -0
  236. package/dist/editors/generic-drive-explorer/components/layout.d.ts +11 -0
  237. package/dist/editors/generic-drive-explorer/components/search-bar.d.ts +1 -0
  238. package/dist/editors/generic-drive-explorer/editor.d.ts +4 -0
  239. package/dist/editors/generic-drive-explorer/index.d.ts +4 -0
  240. package/dist/editors/generic-drive-explorer.d.ts +6 -0
  241. package/dist/editors/hooks/index.d.ts +3 -0
  242. package/dist/editors/hooks/useDriveActions.d.ts +80 -0
  243. package/dist/editors/hooks/useDriveActionsWithUiNodes.d.ts +16 -0
  244. package/dist/editors/hooks/useDriveContext.d.ts +57 -0
  245. package/dist/editors/hooks.d.ts +2 -0
  246. package/dist/editors/index.d.ts +1 -0
  247. package/dist/editors/utils/index.d.ts +9 -0
  248. package/dist/editors/utils/storybook.d.ts +12 -0
  249. package/dist/editors/utils/uiNodes.d.ts +6 -0
  250. package/dist/editors/utils.d.ts +2 -0
  251. package/dist/editors.d.ts +2 -0
  252. package/dist/es/document-drive.js +4173 -0
  253. package/dist/es/documentModels.js +4 -0
  254. package/dist/es/editors/generic-drive-explorer/editor.js +10487 -0
  255. package/dist/es/editors/generic-drive-explorer.js +15 -0
  256. package/dist/es/editors/hooks.js +7 -0
  257. package/dist/es/editors/utils.js +4 -0
  258. package/dist/es/editors.js +4 -0
  259. package/dist/es/index.js +16 -0
  260. package/dist/es/internal/ArrowFilledRight-blx8xu7X-CeRbq1H9.js +7 -0
  261. package/dist/es/internal/ArrowFilledRight-blx8xu7X.js +7 -0
  262. package/dist/es/internal/ArrowLeft-7pYNK4eX-7pYNK4eX.js +15 -0
  263. package/dist/es/internal/ArrowLeft-7pYNK4eX.js +15 -0
  264. package/dist/es/internal/ArrowUp-Bbr_dwo_-5876i8vu.js +7 -0
  265. package/dist/es/internal/ArrowUp-Bbr_dwo_.js +7 -0
  266. package/dist/es/internal/BarChart-B0G05Nfd-KxM7Dvga.js +7 -0
  267. package/dist/es/internal/BarChart-B0G05Nfd.js +7 -0
  268. package/dist/es/internal/BaseArrowLeft-DBzhFHMt-B42AOfF9.js +7 -0
  269. package/dist/es/internal/BaseArrowLeft-DBzhFHMt.js +7 -0
  270. package/dist/es/internal/BaseArrowRight-DYQTBWAs-y7IfWBCR.js +7 -0
  271. package/dist/es/internal/BaseArrowRight-DYQTBWAs.js +7 -0
  272. package/dist/es/internal/Braces-N-sH2Zyc-N-sH2Zyc.js +17 -0
  273. package/dist/es/internal/Braces-N-sH2Zyc.js +17 -0
  274. package/dist/es/internal/Branch-CWdBw1_P-RCIyyJkm.js +7 -0
  275. package/dist/es/internal/Branch-CWdBw1_P.js +7 -0
  276. package/dist/es/internal/BrickGlobe-67zaG6_H-DzpvMNoP.js +7 -0
  277. package/dist/es/internal/BrickGlobe-67zaG6_H.js +7 -0
  278. package/dist/es/internal/Briefcase-CedW3KRR-5m_tf7kZ.js +7 -0
  279. package/dist/es/internal/Briefcase-CedW3KRR.js +7 -0
  280. package/dist/es/internal/Calendar-C-6HV96D-CW77lPN4.js +7 -0
  281. package/dist/es/internal/Calendar-C-6HV96D.js +7 -0
  282. package/dist/es/internal/CalendarTime-Bhjzlgn_-Dwqtl7S5.js +27 -0
  283. package/dist/es/internal/CalendarTime-Bhjzlgn_.js +27 -0
  284. package/dist/es/internal/Caret-Ep0j0fz2-Sy0mW2fQ.js +7 -0
  285. package/dist/es/internal/Caret-Ep0j0fz2.js +7 -0
  286. package/dist/es/internal/CaretDown-3X7LFYBf-Ds-IOygX.js +14 -0
  287. package/dist/es/internal/CaretDown-3X7LFYBf.js +14 -0
  288. package/dist/es/internal/CaretLeft-Df3E-68c-DIUEps2Y.js +27 -0
  289. package/dist/es/internal/CaretLeft-Df3E-68c.js +27 -0
  290. package/dist/es/internal/CaretRight-DSVWUSka-C-DWrfXy.js +27 -0
  291. package/dist/es/internal/CaretRight-DSVWUSka.js +27 -0
  292. package/dist/es/internal/CaretSort-BkGdLETT-WpazRSDr.js +14 -0
  293. package/dist/es/internal/CaretSort-BkGdLETT.js +14 -0
  294. package/dist/es/internal/Check-DV-U4AEq-C8LS3kCz.js +7 -0
  295. package/dist/es/internal/Check-DV-U4AEq.js +7 -0
  296. package/dist/es/internal/CheckCircle-DI5fEgGd-CTZFiM1C.js +23 -0
  297. package/dist/es/internal/CheckCircle-DI5fEgGd.js +23 -0
  298. package/dist/es/internal/CheckCircleFill-C-F0v5mB-JkGdWGnI.js +7 -0
  299. package/dist/es/internal/CheckCircleFill-C-F0v5mB.js +7 -0
  300. package/dist/es/internal/Checkmark-BXnfChpo-jHcnAiFb.js +14 -0
  301. package/dist/es/internal/Checkmark-BXnfChpo.js +14 -0
  302. package/dist/es/internal/ChevronDown-ouBxrU-k-ouBxrU-k.js +15 -0
  303. package/dist/es/internal/ChevronDown-ouBxrU-k.js +15 -0
  304. package/dist/es/internal/Circle-n3-Wh4HS-n3-Wh4HS.js +7 -0
  305. package/dist/es/internal/Circle-n3-Wh4HS.js +7 -0
  306. package/dist/es/internal/CircleInfo-BhZY3C2Q-C3-X1VlM.js +40 -0
  307. package/dist/es/internal/CircleInfo-BhZY3C2Q.js +40 -0
  308. package/dist/es/internal/Clock-DF-XMxha-DF-XMxha.js +26 -0
  309. package/dist/es/internal/Clock-DF-XMxha.js +26 -0
  310. package/dist/es/internal/ClockFill-Bd0t48q7-lvy1kAho.js +7 -0
  311. package/dist/es/internal/ClockFill-Bd0t48q7.js +7 -0
  312. package/dist/es/internal/CloudSlash-B-zJBjaD-C1F-9lOg.js +7 -0
  313. package/dist/es/internal/CloudSlash-B-zJBjaD.js +7 -0
  314. package/dist/es/internal/Collapse-DRDB8Czs-BekNryES.js +7 -0
  315. package/dist/es/internal/Collapse-DRDB8Czs.js +7 -0
  316. package/dist/es/internal/Connect-Dme-qfKq-IP0_N99W.js +16 -0
  317. package/dist/es/internal/Connect-Dme-qfKq.js +16 -0
  318. package/dist/es/internal/Copy-ms9-7m7Y-ms9-7m7Y.js +14 -0
  319. package/dist/es/internal/Copy-ms9-7m7Y.js +14 -0
  320. package/dist/es/internal/CrossCircle-B6ZawoOx-i2IYK4Vv.js +27 -0
  321. package/dist/es/internal/CrossCircle-B6ZawoOx.js +27 -0
  322. package/dist/es/internal/Danger-KM8BZjue-KM8BZjue.js +18 -0
  323. package/dist/es/internal/Danger-KM8BZjue.js +18 -0
  324. package/dist/es/internal/Discord-CAS0Cj7s-yLPKWGq1.js +31 -0
  325. package/dist/es/internal/Discord-CAS0Cj7s.js +31 -0
  326. package/dist/es/internal/Drive-GMcgBcIY-GMcgBcIY.js +7 -0
  327. package/dist/es/internal/Drive-GMcgBcIY.js +7 -0
  328. package/dist/es/internal/Edit-Dr-ZiMSE-Dr-ZiMSE.js +17 -0
  329. package/dist/es/internal/Edit-Dr-ZiMSE.js +17 -0
  330. package/dist/es/internal/Ellipsis-XK8AwMEC-BxcN5fLL.js +7 -0
  331. package/dist/es/internal/Ellipsis-XK8AwMEC.js +7 -0
  332. package/dist/es/internal/Error-BmIZ2ZUy-CMRuIFZq.js +7 -0
  333. package/dist/es/internal/Error-BmIZ2ZUy.js +7 -0
  334. package/dist/es/internal/Exclamation-CVsNS_QS-C1KPXw1i.js +10 -0
  335. package/dist/es/internal/Exclamation-CVsNS_QS.js +10 -0
  336. package/dist/es/internal/File-Ba7ClyaL-DtY9HGnM.js +24 -0
  337. package/dist/es/internal/File-Ba7ClyaL.js +24 -0
  338. package/dist/es/internal/FilesEarmark-CyrCQy8E-CFdJj_Ef.js +7 -0
  339. package/dist/es/internal/FilesEarmark-CyrCQy8E.js +7 -0
  340. package/dist/es/internal/FolderClose-DG_qHisc-CjzpbiGq.js +13 -0
  341. package/dist/es/internal/FolderClose-DG_qHisc.js +13 -0
  342. package/dist/es/internal/FolderOpen-kDoWFkJO-Bn5p8fQc.js +7 -0
  343. package/dist/es/internal/FolderOpen-kDoWFkJO.js +7 -0
  344. package/dist/es/internal/FolderPlus-CSBSl9lZ-bZtX6Tjv.js +7 -0
  345. package/dist/es/internal/FolderPlus-CSBSl9lZ.js +7 -0
  346. package/dist/es/internal/Forum-DZ-CkLFh-CQZwkSpr.js +22 -0
  347. package/dist/es/internal/Forum-DZ-CkLFh.js +22 -0
  348. package/dist/es/internal/Gear-cUlHJ4q6-xBCayUOx.js +7 -0
  349. package/dist/es/internal/Gear-cUlHJ4q6.js +7 -0
  350. package/dist/es/internal/Github-0PLiINY0-0PLiINY0.js +24 -0
  351. package/dist/es/internal/Github-0PLiINY0.js +24 -0
  352. package/dist/es/internal/Globe-CIYqVkpa-BWKtmqX7.js +7 -0
  353. package/dist/es/internal/Globe-CIYqVkpa.js +7 -0
  354. package/dist/es/internal/GlobeWww-DN4yKujh-DN4yKujh.js +22 -0
  355. package/dist/es/internal/GlobeWww-DN4yKujh.js +22 -0
  356. package/dist/es/internal/Hdd-Dn_LdJIh-rEELfcXk.js +7 -0
  357. package/dist/es/internal/Hdd-Dn_LdJIh.js +7 -0
  358. package/dist/es/internal/History-BP4SmaS_-B3nr_8wA.js +7 -0
  359. package/dist/es/internal/History-BP4SmaS_.js +7 -0
  360. package/dist/es/internal/InfoSquare-C98JaLiz-HKSzAVMC.js +7 -0
  361. package/dist/es/internal/InfoSquare-C98JaLiz.js +7 -0
  362. package/dist/es/internal/Link-BF7aZjVu-BF7aZjVu.js +14 -0
  363. package/dist/es/internal/Link-BF7aZjVu.js +14 -0
  364. package/dist/es/internal/Linkedin-DJwIkS6q-Crs3Irac.js +22 -0
  365. package/dist/es/internal/Linkedin-DJwIkS6q.js +22 -0
  366. package/dist/es/internal/Lock-PyaFHdNS-CjctedsI.js +7 -0
  367. package/dist/es/internal/Lock-PyaFHdNS.js +7 -0
  368. package/dist/es/internal/M-DozhhPMY-DdLfGV1p.js +22 -0
  369. package/dist/es/internal/M-DozhhPMY.js +22 -0
  370. package/dist/es/internal/PackageManager-B-MUWliB-CcDykGr_.js +17 -0
  371. package/dist/es/internal/PackageManager-B-MUWliB.js +17 -0
  372. package/dist/es/internal/Pencil-D7lvxXIP-D7lvxXIP.js +7 -0
  373. package/dist/es/internal/Pencil-D7lvxXIP.js +7 -0
  374. package/dist/es/internal/People-CUB8LYKf-g6-Xfp-P.js +7 -0
  375. package/dist/es/internal/People-CUB8LYKf.js +7 -0
  376. package/dist/es/internal/Person-DuL4PQzm-oe7ryXw3.js +7 -0
  377. package/dist/es/internal/Person-DuL4PQzm.js +7 -0
  378. package/dist/es/internal/Pin-DF70btCU-DF70btCU.js +24 -0
  379. package/dist/es/internal/Pin-DF70btCU.js +24 -0
  380. package/dist/es/internal/PinFilled-vImzS0do-vImzS0do.js +35 -0
  381. package/dist/es/internal/PinFilled-vImzS0do.js +35 -0
  382. package/dist/es/internal/Plus-DPFWGJM4-DzRk_2FJ.js +7 -0
  383. package/dist/es/internal/Plus-DPFWGJM4.js +7 -0
  384. package/dist/es/internal/PlusCircle-BEnWRjHa-DDBhtgAb.js +7 -0
  385. package/dist/es/internal/PlusCircle-BEnWRjHa.js +7 -0
  386. package/dist/es/internal/PlusSquare-CspgRMoS-CspgRMoS.js +24 -0
  387. package/dist/es/internal/PlusSquare-CspgRMoS.js +24 -0
  388. package/dist/es/internal/PowerhouseLogoSmall-CmO95IAS-BE2CSjQW.js +14 -0
  389. package/dist/es/internal/PowerhouseLogoSmall-CmO95IAS.js +14 -0
  390. package/dist/es/internal/Project-BlXuclr0-BlXuclr0.js +7 -0
  391. package/dist/es/internal/Project-BlXuclr0.js +7 -0
  392. package/dist/es/internal/QuestionSquare-B6O9Le7r-B6O9Le7r.js +17 -0
  393. package/dist/es/internal/QuestionSquare-B6O9Le7r.js +17 -0
  394. package/dist/es/internal/RedoArrow-BJeEsiph-DfF6uUVe.js +7 -0
  395. package/dist/es/internal/RedoArrow-BJeEsiph.js +7 -0
  396. package/dist/es/internal/Reload-6C2CYgrl-6C2CYgrl.js +14 -0
  397. package/dist/es/internal/Reload-6C2CYgrl.js +14 -0
  398. package/dist/es/internal/Renown-6m7hx37h-6m7hx37h.js +15 -0
  399. package/dist/es/internal/Renown-6m7hx37h.js +15 -0
  400. package/dist/es/internal/RenownHover-CQ0TZHZv-CQ0TZHZv.js +21 -0
  401. package/dist/es/internal/RenownHover-CQ0TZHZv.js +21 -0
  402. package/dist/es/internal/Ring-DKv0gnwT-vTRkEhSD.js +7 -0
  403. package/dist/es/internal/Ring-DKv0gnwT.js +7 -0
  404. package/dist/es/internal/Save-BBxj68pn-aWwVVXw7.js +7 -0
  405. package/dist/es/internal/Save-BBxj68pn.js +7 -0
  406. package/dist/es/internal/Search-YUJuRBLe-BmhJyjR6.js +7 -0
  407. package/dist/es/internal/Search-YUJuRBLe.js +7 -0
  408. package/dist/es/internal/Server-Bfkkjui1-BwKF1iDk.js +7 -0
  409. package/dist/es/internal/Server-Bfkkjui1.js +7 -0
  410. package/dist/es/internal/Settings-mbbylBS5-mbbylBS5.js +24 -0
  411. package/dist/es/internal/Settings-mbbylBS5.js +24 -0
  412. package/dist/es/internal/Synced-DKJXzPiw-CqMhhyM5.js +7 -0
  413. package/dist/es/internal/Synced-DKJXzPiw.js +7 -0
  414. package/dist/es/internal/Syncing-aT9WSMFf-BWTCrS3p.js +7 -0
  415. package/dist/es/internal/Syncing-aT9WSMFf.js +7 -0
  416. package/dist/es/internal/Trash-CgSbHk-P-Dh-c5Met.js +7 -0
  417. package/dist/es/internal/Trash-CgSbHk-P.js +7 -0
  418. package/dist/es/internal/TrashFill-DN50ercb-Dpxm9akA.js +7 -0
  419. package/dist/es/internal/TrashFill-DN50ercb.js +7 -0
  420. package/dist/es/internal/TreeViewSlash-BywCsx5o-BSzPhf8C.js +43 -0
  421. package/dist/es/internal/TreeViewSlash-BywCsx5o.js +43 -0
  422. package/dist/es/internal/TriangleDown-eCXwUfu8-DqHoyiNd.js +25 -0
  423. package/dist/es/internal/TriangleDown-eCXwUfu8.js +25 -0
  424. package/dist/es/internal/VariantArrowLeft-CnuX59_e-DFRqg5rx.js +7 -0
  425. package/dist/es/internal/VariantArrowLeft-CnuX59_e.js +7 -0
  426. package/dist/es/internal/VerticalDots-C8QYf7et-Kxp4UvO-.js +7 -0
  427. package/dist/es/internal/VerticalDots-C8QYf7et.js +7 -0
  428. package/dist/es/internal/WarningFill-WowAvi5P-DyzPgci7.js +7 -0
  429. package/dist/es/internal/WarningFill-WowAvi5P.js +7 -0
  430. package/dist/es/internal/XTwitter-k3Pt8itk-4crDLOC9.js +22 -0
  431. package/dist/es/internal/XTwitter-k3Pt8itk.js +22 -0
  432. package/dist/es/internal/Xmark-8qnJCs2Y-8qnJCs2Y.js +14 -0
  433. package/dist/es/internal/Xmark-8qnJCs2Y.js +14 -0
  434. package/dist/es/internal/XmarkLight-GHzDR5_F-DDNgDNwu.js +7 -0
  435. package/dist/es/internal/XmarkLight-GHzDR5_F.js +7 -0
  436. package/dist/es/internal/Youtube-i8V0IXUU-CewHZSfQ.js +24 -0
  437. package/dist/es/internal/Youtube-i8V0IXUU.js +24 -0
  438. package/dist/es/internal/index-D8zPFcDT.js +8 -0
  439. package/dist/es/internal/index-h1eFus3x.js +8 -0
  440. package/dist/es/package.json +1 -0
  441. package/dist/es/storybook.js +59348 -0
  442. package/dist/es/utils/lazy-with-preload.js +23 -0
  443. package/dist/index.d.ts +6 -0
  444. package/dist/postcss.config.d.ts +7 -0
  445. package/dist/processors/index.d.ts +0 -0
  446. package/dist/scripts/index.d.ts +1 -0
  447. package/dist/storybook.d.ts +1 -0
  448. package/dist/subgraphs/index.d.ts +0 -0
  449. package/dist/tailwind.config.d.ts +226 -0
  450. package/dist/vite.config.d.ts +2 -0
  451. package/package.json +134 -0
@@ -0,0 +1,4173 @@
1
+ var Wt = Object.defineProperty;
2
+ var Yt = (n, e, t) => e in n ? Wt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var ot = (n, e, t) => Yt(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { utils as O, BaseDocument as Me, applyMixins as Jt, actions as Kt } from "document-model/document";
5
+ import { generateId as Qt } from "document-model/utils";
6
+ const Xt = {
7
+ id: "powerhouse/document-drive",
8
+ name: "DocumentDrive",
9
+ extension: "phdd",
10
+ description: "",
11
+ author: {
12
+ name: "Powerhouse Inc",
13
+ website: "https://www.powerhouse.inc/"
14
+ },
15
+ specifications: [
16
+ {
17
+ version: 1,
18
+ changeLog: [],
19
+ state: {
20
+ global: {
21
+ schema: `type FolderNode {
22
+ id: String!
23
+ name: String!
24
+ kind: String!
25
+ parentFolder: String
26
+ }
27
+
28
+ type SynchronizationUnit {
29
+ syncId: ID!
30
+ scope: String!
31
+ branch: String!
32
+ }
33
+
34
+ type FileNode {
35
+ id: String!
36
+ name: String!
37
+ kind: String!
38
+ documentType: String!
39
+ parentFolder: String
40
+ synchronizationUnits: [SynchronizationUnit!]!
41
+ }
42
+
43
+ union Node = FolderNode | FileNode
44
+
45
+ type DocumentDriveState {
46
+ id: ID!
47
+ name: String!
48
+ nodes: [Node!]!
49
+ icon: String
50
+ slug: String
51
+ }`,
52
+ initialValue: '"{\\"id\\":\\"\\",\\"name\\":\\"\\",\\"nodes\\":[],\\"icon\\":null,\\"slug\\":null}"',
53
+ examples: []
54
+ },
55
+ local: {
56
+ schema: `type ListenerFilter {
57
+ documentType: [String!]!
58
+ documentId: [ID!]
59
+ scope: [String!]
60
+ branch: [String!]
61
+ }
62
+
63
+ enum TransmitterType {
64
+ Internal,
65
+ SwitchboardPush,
66
+ PullResponder,
67
+ SecureConnect,
68
+ MatrixConnect,
69
+ RESTWebhook
70
+ }
71
+
72
+ type ListenerCallInfo {
73
+ transmitterType: TransmitterType
74
+ name: String
75
+ data: String
76
+ }
77
+
78
+ type Listener {
79
+ listenerId: ID!
80
+ label: String
81
+ block: Boolean!
82
+ system: Boolean!
83
+ filter: ListenerFilter!
84
+ callInfo: ListenerCallInfo
85
+ }
86
+
87
+ enum TriggerType {
88
+ PullResponder
89
+ }
90
+
91
+ type PullResponderTriggerData {
92
+ listenerId: ID!
93
+ url: String!
94
+ interval: String!
95
+ }
96
+
97
+ union TriggerData = PullResponderTriggerData
98
+
99
+ type Trigger {
100
+ id: ID!
101
+ type: TriggerType!
102
+ data: TriggerData
103
+ }
104
+
105
+ type DocumentDriveLocalState{
106
+ sharingType: String
107
+ listeners: [Listener!]!
108
+ triggers: [Trigger!]!
109
+ availableOffline: Boolean!
110
+ }`,
111
+ initialValue: '"{ \\"listeners\\": [], \\"triggers\\": [], \\"sharingType\\": \\"private\\", \\"availableOffline\\": false}"',
112
+ examples: []
113
+ }
114
+ },
115
+ modules: [
116
+ {
117
+ id: "GRzuvv78tBvmB6ciitokLfonNHA=",
118
+ name: "Node",
119
+ description: "",
120
+ operations: [
121
+ {
122
+ id: "7xiTdxonc9yEASR8sfV/KnbSV10=",
123
+ name: "ADD_FILE",
124
+ description: "",
125
+ schema: `input AddFileInput {
126
+ id: ID!
127
+ name: String!
128
+ documentType: String!
129
+ parentFolder: ID
130
+ synchronizationUnits: [SynchronizationUnit!]!
131
+ }`,
132
+ template: "",
133
+ reducer: "",
134
+ errors: [],
135
+ examples: [],
136
+ scope: "global"
137
+ },
138
+ {
139
+ id: "4lzNMMKKdIAtEU6i12xLgi9hp+U=",
140
+ name: "ADD_FOLDER",
141
+ description: "",
142
+ schema: `input AddFolderInput {
143
+ id: ID!
144
+ name: String!
145
+ parentFolder: ID
146
+ }`,
147
+ template: "",
148
+ reducer: "",
149
+ errors: [],
150
+ examples: [],
151
+ scope: "global"
152
+ },
153
+ {
154
+ id: "53jH2/3TWTTcgCJiv2C+BmuC6i0=",
155
+ name: "DELETE_NODE",
156
+ description: "",
157
+ schema: `input DeleteNodeInput {
158
+ id: ID!
159
+ }`,
160
+ template: "",
161
+ reducer: "",
162
+ errors: [],
163
+ examples: [],
164
+ scope: "global"
165
+ },
166
+ {
167
+ id: "pNn+Y1/HVq/GNMk7t0u3g3gtMLE=",
168
+ name: "UPDATE_FILE",
169
+ description: "",
170
+ schema: `input UpdateFileInput {
171
+ id: ID!
172
+ parentFolder: ID
173
+ name: String
174
+ documentType: String
175
+ }`,
176
+ template: "",
177
+ reducer: "",
178
+ errors: [],
179
+ examples: [],
180
+ scope: "global"
181
+ },
182
+ {
183
+ id: "P0x1M8Mnt+Q/+9nggkwgVbfybsc=",
184
+ name: "UPDATE_NODE",
185
+ description: "",
186
+ schema: `input UpdateNodeInput {
187
+ id: ID!
188
+ parentFolder: ID
189
+ name: String
190
+ }`,
191
+ template: "",
192
+ reducer: "",
193
+ errors: [],
194
+ examples: [],
195
+ scope: "global"
196
+ },
197
+ {
198
+ id: "vnQ7OB5b3wGLgjhbgJqAIpA+JLE=",
199
+ name: "COPY_NODE",
200
+ description: "",
201
+ schema: `input CopyNodeInput {
202
+ srcId: ID!
203
+ targetId: ID!
204
+ targetName: String
205
+ targetParentFolder: ID
206
+ synchronizationUnits: [SynchronizationUnit!]
207
+ }`,
208
+ template: "",
209
+ reducer: "",
210
+ errors: [],
211
+ examples: [],
212
+ scope: "global"
213
+ },
214
+ {
215
+ id: "VNyiD/sNGzk6k9A1Qe7s8dmrJxA=",
216
+ name: "MOVE_NODE",
217
+ description: "",
218
+ schema: `input MoveNodeInput {
219
+ srcFolder: ID!
220
+ targetParentFolder: ID
221
+ }`,
222
+ template: "",
223
+ reducer: "",
224
+ errors: [],
225
+ examples: [],
226
+ scope: "global"
227
+ }
228
+ ]
229
+ },
230
+ {
231
+ id: "0dHwHlxOM9x0vMZ+gLnKxf2qTEo=",
232
+ name: "Drive",
233
+ description: "",
234
+ operations: [
235
+ {
236
+ id: "qGCiPGpTt/cyz3HzyrBn92z1dsU=",
237
+ name: "SET_DRIVE_NAME",
238
+ description: "",
239
+ schema: `input SetDriveNameInput {
240
+ name: String!
241
+ }`,
242
+ template: "",
243
+ reducer: "",
244
+ errors: [],
245
+ examples: [],
246
+ scope: "global"
247
+ },
248
+ {
249
+ id: "qGCiPGpTt/cyz3HzyrBn92z30dsU=",
250
+ name: "SET_DRIVE_ICON",
251
+ description: "",
252
+ schema: `input SetDriveIconInput {
253
+ icon: String!
254
+ }`,
255
+ template: "",
256
+ reducer: "",
257
+ errors: [],
258
+ examples: [],
259
+ scope: "global"
260
+ },
261
+ {
262
+ id: "qGCiPGpTt/cyz3HzyrBn92z2dsU=",
263
+ name: "SET_SHARING_TYPE",
264
+ description: "",
265
+ schema: `input SetSharingTypeInput {
266
+ type: String!
267
+ }`,
268
+ template: "",
269
+ reducer: "",
270
+ errors: [],
271
+ examples: [],
272
+ scope: "local"
273
+ },
274
+ {
275
+ id: "qGCiPGpTt/cyz3HzyrBn92z3dsU=",
276
+ name: "SET_AVAILABLE_OFFLINE",
277
+ description: "",
278
+ schema: `input SetAvailableOfflineInput {
279
+ availableOffline: Boolean!
280
+ }`,
281
+ template: "",
282
+ reducer: "",
283
+ errors: [],
284
+ examples: [],
285
+ scope: "local"
286
+ },
287
+ {
288
+ id: "qGCiPGpTt/cyz3HzyrBn92z9dsU=",
289
+ name: "ADD_LISTENER",
290
+ description: "",
291
+ schema: `input AddListenerInput {
292
+ listener: Listener!
293
+ }`,
294
+ template: "",
295
+ reducer: "",
296
+ errors: [],
297
+ examples: [],
298
+ scope: "local"
299
+ },
300
+ {
301
+ id: "qGCiPGpTt/cyz3HzyrBn92z10dsU=",
302
+ name: "REMOVE_LISTENER",
303
+ description: "",
304
+ schema: `input RemoveListenerInput {
305
+ listenerId: String!
306
+ }`,
307
+ template: "",
308
+ reducer: "",
309
+ errors: [],
310
+ examples: [],
311
+ scope: "local"
312
+ },
313
+ {
314
+ id: "qGCiPGpTt/cyz3HzyrBn92z20dsU=",
315
+ name: "ADD_TRIGGER",
316
+ description: "",
317
+ schema: `input AddTriggerInput {
318
+ trigger: Trigger!
319
+ }`,
320
+ template: "",
321
+ reducer: "",
322
+ errors: [],
323
+ examples: [],
324
+ scope: "local"
325
+ },
326
+ {
327
+ id: "qGCiPGpTt/cyz3HzyrBn92z30dsU=",
328
+ name: "REMOVE_TRIGGER",
329
+ description: "",
330
+ schema: `input RemoveTriggerInput {
331
+ triggerId: String!
332
+ }`,
333
+ template: "",
334
+ reducer: "",
335
+ errors: [],
336
+ examples: [],
337
+ scope: "local"
338
+ }
339
+ ]
340
+ }
341
+ ]
342
+ }
343
+ ]
344
+ };
345
+ var b;
346
+ (function(n) {
347
+ n.assertEqual = (s) => s;
348
+ function e(s) {
349
+ }
350
+ n.assertIs = e;
351
+ function t(s) {
352
+ throw new Error();
353
+ }
354
+ n.assertNever = t, n.arrayToEnum = (s) => {
355
+ const a = {};
356
+ for (const i of s)
357
+ a[i] = i;
358
+ return a;
359
+ }, n.getValidEnumValues = (s) => {
360
+ const a = n.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
361
+ for (const o of a)
362
+ i[o] = s[o];
363
+ return n.objectValues(i);
364
+ }, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
365
+ return s[a];
366
+ }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
367
+ const a = [];
368
+ for (const i in s)
369
+ Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
370
+ return a;
371
+ }, n.find = (s, a) => {
372
+ for (const i of s)
373
+ if (a(i))
374
+ return i;
375
+ }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
376
+ function r(s, a = " | ") {
377
+ return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
378
+ }
379
+ n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
380
+ })(b || (b = {}));
381
+ var je;
382
+ (function(n) {
383
+ n.mergeShapes = (e, t) => ({
384
+ ...e,
385
+ ...t
386
+ // second overwrites first
387
+ });
388
+ })(je || (je = {}));
389
+ const p = b.arrayToEnum([
390
+ "string",
391
+ "nan",
392
+ "number",
393
+ "integer",
394
+ "float",
395
+ "boolean",
396
+ "date",
397
+ "bigint",
398
+ "symbol",
399
+ "function",
400
+ "undefined",
401
+ "null",
402
+ "array",
403
+ "object",
404
+ "unknown",
405
+ "promise",
406
+ "void",
407
+ "never",
408
+ "map",
409
+ "set"
410
+ ]), Z = (n) => {
411
+ switch (typeof n) {
412
+ case "undefined":
413
+ return p.undefined;
414
+ case "string":
415
+ return p.string;
416
+ case "number":
417
+ return isNaN(n) ? p.nan : p.number;
418
+ case "boolean":
419
+ return p.boolean;
420
+ case "function":
421
+ return p.function;
422
+ case "bigint":
423
+ return p.bigint;
424
+ case "symbol":
425
+ return p.symbol;
426
+ case "object":
427
+ return Array.isArray(n) ? p.array : n === null ? p.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? p.promise : typeof Map < "u" && n instanceof Map ? p.map : typeof Set < "u" && n instanceof Set ? p.set : typeof Date < "u" && n instanceof Date ? p.date : p.object;
428
+ default:
429
+ return p.unknown;
430
+ }
431
+ }, c = b.arrayToEnum([
432
+ "invalid_type",
433
+ "invalid_literal",
434
+ "custom",
435
+ "invalid_union",
436
+ "invalid_union_discriminator",
437
+ "invalid_enum_value",
438
+ "unrecognized_keys",
439
+ "invalid_arguments",
440
+ "invalid_return_type",
441
+ "invalid_date",
442
+ "invalid_string",
443
+ "too_small",
444
+ "too_big",
445
+ "invalid_intersection_types",
446
+ "not_multiple_of",
447
+ "not_finite"
448
+ ]), en = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
449
+ class I extends Error {
450
+ get errors() {
451
+ return this.issues;
452
+ }
453
+ constructor(e) {
454
+ super(), this.issues = [], this.addIssue = (r) => {
455
+ this.issues = [...this.issues, r];
456
+ }, this.addIssues = (r = []) => {
457
+ this.issues = [...this.issues, ...r];
458
+ };
459
+ const t = new.target.prototype;
460
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
461
+ }
462
+ format(e) {
463
+ const t = e || function(a) {
464
+ return a.message;
465
+ }, r = { _errors: [] }, s = (a) => {
466
+ for (const i of a.issues)
467
+ if (i.code === "invalid_union")
468
+ i.unionErrors.map(s);
469
+ else if (i.code === "invalid_return_type")
470
+ s(i.returnTypeError);
471
+ else if (i.code === "invalid_arguments")
472
+ s(i.argumentsError);
473
+ else if (i.path.length === 0)
474
+ r._errors.push(t(i));
475
+ else {
476
+ let o = r, u = 0;
477
+ for (; u < i.path.length; ) {
478
+ const l = i.path[u];
479
+ u === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(t(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], u++;
480
+ }
481
+ }
482
+ };
483
+ return s(this), r;
484
+ }
485
+ static assert(e) {
486
+ if (!(e instanceof I))
487
+ throw new Error(`Not a ZodError: ${e}`);
488
+ }
489
+ toString() {
490
+ return this.message;
491
+ }
492
+ get message() {
493
+ return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
494
+ }
495
+ get isEmpty() {
496
+ return this.issues.length === 0;
497
+ }
498
+ flatten(e = (t) => t.message) {
499
+ const t = {}, r = [];
500
+ for (const s of this.issues)
501
+ s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s));
502
+ return { formErrors: r, fieldErrors: t };
503
+ }
504
+ get formErrors() {
505
+ return this.flatten();
506
+ }
507
+ }
508
+ I.create = (n) => new I(n);
509
+ const X = (n, e) => {
510
+ let t;
511
+ switch (n.code) {
512
+ case c.invalid_type:
513
+ n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
514
+ break;
515
+ case c.invalid_literal:
516
+ t = `Invalid literal value, expected ${JSON.stringify(n.expected, b.jsonStringifyReplacer)}`;
517
+ break;
518
+ case c.unrecognized_keys:
519
+ t = `Unrecognized key(s) in object: ${b.joinValues(n.keys, ", ")}`;
520
+ break;
521
+ case c.invalid_union:
522
+ t = "Invalid input";
523
+ break;
524
+ case c.invalid_union_discriminator:
525
+ t = `Invalid discriminator value. Expected ${b.joinValues(n.options)}`;
526
+ break;
527
+ case c.invalid_enum_value:
528
+ t = `Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;
529
+ break;
530
+ case c.invalid_arguments:
531
+ t = "Invalid function arguments";
532
+ break;
533
+ case c.invalid_return_type:
534
+ t = "Invalid function return type";
535
+ break;
536
+ case c.invalid_date:
537
+ t = "Invalid date";
538
+ break;
539
+ case c.invalid_string:
540
+ typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : b.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
541
+ break;
542
+ case c.too_small:
543
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
544
+ break;
545
+ case c.too_big:
546
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
547
+ break;
548
+ case c.custom:
549
+ t = "Invalid input";
550
+ break;
551
+ case c.invalid_intersection_types:
552
+ t = "Intersection results could not be merged";
553
+ break;
554
+ case c.not_multiple_of:
555
+ t = `Number must be a multiple of ${n.multipleOf}`;
556
+ break;
557
+ case c.not_finite:
558
+ t = "Number must be finite";
559
+ break;
560
+ default:
561
+ t = e.defaultError, b.assertNever(n);
562
+ }
563
+ return { message: t };
564
+ };
565
+ let ut = X;
566
+ function tn(n) {
567
+ ut = n;
568
+ }
569
+ function xe() {
570
+ return ut;
571
+ }
572
+ const ke = (n) => {
573
+ const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], i = {
574
+ ...s,
575
+ path: a
576
+ };
577
+ if (s.message !== void 0)
578
+ return {
579
+ ...s,
580
+ path: a,
581
+ message: s.message
582
+ };
583
+ let o = "";
584
+ const u = r.filter((l) => !!l).slice().reverse();
585
+ for (const l of u)
586
+ o = l(i, { data: e, defaultError: o }).message;
587
+ return {
588
+ ...s,
589
+ path: a,
590
+ message: o
591
+ };
592
+ }, nn = [];
593
+ function f(n, e) {
594
+ const t = xe(), r = ke({
595
+ issueData: e,
596
+ data: n.data,
597
+ path: n.path,
598
+ errorMaps: [
599
+ n.common.contextualErrorMap,
600
+ // contextual error map is first priority
601
+ n.schemaErrorMap,
602
+ // then schema-bound map if available
603
+ t,
604
+ // then global override map
605
+ t === X ? void 0 : X
606
+ // then global default map
607
+ ].filter((s) => !!s)
608
+ });
609
+ n.common.issues.push(r);
610
+ }
611
+ class k {
612
+ constructor() {
613
+ this.value = "valid";
614
+ }
615
+ dirty() {
616
+ this.value === "valid" && (this.value = "dirty");
617
+ }
618
+ abort() {
619
+ this.value !== "aborted" && (this.value = "aborted");
620
+ }
621
+ static mergeArray(e, t) {
622
+ const r = [];
623
+ for (const s of t) {
624
+ if (s.status === "aborted")
625
+ return y;
626
+ s.status === "dirty" && e.dirty(), r.push(s.value);
627
+ }
628
+ return { status: e.value, value: r };
629
+ }
630
+ static async mergeObjectAsync(e, t) {
631
+ const r = [];
632
+ for (const s of t) {
633
+ const a = await s.key, i = await s.value;
634
+ r.push({
635
+ key: a,
636
+ value: i
637
+ });
638
+ }
639
+ return k.mergeObjectSync(e, r);
640
+ }
641
+ static mergeObjectSync(e, t) {
642
+ const r = {};
643
+ for (const s of t) {
644
+ const { key: a, value: i } = s;
645
+ if (a.status === "aborted" || i.status === "aborted")
646
+ return y;
647
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (r[a.value] = i.value);
648
+ }
649
+ return { status: e.value, value: r };
650
+ }
651
+ }
652
+ const y = Object.freeze({
653
+ status: "aborted"
654
+ }), K = (n) => ({ status: "dirty", value: n }), w = (n) => ({ status: "valid", value: n }), Pe = (n) => n.status === "aborted", ze = (n) => n.status === "dirty", H = (n) => n.status === "valid", ae = (n) => typeof Promise < "u" && n instanceof Promise;
655
+ function Te(n, e, t, r) {
656
+ if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
657
+ return e.get(n);
658
+ }
659
+ function lt(n, e, t, r, s) {
660
+ if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
661
+ return e.set(n, t), t;
662
+ }
663
+ var h;
664
+ (function(n) {
665
+ n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
666
+ })(h || (h = {}));
667
+ var ne, re;
668
+ class C {
669
+ constructor(e, t, r, s) {
670
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
671
+ }
672
+ get path() {
673
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
674
+ }
675
+ }
676
+ const dt = (n, e) => {
677
+ if (H(e))
678
+ return { success: !0, data: e.value };
679
+ if (!n.common.issues.length)
680
+ throw new Error("Validation failed but no issues detected.");
681
+ return {
682
+ success: !1,
683
+ get error() {
684
+ if (this._error)
685
+ return this._error;
686
+ const t = new I(n.common.issues);
687
+ return this._error = t, this._error;
688
+ }
689
+ };
690
+ };
691
+ function _(n) {
692
+ if (!n)
693
+ return {};
694
+ const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
695
+ if (e && (t || r))
696
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
697
+ return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
698
+ var u, l;
699
+ const { message: m } = n;
700
+ return i.code === "invalid_enum_value" ? { message: m ?? o.defaultError } : typeof o.data > "u" ? { message: (u = m ?? r) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (l = m ?? t) !== null && l !== void 0 ? l : o.defaultError };
701
+ }, description: s };
702
+ }
703
+ class v {
704
+ get description() {
705
+ return this._def.description;
706
+ }
707
+ _getType(e) {
708
+ return Z(e.data);
709
+ }
710
+ _getOrReturnCtx(e, t) {
711
+ return t || {
712
+ common: e.parent.common,
713
+ data: e.data,
714
+ parsedType: Z(e.data),
715
+ schemaErrorMap: this._def.errorMap,
716
+ path: e.path,
717
+ parent: e.parent
718
+ };
719
+ }
720
+ _processInputParams(e) {
721
+ return {
722
+ status: new k(),
723
+ ctx: {
724
+ common: e.parent.common,
725
+ data: e.data,
726
+ parsedType: Z(e.data),
727
+ schemaErrorMap: this._def.errorMap,
728
+ path: e.path,
729
+ parent: e.parent
730
+ }
731
+ };
732
+ }
733
+ _parseSync(e) {
734
+ const t = this._parse(e);
735
+ if (ae(t))
736
+ throw new Error("Synchronous parse encountered promise.");
737
+ return t;
738
+ }
739
+ _parseAsync(e) {
740
+ const t = this._parse(e);
741
+ return Promise.resolve(t);
742
+ }
743
+ parse(e, t) {
744
+ const r = this.safeParse(e, t);
745
+ if (r.success)
746
+ return r.data;
747
+ throw r.error;
748
+ }
749
+ safeParse(e, t) {
750
+ var r;
751
+ const s = {
752
+ common: {
753
+ issues: [],
754
+ async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
755
+ contextualErrorMap: t == null ? void 0 : t.errorMap
756
+ },
757
+ path: (t == null ? void 0 : t.path) || [],
758
+ schemaErrorMap: this._def.errorMap,
759
+ parent: null,
760
+ data: e,
761
+ parsedType: Z(e)
762
+ }, a = this._parseSync({ data: e, path: s.path, parent: s });
763
+ return dt(s, a);
764
+ }
765
+ "~validate"(e) {
766
+ var t, r;
767
+ const s = {
768
+ common: {
769
+ issues: [],
770
+ async: !!this["~standard"].async
771
+ },
772
+ path: [],
773
+ schemaErrorMap: this._def.errorMap,
774
+ parent: null,
775
+ data: e,
776
+ parsedType: Z(e)
777
+ };
778
+ if (!this["~standard"].async)
779
+ try {
780
+ const a = this._parseSync({ data: e, path: [], parent: s });
781
+ return H(a) ? {
782
+ value: a.value
783
+ } : {
784
+ issues: s.common.issues
785
+ };
786
+ } catch (a) {
787
+ !((r = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || r === void 0) && r.includes("encountered") && (this["~standard"].async = !0), s.common = {
788
+ issues: [],
789
+ async: !0
790
+ };
791
+ }
792
+ return this._parseAsync({ data: e, path: [], parent: s }).then((a) => H(a) ? {
793
+ value: a.value
794
+ } : {
795
+ issues: s.common.issues
796
+ });
797
+ }
798
+ async parseAsync(e, t) {
799
+ const r = await this.safeParseAsync(e, t);
800
+ if (r.success)
801
+ return r.data;
802
+ throw r.error;
803
+ }
804
+ async safeParseAsync(e, t) {
805
+ const r = {
806
+ common: {
807
+ issues: [],
808
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
809
+ async: !0
810
+ },
811
+ path: (t == null ? void 0 : t.path) || [],
812
+ schemaErrorMap: this._def.errorMap,
813
+ parent: null,
814
+ data: e,
815
+ parsedType: Z(e)
816
+ }, s = this._parse({ data: e, path: r.path, parent: r }), a = await (ae(s) ? s : Promise.resolve(s));
817
+ return dt(r, a);
818
+ }
819
+ refine(e, t) {
820
+ const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
821
+ return this._refinement((s, a) => {
822
+ const i = e(s), o = () => a.addIssue({
823
+ code: c.custom,
824
+ ...r(s)
825
+ });
826
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
827
+ });
828
+ }
829
+ refinement(e, t) {
830
+ return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
831
+ }
832
+ _refinement(e) {
833
+ return new N({
834
+ schema: this,
835
+ typeName: g.ZodEffects,
836
+ effect: { type: "refinement", refinement: e }
837
+ });
838
+ }
839
+ superRefine(e) {
840
+ return this._refinement(e);
841
+ }
842
+ constructor(e) {
843
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
844
+ version: 1,
845
+ vendor: "zod",
846
+ validate: (t) => this["~validate"](t)
847
+ };
848
+ }
849
+ optional() {
850
+ return A.create(this, this._def);
851
+ }
852
+ nullable() {
853
+ return $.create(this, this._def);
854
+ }
855
+ nullish() {
856
+ return this.nullable().optional();
857
+ }
858
+ array() {
859
+ return E.create(this);
860
+ }
861
+ promise() {
862
+ return te.create(this, this._def);
863
+ }
864
+ or(e) {
865
+ return ce.create([this, e], this._def);
866
+ }
867
+ and(e) {
868
+ return ue.create(this, e, this._def);
869
+ }
870
+ transform(e) {
871
+ return new N({
872
+ ..._(this._def),
873
+ schema: this,
874
+ typeName: g.ZodEffects,
875
+ effect: { type: "transform", transform: e }
876
+ });
877
+ }
878
+ default(e) {
879
+ const t = typeof e == "function" ? e : () => e;
880
+ return new me({
881
+ ..._(this._def),
882
+ innerType: this,
883
+ defaultValue: t,
884
+ typeName: g.ZodDefault
885
+ });
886
+ }
887
+ brand() {
888
+ return new $e({
889
+ typeName: g.ZodBranded,
890
+ type: this,
891
+ ..._(this._def)
892
+ });
893
+ }
894
+ catch(e) {
895
+ const t = typeof e == "function" ? e : () => e;
896
+ return new ge({
897
+ ..._(this._def),
898
+ innerType: this,
899
+ catchValue: t,
900
+ typeName: g.ZodCatch
901
+ });
902
+ }
903
+ describe(e) {
904
+ const t = this.constructor;
905
+ return new t({
906
+ ...this._def,
907
+ description: e
908
+ });
909
+ }
910
+ pipe(e) {
911
+ return ve.create(this, e);
912
+ }
913
+ readonly() {
914
+ return ye.create(this);
915
+ }
916
+ isOptional() {
917
+ return this.safeParse(void 0).success;
918
+ }
919
+ isNullable() {
920
+ return this.safeParse(null).success;
921
+ }
922
+ }
923
+ const rn = /^c[^\s-]{8,}$/i, sn = /^[0-9a-z]+$/, an = /^[0-9A-HJKMNP-TV-Z]{26}$/i, on = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, dn = /^[a-z0-9_-]{21}$/i, cn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, un = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, ln = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, fn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
924
+ let Fe;
925
+ const pn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, hn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, mn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, gn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, yn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, _n = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ft = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", vn = new RegExp(`^${ft}$`);
926
+ function pt(n) {
927
+ let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
928
+ return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
929
+ }
930
+ function bn(n) {
931
+ return new RegExp(`^${pt(n)}$`);
932
+ }
933
+ function ht(n) {
934
+ let e = `${ft}T${pt(n)}`;
935
+ const t = [];
936
+ return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
937
+ }
938
+ function xn(n, e) {
939
+ return !!((e === "v4" || !e) && pn.test(n) || (e === "v6" || !e) && mn.test(n));
940
+ }
941
+ function kn(n, e) {
942
+ if (!cn.test(n))
943
+ return !1;
944
+ try {
945
+ const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
946
+ return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
947
+ } catch {
948
+ return !1;
949
+ }
950
+ }
951
+ function Tn(n, e) {
952
+ return !!((e === "v4" || !e) && hn.test(n) || (e === "v6" || !e) && gn.test(n));
953
+ }
954
+ class S extends v {
955
+ _parse(e) {
956
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
957
+ const a = this._getOrReturnCtx(e);
958
+ return f(a, {
959
+ code: c.invalid_type,
960
+ expected: p.string,
961
+ received: a.parsedType
962
+ }), y;
963
+ }
964
+ const r = new k();
965
+ let s;
966
+ for (const a of this._def.checks)
967
+ if (a.kind === "min")
968
+ e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
969
+ code: c.too_small,
970
+ minimum: a.value,
971
+ type: "string",
972
+ inclusive: !0,
973
+ exact: !1,
974
+ message: a.message
975
+ }), r.dirty());
976
+ else if (a.kind === "max")
977
+ e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
978
+ code: c.too_big,
979
+ maximum: a.value,
980
+ type: "string",
981
+ inclusive: !0,
982
+ exact: !1,
983
+ message: a.message
984
+ }), r.dirty());
985
+ else if (a.kind === "length") {
986
+ const i = e.data.length > a.value, o = e.data.length < a.value;
987
+ (i || o) && (s = this._getOrReturnCtx(e, s), i ? f(s, {
988
+ code: c.too_big,
989
+ maximum: a.value,
990
+ type: "string",
991
+ inclusive: !0,
992
+ exact: !0,
993
+ message: a.message
994
+ }) : o && f(s, {
995
+ code: c.too_small,
996
+ minimum: a.value,
997
+ type: "string",
998
+ inclusive: !0,
999
+ exact: !0,
1000
+ message: a.message
1001
+ }), r.dirty());
1002
+ } else if (a.kind === "email")
1003
+ ln.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1004
+ validation: "email",
1005
+ code: c.invalid_string,
1006
+ message: a.message
1007
+ }), r.dirty());
1008
+ else if (a.kind === "emoji")
1009
+ Fe || (Fe = new RegExp(fn, "u")), Fe.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1010
+ validation: "emoji",
1011
+ code: c.invalid_string,
1012
+ message: a.message
1013
+ }), r.dirty());
1014
+ else if (a.kind === "uuid")
1015
+ on.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1016
+ validation: "uuid",
1017
+ code: c.invalid_string,
1018
+ message: a.message
1019
+ }), r.dirty());
1020
+ else if (a.kind === "nanoid")
1021
+ dn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1022
+ validation: "nanoid",
1023
+ code: c.invalid_string,
1024
+ message: a.message
1025
+ }), r.dirty());
1026
+ else if (a.kind === "cuid")
1027
+ rn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1028
+ validation: "cuid",
1029
+ code: c.invalid_string,
1030
+ message: a.message
1031
+ }), r.dirty());
1032
+ else if (a.kind === "cuid2")
1033
+ sn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1034
+ validation: "cuid2",
1035
+ code: c.invalid_string,
1036
+ message: a.message
1037
+ }), r.dirty());
1038
+ else if (a.kind === "ulid")
1039
+ an.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1040
+ validation: "ulid",
1041
+ code: c.invalid_string,
1042
+ message: a.message
1043
+ }), r.dirty());
1044
+ else if (a.kind === "url")
1045
+ try {
1046
+ new URL(e.data);
1047
+ } catch {
1048
+ s = this._getOrReturnCtx(e, s), f(s, {
1049
+ validation: "url",
1050
+ code: c.invalid_string,
1051
+ message: a.message
1052
+ }), r.dirty();
1053
+ }
1054
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1055
+ validation: "regex",
1056
+ code: c.invalid_string,
1057
+ message: a.message
1058
+ }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), f(s, {
1059
+ code: c.invalid_string,
1060
+ validation: { includes: a.value, position: a.position },
1061
+ message: a.message
1062
+ }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
1063
+ code: c.invalid_string,
1064
+ validation: { startsWith: a.value },
1065
+ message: a.message
1066
+ }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
1067
+ code: c.invalid_string,
1068
+ validation: { endsWith: a.value },
1069
+ message: a.message
1070
+ }), r.dirty()) : a.kind === "datetime" ? ht(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1071
+ code: c.invalid_string,
1072
+ validation: "datetime",
1073
+ message: a.message
1074
+ }), r.dirty()) : a.kind === "date" ? vn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1075
+ code: c.invalid_string,
1076
+ validation: "date",
1077
+ message: a.message
1078
+ }), r.dirty()) : a.kind === "time" ? bn(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1079
+ code: c.invalid_string,
1080
+ validation: "time",
1081
+ message: a.message
1082
+ }), r.dirty()) : a.kind === "duration" ? un.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1083
+ validation: "duration",
1084
+ code: c.invalid_string,
1085
+ message: a.message
1086
+ }), r.dirty()) : a.kind === "ip" ? xn(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
1087
+ validation: "ip",
1088
+ code: c.invalid_string,
1089
+ message: a.message
1090
+ }), r.dirty()) : a.kind === "jwt" ? kn(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
1091
+ validation: "jwt",
1092
+ code: c.invalid_string,
1093
+ message: a.message
1094
+ }), r.dirty()) : a.kind === "cidr" ? Tn(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
1095
+ validation: "cidr",
1096
+ code: c.invalid_string,
1097
+ message: a.message
1098
+ }), r.dirty()) : a.kind === "base64" ? yn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1099
+ validation: "base64",
1100
+ code: c.invalid_string,
1101
+ message: a.message
1102
+ }), r.dirty()) : a.kind === "base64url" ? _n.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
1103
+ validation: "base64url",
1104
+ code: c.invalid_string,
1105
+ message: a.message
1106
+ }), r.dirty()) : b.assertNever(a);
1107
+ return { status: r.value, value: e.data };
1108
+ }
1109
+ _regex(e, t, r) {
1110
+ return this.refinement((s) => e.test(s), {
1111
+ validation: t,
1112
+ code: c.invalid_string,
1113
+ ...h.errToObj(r)
1114
+ });
1115
+ }
1116
+ _addCheck(e) {
1117
+ return new S({
1118
+ ...this._def,
1119
+ checks: [...this._def.checks, e]
1120
+ });
1121
+ }
1122
+ email(e) {
1123
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
1124
+ }
1125
+ url(e) {
1126
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
1127
+ }
1128
+ emoji(e) {
1129
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
1130
+ }
1131
+ uuid(e) {
1132
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
1133
+ }
1134
+ nanoid(e) {
1135
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
1136
+ }
1137
+ cuid(e) {
1138
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
1139
+ }
1140
+ cuid2(e) {
1141
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
1142
+ }
1143
+ ulid(e) {
1144
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
1145
+ }
1146
+ base64(e) {
1147
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
1148
+ }
1149
+ base64url(e) {
1150
+ return this._addCheck({
1151
+ kind: "base64url",
1152
+ ...h.errToObj(e)
1153
+ });
1154
+ }
1155
+ jwt(e) {
1156
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
1157
+ }
1158
+ ip(e) {
1159
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
1160
+ }
1161
+ cidr(e) {
1162
+ return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
1163
+ }
1164
+ datetime(e) {
1165
+ var t, r;
1166
+ return typeof e == "string" ? this._addCheck({
1167
+ kind: "datetime",
1168
+ precision: null,
1169
+ offset: !1,
1170
+ local: !1,
1171
+ message: e
1172
+ }) : this._addCheck({
1173
+ kind: "datetime",
1174
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1175
+ offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
1176
+ local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1,
1177
+ ...h.errToObj(e == null ? void 0 : e.message)
1178
+ });
1179
+ }
1180
+ date(e) {
1181
+ return this._addCheck({ kind: "date", message: e });
1182
+ }
1183
+ time(e) {
1184
+ return typeof e == "string" ? this._addCheck({
1185
+ kind: "time",
1186
+ precision: null,
1187
+ message: e
1188
+ }) : this._addCheck({
1189
+ kind: "time",
1190
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1191
+ ...h.errToObj(e == null ? void 0 : e.message)
1192
+ });
1193
+ }
1194
+ duration(e) {
1195
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
1196
+ }
1197
+ regex(e, t) {
1198
+ return this._addCheck({
1199
+ kind: "regex",
1200
+ regex: e,
1201
+ ...h.errToObj(t)
1202
+ });
1203
+ }
1204
+ includes(e, t) {
1205
+ return this._addCheck({
1206
+ kind: "includes",
1207
+ value: e,
1208
+ position: t == null ? void 0 : t.position,
1209
+ ...h.errToObj(t == null ? void 0 : t.message)
1210
+ });
1211
+ }
1212
+ startsWith(e, t) {
1213
+ return this._addCheck({
1214
+ kind: "startsWith",
1215
+ value: e,
1216
+ ...h.errToObj(t)
1217
+ });
1218
+ }
1219
+ endsWith(e, t) {
1220
+ return this._addCheck({
1221
+ kind: "endsWith",
1222
+ value: e,
1223
+ ...h.errToObj(t)
1224
+ });
1225
+ }
1226
+ min(e, t) {
1227
+ return this._addCheck({
1228
+ kind: "min",
1229
+ value: e,
1230
+ ...h.errToObj(t)
1231
+ });
1232
+ }
1233
+ max(e, t) {
1234
+ return this._addCheck({
1235
+ kind: "max",
1236
+ value: e,
1237
+ ...h.errToObj(t)
1238
+ });
1239
+ }
1240
+ length(e, t) {
1241
+ return this._addCheck({
1242
+ kind: "length",
1243
+ value: e,
1244
+ ...h.errToObj(t)
1245
+ });
1246
+ }
1247
+ /**
1248
+ * Equivalent to `.min(1)`
1249
+ */
1250
+ nonempty(e) {
1251
+ return this.min(1, h.errToObj(e));
1252
+ }
1253
+ trim() {
1254
+ return new S({
1255
+ ...this._def,
1256
+ checks: [...this._def.checks, { kind: "trim" }]
1257
+ });
1258
+ }
1259
+ toLowerCase() {
1260
+ return new S({
1261
+ ...this._def,
1262
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1263
+ });
1264
+ }
1265
+ toUpperCase() {
1266
+ return new S({
1267
+ ...this._def,
1268
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1269
+ });
1270
+ }
1271
+ get isDatetime() {
1272
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1273
+ }
1274
+ get isDate() {
1275
+ return !!this._def.checks.find((e) => e.kind === "date");
1276
+ }
1277
+ get isTime() {
1278
+ return !!this._def.checks.find((e) => e.kind === "time");
1279
+ }
1280
+ get isDuration() {
1281
+ return !!this._def.checks.find((e) => e.kind === "duration");
1282
+ }
1283
+ get isEmail() {
1284
+ return !!this._def.checks.find((e) => e.kind === "email");
1285
+ }
1286
+ get isURL() {
1287
+ return !!this._def.checks.find((e) => e.kind === "url");
1288
+ }
1289
+ get isEmoji() {
1290
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1291
+ }
1292
+ get isUUID() {
1293
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1294
+ }
1295
+ get isNANOID() {
1296
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1297
+ }
1298
+ get isCUID() {
1299
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1300
+ }
1301
+ get isCUID2() {
1302
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1303
+ }
1304
+ get isULID() {
1305
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1306
+ }
1307
+ get isIP() {
1308
+ return !!this._def.checks.find((e) => e.kind === "ip");
1309
+ }
1310
+ get isCIDR() {
1311
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1312
+ }
1313
+ get isBase64() {
1314
+ return !!this._def.checks.find((e) => e.kind === "base64");
1315
+ }
1316
+ get isBase64url() {
1317
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1318
+ }
1319
+ get minLength() {
1320
+ let e = null;
1321
+ for (const t of this._def.checks)
1322
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1323
+ return e;
1324
+ }
1325
+ get maxLength() {
1326
+ let e = null;
1327
+ for (const t of this._def.checks)
1328
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1329
+ return e;
1330
+ }
1331
+ }
1332
+ S.create = (n) => {
1333
+ var e;
1334
+ return new S({
1335
+ checks: [],
1336
+ typeName: g.ZodString,
1337
+ coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1338
+ ..._(n)
1339
+ });
1340
+ };
1341
+ function wn(n, e) {
1342
+ const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
1343
+ return a % i / Math.pow(10, s);
1344
+ }
1345
+ class z extends v {
1346
+ constructor() {
1347
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1348
+ }
1349
+ _parse(e) {
1350
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
1351
+ const a = this._getOrReturnCtx(e);
1352
+ return f(a, {
1353
+ code: c.invalid_type,
1354
+ expected: p.number,
1355
+ received: a.parsedType
1356
+ }), y;
1357
+ }
1358
+ let r;
1359
+ const s = new k();
1360
+ for (const a of this._def.checks)
1361
+ a.kind === "int" ? b.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1362
+ code: c.invalid_type,
1363
+ expected: "integer",
1364
+ received: "float",
1365
+ message: a.message
1366
+ }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1367
+ code: c.too_small,
1368
+ minimum: a.value,
1369
+ type: "number",
1370
+ inclusive: a.inclusive,
1371
+ exact: !1,
1372
+ message: a.message
1373
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1374
+ code: c.too_big,
1375
+ maximum: a.value,
1376
+ type: "number",
1377
+ inclusive: a.inclusive,
1378
+ exact: !1,
1379
+ message: a.message
1380
+ }), s.dirty()) : a.kind === "multipleOf" ? wn(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), f(r, {
1381
+ code: c.not_multiple_of,
1382
+ multipleOf: a.value,
1383
+ message: a.message
1384
+ }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1385
+ code: c.not_finite,
1386
+ message: a.message
1387
+ }), s.dirty()) : b.assertNever(a);
1388
+ return { status: s.value, value: e.data };
1389
+ }
1390
+ gte(e, t) {
1391
+ return this.setLimit("min", e, !0, h.toString(t));
1392
+ }
1393
+ gt(e, t) {
1394
+ return this.setLimit("min", e, !1, h.toString(t));
1395
+ }
1396
+ lte(e, t) {
1397
+ return this.setLimit("max", e, !0, h.toString(t));
1398
+ }
1399
+ lt(e, t) {
1400
+ return this.setLimit("max", e, !1, h.toString(t));
1401
+ }
1402
+ setLimit(e, t, r, s) {
1403
+ return new z({
1404
+ ...this._def,
1405
+ checks: [
1406
+ ...this._def.checks,
1407
+ {
1408
+ kind: e,
1409
+ value: t,
1410
+ inclusive: r,
1411
+ message: h.toString(s)
1412
+ }
1413
+ ]
1414
+ });
1415
+ }
1416
+ _addCheck(e) {
1417
+ return new z({
1418
+ ...this._def,
1419
+ checks: [...this._def.checks, e]
1420
+ });
1421
+ }
1422
+ int(e) {
1423
+ return this._addCheck({
1424
+ kind: "int",
1425
+ message: h.toString(e)
1426
+ });
1427
+ }
1428
+ positive(e) {
1429
+ return this._addCheck({
1430
+ kind: "min",
1431
+ value: 0,
1432
+ inclusive: !1,
1433
+ message: h.toString(e)
1434
+ });
1435
+ }
1436
+ negative(e) {
1437
+ return this._addCheck({
1438
+ kind: "max",
1439
+ value: 0,
1440
+ inclusive: !1,
1441
+ message: h.toString(e)
1442
+ });
1443
+ }
1444
+ nonpositive(e) {
1445
+ return this._addCheck({
1446
+ kind: "max",
1447
+ value: 0,
1448
+ inclusive: !0,
1449
+ message: h.toString(e)
1450
+ });
1451
+ }
1452
+ nonnegative(e) {
1453
+ return this._addCheck({
1454
+ kind: "min",
1455
+ value: 0,
1456
+ inclusive: !0,
1457
+ message: h.toString(e)
1458
+ });
1459
+ }
1460
+ multipleOf(e, t) {
1461
+ return this._addCheck({
1462
+ kind: "multipleOf",
1463
+ value: e,
1464
+ message: h.toString(t)
1465
+ });
1466
+ }
1467
+ finite(e) {
1468
+ return this._addCheck({
1469
+ kind: "finite",
1470
+ message: h.toString(e)
1471
+ });
1472
+ }
1473
+ safe(e) {
1474
+ return this._addCheck({
1475
+ kind: "min",
1476
+ inclusive: !0,
1477
+ value: Number.MIN_SAFE_INTEGER,
1478
+ message: h.toString(e)
1479
+ })._addCheck({
1480
+ kind: "max",
1481
+ inclusive: !0,
1482
+ value: Number.MAX_SAFE_INTEGER,
1483
+ message: h.toString(e)
1484
+ });
1485
+ }
1486
+ get minValue() {
1487
+ let e = null;
1488
+ for (const t of this._def.checks)
1489
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1490
+ return e;
1491
+ }
1492
+ get maxValue() {
1493
+ let e = null;
1494
+ for (const t of this._def.checks)
1495
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1496
+ return e;
1497
+ }
1498
+ get isInt() {
1499
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1500
+ }
1501
+ get isFinite() {
1502
+ let e = null, t = null;
1503
+ for (const r of this._def.checks) {
1504
+ if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1505
+ return !0;
1506
+ r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1507
+ }
1508
+ return Number.isFinite(t) && Number.isFinite(e);
1509
+ }
1510
+ }
1511
+ z.create = (n) => new z({
1512
+ checks: [],
1513
+ typeName: g.ZodNumber,
1514
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1515
+ ..._(n)
1516
+ });
1517
+ class L extends v {
1518
+ constructor() {
1519
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1520
+ }
1521
+ _parse(e) {
1522
+ if (this._def.coerce)
1523
+ try {
1524
+ e.data = BigInt(e.data);
1525
+ } catch {
1526
+ return this._getInvalidInput(e);
1527
+ }
1528
+ if (this._getType(e) !== p.bigint)
1529
+ return this._getInvalidInput(e);
1530
+ let r;
1531
+ const s = new k();
1532
+ for (const a of this._def.checks)
1533
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1534
+ code: c.too_small,
1535
+ type: "bigint",
1536
+ minimum: a.value,
1537
+ inclusive: a.inclusive,
1538
+ message: a.message
1539
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1540
+ code: c.too_big,
1541
+ type: "bigint",
1542
+ maximum: a.value,
1543
+ inclusive: a.inclusive,
1544
+ message: a.message
1545
+ }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), f(r, {
1546
+ code: c.not_multiple_of,
1547
+ multipleOf: a.value,
1548
+ message: a.message
1549
+ }), s.dirty()) : b.assertNever(a);
1550
+ return { status: s.value, value: e.data };
1551
+ }
1552
+ _getInvalidInput(e) {
1553
+ const t = this._getOrReturnCtx(e);
1554
+ return f(t, {
1555
+ code: c.invalid_type,
1556
+ expected: p.bigint,
1557
+ received: t.parsedType
1558
+ }), y;
1559
+ }
1560
+ gte(e, t) {
1561
+ return this.setLimit("min", e, !0, h.toString(t));
1562
+ }
1563
+ gt(e, t) {
1564
+ return this.setLimit("min", e, !1, h.toString(t));
1565
+ }
1566
+ lte(e, t) {
1567
+ return this.setLimit("max", e, !0, h.toString(t));
1568
+ }
1569
+ lt(e, t) {
1570
+ return this.setLimit("max", e, !1, h.toString(t));
1571
+ }
1572
+ setLimit(e, t, r, s) {
1573
+ return new L({
1574
+ ...this._def,
1575
+ checks: [
1576
+ ...this._def.checks,
1577
+ {
1578
+ kind: e,
1579
+ value: t,
1580
+ inclusive: r,
1581
+ message: h.toString(s)
1582
+ }
1583
+ ]
1584
+ });
1585
+ }
1586
+ _addCheck(e) {
1587
+ return new L({
1588
+ ...this._def,
1589
+ checks: [...this._def.checks, e]
1590
+ });
1591
+ }
1592
+ positive(e) {
1593
+ return this._addCheck({
1594
+ kind: "min",
1595
+ value: BigInt(0),
1596
+ inclusive: !1,
1597
+ message: h.toString(e)
1598
+ });
1599
+ }
1600
+ negative(e) {
1601
+ return this._addCheck({
1602
+ kind: "max",
1603
+ value: BigInt(0),
1604
+ inclusive: !1,
1605
+ message: h.toString(e)
1606
+ });
1607
+ }
1608
+ nonpositive(e) {
1609
+ return this._addCheck({
1610
+ kind: "max",
1611
+ value: BigInt(0),
1612
+ inclusive: !0,
1613
+ message: h.toString(e)
1614
+ });
1615
+ }
1616
+ nonnegative(e) {
1617
+ return this._addCheck({
1618
+ kind: "min",
1619
+ value: BigInt(0),
1620
+ inclusive: !0,
1621
+ message: h.toString(e)
1622
+ });
1623
+ }
1624
+ multipleOf(e, t) {
1625
+ return this._addCheck({
1626
+ kind: "multipleOf",
1627
+ value: e,
1628
+ message: h.toString(t)
1629
+ });
1630
+ }
1631
+ get minValue() {
1632
+ let e = null;
1633
+ for (const t of this._def.checks)
1634
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1635
+ return e;
1636
+ }
1637
+ get maxValue() {
1638
+ let e = null;
1639
+ for (const t of this._def.checks)
1640
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1641
+ return e;
1642
+ }
1643
+ }
1644
+ L.create = (n) => {
1645
+ var e;
1646
+ return new L({
1647
+ checks: [],
1648
+ typeName: g.ZodBigInt,
1649
+ coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1650
+ ..._(n)
1651
+ });
1652
+ };
1653
+ class ie extends v {
1654
+ _parse(e) {
1655
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
1656
+ const r = this._getOrReturnCtx(e);
1657
+ return f(r, {
1658
+ code: c.invalid_type,
1659
+ expected: p.boolean,
1660
+ received: r.parsedType
1661
+ }), y;
1662
+ }
1663
+ return w(e.data);
1664
+ }
1665
+ }
1666
+ ie.create = (n) => new ie({
1667
+ typeName: g.ZodBoolean,
1668
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1669
+ ..._(n)
1670
+ });
1671
+ class q extends v {
1672
+ _parse(e) {
1673
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
1674
+ const a = this._getOrReturnCtx(e);
1675
+ return f(a, {
1676
+ code: c.invalid_type,
1677
+ expected: p.date,
1678
+ received: a.parsedType
1679
+ }), y;
1680
+ }
1681
+ if (isNaN(e.data.getTime())) {
1682
+ const a = this._getOrReturnCtx(e);
1683
+ return f(a, {
1684
+ code: c.invalid_date
1685
+ }), y;
1686
+ }
1687
+ const r = new k();
1688
+ let s;
1689
+ for (const a of this._def.checks)
1690
+ a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1691
+ code: c.too_small,
1692
+ message: a.message,
1693
+ inclusive: !0,
1694
+ exact: !1,
1695
+ minimum: a.value,
1696
+ type: "date"
1697
+ }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1698
+ code: c.too_big,
1699
+ message: a.message,
1700
+ inclusive: !0,
1701
+ exact: !1,
1702
+ maximum: a.value,
1703
+ type: "date"
1704
+ }), r.dirty()) : b.assertNever(a);
1705
+ return {
1706
+ status: r.value,
1707
+ value: new Date(e.data.getTime())
1708
+ };
1709
+ }
1710
+ _addCheck(e) {
1711
+ return new q({
1712
+ ...this._def,
1713
+ checks: [...this._def.checks, e]
1714
+ });
1715
+ }
1716
+ min(e, t) {
1717
+ return this._addCheck({
1718
+ kind: "min",
1719
+ value: e.getTime(),
1720
+ message: h.toString(t)
1721
+ });
1722
+ }
1723
+ max(e, t) {
1724
+ return this._addCheck({
1725
+ kind: "max",
1726
+ value: e.getTime(),
1727
+ message: h.toString(t)
1728
+ });
1729
+ }
1730
+ get minDate() {
1731
+ let e = null;
1732
+ for (const t of this._def.checks)
1733
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1734
+ return e != null ? new Date(e) : null;
1735
+ }
1736
+ get maxDate() {
1737
+ let e = null;
1738
+ for (const t of this._def.checks)
1739
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1740
+ return e != null ? new Date(e) : null;
1741
+ }
1742
+ }
1743
+ q.create = (n) => new q({
1744
+ checks: [],
1745
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1746
+ typeName: g.ZodDate,
1747
+ ..._(n)
1748
+ });
1749
+ class we extends v {
1750
+ _parse(e) {
1751
+ if (this._getType(e) !== p.symbol) {
1752
+ const r = this._getOrReturnCtx(e);
1753
+ return f(r, {
1754
+ code: c.invalid_type,
1755
+ expected: p.symbol,
1756
+ received: r.parsedType
1757
+ }), y;
1758
+ }
1759
+ return w(e.data);
1760
+ }
1761
+ }
1762
+ we.create = (n) => new we({
1763
+ typeName: g.ZodSymbol,
1764
+ ..._(n)
1765
+ });
1766
+ class oe extends v {
1767
+ _parse(e) {
1768
+ if (this._getType(e) !== p.undefined) {
1769
+ const r = this._getOrReturnCtx(e);
1770
+ return f(r, {
1771
+ code: c.invalid_type,
1772
+ expected: p.undefined,
1773
+ received: r.parsedType
1774
+ }), y;
1775
+ }
1776
+ return w(e.data);
1777
+ }
1778
+ }
1779
+ oe.create = (n) => new oe({
1780
+ typeName: g.ZodUndefined,
1781
+ ..._(n)
1782
+ });
1783
+ class de extends v {
1784
+ _parse(e) {
1785
+ if (this._getType(e) !== p.null) {
1786
+ const r = this._getOrReturnCtx(e);
1787
+ return f(r, {
1788
+ code: c.invalid_type,
1789
+ expected: p.null,
1790
+ received: r.parsedType
1791
+ }), y;
1792
+ }
1793
+ return w(e.data);
1794
+ }
1795
+ }
1796
+ de.create = (n) => new de({
1797
+ typeName: g.ZodNull,
1798
+ ..._(n)
1799
+ });
1800
+ class ee extends v {
1801
+ constructor() {
1802
+ super(...arguments), this._any = !0;
1803
+ }
1804
+ _parse(e) {
1805
+ return w(e.data);
1806
+ }
1807
+ }
1808
+ ee.create = (n) => new ee({
1809
+ typeName: g.ZodAny,
1810
+ ..._(n)
1811
+ });
1812
+ class G extends v {
1813
+ constructor() {
1814
+ super(...arguments), this._unknown = !0;
1815
+ }
1816
+ _parse(e) {
1817
+ return w(e.data);
1818
+ }
1819
+ }
1820
+ G.create = (n) => new G({
1821
+ typeName: g.ZodUnknown,
1822
+ ..._(n)
1823
+ });
1824
+ class F extends v {
1825
+ _parse(e) {
1826
+ const t = this._getOrReturnCtx(e);
1827
+ return f(t, {
1828
+ code: c.invalid_type,
1829
+ expected: p.never,
1830
+ received: t.parsedType
1831
+ }), y;
1832
+ }
1833
+ }
1834
+ F.create = (n) => new F({
1835
+ typeName: g.ZodNever,
1836
+ ..._(n)
1837
+ });
1838
+ class Ie extends v {
1839
+ _parse(e) {
1840
+ if (this._getType(e) !== p.undefined) {
1841
+ const r = this._getOrReturnCtx(e);
1842
+ return f(r, {
1843
+ code: c.invalid_type,
1844
+ expected: p.void,
1845
+ received: r.parsedType
1846
+ }), y;
1847
+ }
1848
+ return w(e.data);
1849
+ }
1850
+ }
1851
+ Ie.create = (n) => new Ie({
1852
+ typeName: g.ZodVoid,
1853
+ ..._(n)
1854
+ });
1855
+ class E extends v {
1856
+ _parse(e) {
1857
+ const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1858
+ if (t.parsedType !== p.array)
1859
+ return f(t, {
1860
+ code: c.invalid_type,
1861
+ expected: p.array,
1862
+ received: t.parsedType
1863
+ }), y;
1864
+ if (s.exactLength !== null) {
1865
+ const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1866
+ (i || o) && (f(t, {
1867
+ code: i ? c.too_big : c.too_small,
1868
+ minimum: o ? s.exactLength.value : void 0,
1869
+ maximum: i ? s.exactLength.value : void 0,
1870
+ type: "array",
1871
+ inclusive: !0,
1872
+ exact: !0,
1873
+ message: s.exactLength.message
1874
+ }), r.dirty());
1875
+ }
1876
+ if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
1877
+ code: c.too_small,
1878
+ minimum: s.minLength.value,
1879
+ type: "array",
1880
+ inclusive: !0,
1881
+ exact: !1,
1882
+ message: s.minLength.message
1883
+ }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
1884
+ code: c.too_big,
1885
+ maximum: s.maxLength.value,
1886
+ type: "array",
1887
+ inclusive: !0,
1888
+ exact: !1,
1889
+ message: s.maxLength.message
1890
+ }), r.dirty()), t.common.async)
1891
+ return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new C(t, i, t.path, o)))).then((i) => k.mergeArray(r, i));
1892
+ const a = [...t.data].map((i, o) => s.type._parseSync(new C(t, i, t.path, o)));
1893
+ return k.mergeArray(r, a);
1894
+ }
1895
+ get element() {
1896
+ return this._def.type;
1897
+ }
1898
+ min(e, t) {
1899
+ return new E({
1900
+ ...this._def,
1901
+ minLength: { value: e, message: h.toString(t) }
1902
+ });
1903
+ }
1904
+ max(e, t) {
1905
+ return new E({
1906
+ ...this._def,
1907
+ maxLength: { value: e, message: h.toString(t) }
1908
+ });
1909
+ }
1910
+ length(e, t) {
1911
+ return new E({
1912
+ ...this._def,
1913
+ exactLength: { value: e, message: h.toString(t) }
1914
+ });
1915
+ }
1916
+ nonempty(e) {
1917
+ return this.min(1, e);
1918
+ }
1919
+ }
1920
+ E.create = (n, e) => new E({
1921
+ type: n,
1922
+ minLength: null,
1923
+ maxLength: null,
1924
+ exactLength: null,
1925
+ typeName: g.ZodArray,
1926
+ ..._(e)
1927
+ });
1928
+ function J(n) {
1929
+ if (n instanceof x) {
1930
+ const e = {};
1931
+ for (const t in n.shape) {
1932
+ const r = n.shape[t];
1933
+ e[t] = A.create(J(r));
1934
+ }
1935
+ return new x({
1936
+ ...n._def,
1937
+ shape: () => e
1938
+ });
1939
+ } else return n instanceof E ? new E({
1940
+ ...n._def,
1941
+ type: J(n.element)
1942
+ }) : n instanceof A ? A.create(J(n.unwrap())) : n instanceof $ ? $.create(J(n.unwrap())) : n instanceof D ? D.create(n.items.map((e) => J(e))) : n;
1943
+ }
1944
+ class x extends v {
1945
+ constructor() {
1946
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1947
+ }
1948
+ _getCached() {
1949
+ if (this._cached !== null)
1950
+ return this._cached;
1951
+ const e = this._def.shape(), t = b.objectKeys(e);
1952
+ return this._cached = { shape: e, keys: t };
1953
+ }
1954
+ _parse(e) {
1955
+ if (this._getType(e) !== p.object) {
1956
+ const l = this._getOrReturnCtx(e);
1957
+ return f(l, {
1958
+ code: c.invalid_type,
1959
+ expected: p.object,
1960
+ received: l.parsedType
1961
+ }), y;
1962
+ }
1963
+ const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1964
+ if (!(this._def.catchall instanceof F && this._def.unknownKeys === "strip"))
1965
+ for (const l in s.data)
1966
+ i.includes(l) || o.push(l);
1967
+ const u = [];
1968
+ for (const l of i) {
1969
+ const m = a[l], T = s.data[l];
1970
+ u.push({
1971
+ key: { status: "valid", value: l },
1972
+ value: m._parse(new C(s, T, s.path, l)),
1973
+ alwaysSet: l in s.data
1974
+ });
1975
+ }
1976
+ if (this._def.catchall instanceof F) {
1977
+ const l = this._def.unknownKeys;
1978
+ if (l === "passthrough")
1979
+ for (const m of o)
1980
+ u.push({
1981
+ key: { status: "valid", value: m },
1982
+ value: { status: "valid", value: s.data[m] }
1983
+ });
1984
+ else if (l === "strict")
1985
+ o.length > 0 && (f(s, {
1986
+ code: c.unrecognized_keys,
1987
+ keys: o
1988
+ }), r.dirty());
1989
+ else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1990
+ } else {
1991
+ const l = this._def.catchall;
1992
+ for (const m of o) {
1993
+ const T = s.data[m];
1994
+ u.push({
1995
+ key: { status: "valid", value: m },
1996
+ value: l._parse(
1997
+ new C(s, T, s.path, m)
1998
+ //, ctx.child(key), value, getParsedType(value)
1999
+ ),
2000
+ alwaysSet: m in s.data
2001
+ });
2002
+ }
2003
+ }
2004
+ return s.common.async ? Promise.resolve().then(async () => {
2005
+ const l = [];
2006
+ for (const m of u) {
2007
+ const T = await m.key, be = await m.value;
2008
+ l.push({
2009
+ key: T,
2010
+ value: be,
2011
+ alwaysSet: m.alwaysSet
2012
+ });
2013
+ }
2014
+ return l;
2015
+ }).then((l) => k.mergeObjectSync(r, l)) : k.mergeObjectSync(r, u);
2016
+ }
2017
+ get shape() {
2018
+ return this._def.shape();
2019
+ }
2020
+ strict(e) {
2021
+ return h.errToObj, new x({
2022
+ ...this._def,
2023
+ unknownKeys: "strict",
2024
+ ...e !== void 0 ? {
2025
+ errorMap: (t, r) => {
2026
+ var s, a, i, o;
2027
+ const u = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && i !== void 0 ? i : r.defaultError;
2028
+ return t.code === "unrecognized_keys" ? {
2029
+ message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
2030
+ } : {
2031
+ message: u
2032
+ };
2033
+ }
2034
+ } : {}
2035
+ });
2036
+ }
2037
+ strip() {
2038
+ return new x({
2039
+ ...this._def,
2040
+ unknownKeys: "strip"
2041
+ });
2042
+ }
2043
+ passthrough() {
2044
+ return new x({
2045
+ ...this._def,
2046
+ unknownKeys: "passthrough"
2047
+ });
2048
+ }
2049
+ // const AugmentFactory =
2050
+ // <Def extends ZodObjectDef>(def: Def) =>
2051
+ // <Augmentation extends ZodRawShape>(
2052
+ // augmentation: Augmentation
2053
+ // ): ZodObject<
2054
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2055
+ // Def["unknownKeys"],
2056
+ // Def["catchall"]
2057
+ // > => {
2058
+ // return new ZodObject({
2059
+ // ...def,
2060
+ // shape: () => ({
2061
+ // ...def.shape(),
2062
+ // ...augmentation,
2063
+ // }),
2064
+ // }) as any;
2065
+ // };
2066
+ extend(e) {
2067
+ return new x({
2068
+ ...this._def,
2069
+ shape: () => ({
2070
+ ...this._def.shape(),
2071
+ ...e
2072
+ })
2073
+ });
2074
+ }
2075
+ /**
2076
+ * Prior to zod@1.0.12 there was a bug in the
2077
+ * inferred type of merged objects. Please
2078
+ * upgrade if you are experiencing issues.
2079
+ */
2080
+ merge(e) {
2081
+ return new x({
2082
+ unknownKeys: e._def.unknownKeys,
2083
+ catchall: e._def.catchall,
2084
+ shape: () => ({
2085
+ ...this._def.shape(),
2086
+ ...e._def.shape()
2087
+ }),
2088
+ typeName: g.ZodObject
2089
+ });
2090
+ }
2091
+ // merge<
2092
+ // Incoming extends AnyZodObject,
2093
+ // Augmentation extends Incoming["shape"],
2094
+ // NewOutput extends {
2095
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2096
+ // ? Augmentation[k]["_output"]
2097
+ // : k extends keyof Output
2098
+ // ? Output[k]
2099
+ // : never;
2100
+ // },
2101
+ // NewInput extends {
2102
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2103
+ // ? Augmentation[k]["_input"]
2104
+ // : k extends keyof Input
2105
+ // ? Input[k]
2106
+ // : never;
2107
+ // }
2108
+ // >(
2109
+ // merging: Incoming
2110
+ // ): ZodObject<
2111
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2112
+ // Incoming["_def"]["unknownKeys"],
2113
+ // Incoming["_def"]["catchall"],
2114
+ // NewOutput,
2115
+ // NewInput
2116
+ // > {
2117
+ // const merged: any = new ZodObject({
2118
+ // unknownKeys: merging._def.unknownKeys,
2119
+ // catchall: merging._def.catchall,
2120
+ // shape: () =>
2121
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2122
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2123
+ // }) as any;
2124
+ // return merged;
2125
+ // }
2126
+ setKey(e, t) {
2127
+ return this.augment({ [e]: t });
2128
+ }
2129
+ // merge<Incoming extends AnyZodObject>(
2130
+ // merging: Incoming
2131
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2132
+ // ZodObject<
2133
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2134
+ // Incoming["_def"]["unknownKeys"],
2135
+ // Incoming["_def"]["catchall"]
2136
+ // > {
2137
+ // // const mergedShape = objectUtil.mergeShapes(
2138
+ // // this._def.shape(),
2139
+ // // merging._def.shape()
2140
+ // // );
2141
+ // const merged: any = new ZodObject({
2142
+ // unknownKeys: merging._def.unknownKeys,
2143
+ // catchall: merging._def.catchall,
2144
+ // shape: () =>
2145
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2146
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2147
+ // }) as any;
2148
+ // return merged;
2149
+ // }
2150
+ catchall(e) {
2151
+ return new x({
2152
+ ...this._def,
2153
+ catchall: e
2154
+ });
2155
+ }
2156
+ pick(e) {
2157
+ const t = {};
2158
+ return b.objectKeys(e).forEach((r) => {
2159
+ e[r] && this.shape[r] && (t[r] = this.shape[r]);
2160
+ }), new x({
2161
+ ...this._def,
2162
+ shape: () => t
2163
+ });
2164
+ }
2165
+ omit(e) {
2166
+ const t = {};
2167
+ return b.objectKeys(this.shape).forEach((r) => {
2168
+ e[r] || (t[r] = this.shape[r]);
2169
+ }), new x({
2170
+ ...this._def,
2171
+ shape: () => t
2172
+ });
2173
+ }
2174
+ /**
2175
+ * @deprecated
2176
+ */
2177
+ deepPartial() {
2178
+ return J(this);
2179
+ }
2180
+ partial(e) {
2181
+ const t = {};
2182
+ return b.objectKeys(this.shape).forEach((r) => {
2183
+ const s = this.shape[r];
2184
+ e && !e[r] ? t[r] = s : t[r] = s.optional();
2185
+ }), new x({
2186
+ ...this._def,
2187
+ shape: () => t
2188
+ });
2189
+ }
2190
+ required(e) {
2191
+ const t = {};
2192
+ return b.objectKeys(this.shape).forEach((r) => {
2193
+ if (e && !e[r])
2194
+ t[r] = this.shape[r];
2195
+ else {
2196
+ let a = this.shape[r];
2197
+ for (; a instanceof A; )
2198
+ a = a._def.innerType;
2199
+ t[r] = a;
2200
+ }
2201
+ }), new x({
2202
+ ...this._def,
2203
+ shape: () => t
2204
+ });
2205
+ }
2206
+ keyof() {
2207
+ return mt(b.objectKeys(this.shape));
2208
+ }
2209
+ }
2210
+ x.create = (n, e) => new x({
2211
+ shape: () => n,
2212
+ unknownKeys: "strip",
2213
+ catchall: F.create(),
2214
+ typeName: g.ZodObject,
2215
+ ..._(e)
2216
+ });
2217
+ x.strictCreate = (n, e) => new x({
2218
+ shape: () => n,
2219
+ unknownKeys: "strict",
2220
+ catchall: F.create(),
2221
+ typeName: g.ZodObject,
2222
+ ..._(e)
2223
+ });
2224
+ x.lazycreate = (n, e) => new x({
2225
+ shape: n,
2226
+ unknownKeys: "strip",
2227
+ catchall: F.create(),
2228
+ typeName: g.ZodObject,
2229
+ ..._(e)
2230
+ });
2231
+ class ce extends v {
2232
+ _parse(e) {
2233
+ const { ctx: t } = this._processInputParams(e), r = this._def.options;
2234
+ function s(a) {
2235
+ for (const o of a)
2236
+ if (o.result.status === "valid")
2237
+ return o.result;
2238
+ for (const o of a)
2239
+ if (o.result.status === "dirty")
2240
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2241
+ const i = a.map((o) => new I(o.ctx.common.issues));
2242
+ return f(t, {
2243
+ code: c.invalid_union,
2244
+ unionErrors: i
2245
+ }), y;
2246
+ }
2247
+ if (t.common.async)
2248
+ return Promise.all(r.map(async (a) => {
2249
+ const i = {
2250
+ ...t,
2251
+ common: {
2252
+ ...t.common,
2253
+ issues: []
2254
+ },
2255
+ parent: null
2256
+ };
2257
+ return {
2258
+ result: await a._parseAsync({
2259
+ data: t.data,
2260
+ path: t.path,
2261
+ parent: i
2262
+ }),
2263
+ ctx: i
2264
+ };
2265
+ })).then(s);
2266
+ {
2267
+ let a;
2268
+ const i = [];
2269
+ for (const u of r) {
2270
+ const l = {
2271
+ ...t,
2272
+ common: {
2273
+ ...t.common,
2274
+ issues: []
2275
+ },
2276
+ parent: null
2277
+ }, m = u._parseSync({
2278
+ data: t.data,
2279
+ path: t.path,
2280
+ parent: l
2281
+ });
2282
+ if (m.status === "valid")
2283
+ return m;
2284
+ m.status === "dirty" && !a && (a = { result: m, ctx: l }), l.common.issues.length && i.push(l.common.issues);
2285
+ }
2286
+ if (a)
2287
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
2288
+ const o = i.map((u) => new I(u));
2289
+ return f(t, {
2290
+ code: c.invalid_union,
2291
+ unionErrors: o
2292
+ }), y;
2293
+ }
2294
+ }
2295
+ get options() {
2296
+ return this._def.options;
2297
+ }
2298
+ }
2299
+ ce.create = (n, e) => new ce({
2300
+ options: n,
2301
+ typeName: g.ZodUnion,
2302
+ ..._(e)
2303
+ });
2304
+ const R = (n) => n instanceof fe ? R(n.schema) : n instanceof N ? R(n.innerType()) : n instanceof pe ? [n.value] : n instanceof M ? n.options : n instanceof he ? b.objectValues(n.enum) : n instanceof me ? R(n._def.innerType) : n instanceof oe ? [void 0] : n instanceof de ? [null] : n instanceof A ? [void 0, ...R(n.unwrap())] : n instanceof $ ? [null, ...R(n.unwrap())] : n instanceof $e || n instanceof ye ? R(n.unwrap()) : n instanceof ge ? R(n._def.innerType) : [];
2305
+ class Ce extends v {
2306
+ _parse(e) {
2307
+ const { ctx: t } = this._processInputParams(e);
2308
+ if (t.parsedType !== p.object)
2309
+ return f(t, {
2310
+ code: c.invalid_type,
2311
+ expected: p.object,
2312
+ received: t.parsedType
2313
+ }), y;
2314
+ const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
2315
+ return a ? t.common.async ? a._parseAsync({
2316
+ data: t.data,
2317
+ path: t.path,
2318
+ parent: t
2319
+ }) : a._parseSync({
2320
+ data: t.data,
2321
+ path: t.path,
2322
+ parent: t
2323
+ }) : (f(t, {
2324
+ code: c.invalid_union_discriminator,
2325
+ options: Array.from(this.optionsMap.keys()),
2326
+ path: [r]
2327
+ }), y);
2328
+ }
2329
+ get discriminator() {
2330
+ return this._def.discriminator;
2331
+ }
2332
+ get options() {
2333
+ return this._def.options;
2334
+ }
2335
+ get optionsMap() {
2336
+ return this._def.optionsMap;
2337
+ }
2338
+ /**
2339
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2340
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2341
+ * have a different value for each object in the union.
2342
+ * @param discriminator the name of the discriminator property
2343
+ * @param types an array of object schemas
2344
+ * @param params
2345
+ */
2346
+ static create(e, t, r) {
2347
+ const s = /* @__PURE__ */ new Map();
2348
+ for (const a of t) {
2349
+ const i = R(a.shape[e]);
2350
+ if (!i.length)
2351
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2352
+ for (const o of i) {
2353
+ if (s.has(o))
2354
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2355
+ s.set(o, a);
2356
+ }
2357
+ }
2358
+ return new Ce({
2359
+ typeName: g.ZodDiscriminatedUnion,
2360
+ discriminator: e,
2361
+ options: t,
2362
+ optionsMap: s,
2363
+ ..._(r)
2364
+ });
2365
+ }
2366
+ }
2367
+ function Le(n, e) {
2368
+ const t = Z(n), r = Z(e);
2369
+ if (n === e)
2370
+ return { valid: !0, data: n };
2371
+ if (t === p.object && r === p.object) {
2372
+ const s = b.objectKeys(e), a = b.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = { ...n, ...e };
2373
+ for (const o of a) {
2374
+ const u = Le(n[o], e[o]);
2375
+ if (!u.valid)
2376
+ return { valid: !1 };
2377
+ i[o] = u.data;
2378
+ }
2379
+ return { valid: !0, data: i };
2380
+ } else if (t === p.array && r === p.array) {
2381
+ if (n.length !== e.length)
2382
+ return { valid: !1 };
2383
+ const s = [];
2384
+ for (let a = 0; a < n.length; a++) {
2385
+ const i = n[a], o = e[a], u = Le(i, o);
2386
+ if (!u.valid)
2387
+ return { valid: !1 };
2388
+ s.push(u.data);
2389
+ }
2390
+ return { valid: !0, data: s };
2391
+ } else return t === p.date && r === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2392
+ }
2393
+ class ue extends v {
2394
+ _parse(e) {
2395
+ const { status: t, ctx: r } = this._processInputParams(e), s = (a, i) => {
2396
+ if (Pe(a) || Pe(i))
2397
+ return y;
2398
+ const o = Le(a.value, i.value);
2399
+ return o.valid ? ((ze(a) || ze(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(r, {
2400
+ code: c.invalid_intersection_types
2401
+ }), y);
2402
+ };
2403
+ return r.common.async ? Promise.all([
2404
+ this._def.left._parseAsync({
2405
+ data: r.data,
2406
+ path: r.path,
2407
+ parent: r
2408
+ }),
2409
+ this._def.right._parseAsync({
2410
+ data: r.data,
2411
+ path: r.path,
2412
+ parent: r
2413
+ })
2414
+ ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
2415
+ data: r.data,
2416
+ path: r.path,
2417
+ parent: r
2418
+ }), this._def.right._parseSync({
2419
+ data: r.data,
2420
+ path: r.path,
2421
+ parent: r
2422
+ }));
2423
+ }
2424
+ }
2425
+ ue.create = (n, e, t) => new ue({
2426
+ left: n,
2427
+ right: e,
2428
+ typeName: g.ZodIntersection,
2429
+ ..._(t)
2430
+ });
2431
+ class D extends v {
2432
+ _parse(e) {
2433
+ const { status: t, ctx: r } = this._processInputParams(e);
2434
+ if (r.parsedType !== p.array)
2435
+ return f(r, {
2436
+ code: c.invalid_type,
2437
+ expected: p.array,
2438
+ received: r.parsedType
2439
+ }), y;
2440
+ if (r.data.length < this._def.items.length)
2441
+ return f(r, {
2442
+ code: c.too_small,
2443
+ minimum: this._def.items.length,
2444
+ inclusive: !0,
2445
+ exact: !1,
2446
+ type: "array"
2447
+ }), y;
2448
+ !this._def.rest && r.data.length > this._def.items.length && (f(r, {
2449
+ code: c.too_big,
2450
+ maximum: this._def.items.length,
2451
+ inclusive: !0,
2452
+ exact: !1,
2453
+ type: "array"
2454
+ }), t.dirty());
2455
+ const a = [...r.data].map((i, o) => {
2456
+ const u = this._def.items[o] || this._def.rest;
2457
+ return u ? u._parse(new C(r, i, r.path, o)) : null;
2458
+ }).filter((i) => !!i);
2459
+ return r.common.async ? Promise.all(a).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, a);
2460
+ }
2461
+ get items() {
2462
+ return this._def.items;
2463
+ }
2464
+ rest(e) {
2465
+ return new D({
2466
+ ...this._def,
2467
+ rest: e
2468
+ });
2469
+ }
2470
+ }
2471
+ D.create = (n, e) => {
2472
+ if (!Array.isArray(n))
2473
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2474
+ return new D({
2475
+ items: n,
2476
+ typeName: g.ZodTuple,
2477
+ rest: null,
2478
+ ..._(e)
2479
+ });
2480
+ };
2481
+ class le extends v {
2482
+ get keySchema() {
2483
+ return this._def.keyType;
2484
+ }
2485
+ get valueSchema() {
2486
+ return this._def.valueType;
2487
+ }
2488
+ _parse(e) {
2489
+ const { status: t, ctx: r } = this._processInputParams(e);
2490
+ if (r.parsedType !== p.object)
2491
+ return f(r, {
2492
+ code: c.invalid_type,
2493
+ expected: p.object,
2494
+ received: r.parsedType
2495
+ }), y;
2496
+ const s = [], a = this._def.keyType, i = this._def.valueType;
2497
+ for (const o in r.data)
2498
+ s.push({
2499
+ key: a._parse(new C(r, o, r.path, o)),
2500
+ value: i._parse(new C(r, r.data[o], r.path, o)),
2501
+ alwaysSet: o in r.data
2502
+ });
2503
+ return r.common.async ? k.mergeObjectAsync(t, s) : k.mergeObjectSync(t, s);
2504
+ }
2505
+ get element() {
2506
+ return this._def.valueType;
2507
+ }
2508
+ static create(e, t, r) {
2509
+ return t instanceof v ? new le({
2510
+ keyType: e,
2511
+ valueType: t,
2512
+ typeName: g.ZodRecord,
2513
+ ..._(r)
2514
+ }) : new le({
2515
+ keyType: S.create(),
2516
+ valueType: e,
2517
+ typeName: g.ZodRecord,
2518
+ ..._(t)
2519
+ });
2520
+ }
2521
+ }
2522
+ class Se extends v {
2523
+ get keySchema() {
2524
+ return this._def.keyType;
2525
+ }
2526
+ get valueSchema() {
2527
+ return this._def.valueType;
2528
+ }
2529
+ _parse(e) {
2530
+ const { status: t, ctx: r } = this._processInputParams(e);
2531
+ if (r.parsedType !== p.map)
2532
+ return f(r, {
2533
+ code: c.invalid_type,
2534
+ expected: p.map,
2535
+ received: r.parsedType
2536
+ }), y;
2537
+ const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, u], l) => ({
2538
+ key: s._parse(new C(r, o, r.path, [l, "key"])),
2539
+ value: a._parse(new C(r, u, r.path, [l, "value"]))
2540
+ }));
2541
+ if (r.common.async) {
2542
+ const o = /* @__PURE__ */ new Map();
2543
+ return Promise.resolve().then(async () => {
2544
+ for (const u of i) {
2545
+ const l = await u.key, m = await u.value;
2546
+ if (l.status === "aborted" || m.status === "aborted")
2547
+ return y;
2548
+ (l.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(l.value, m.value);
2549
+ }
2550
+ return { status: t.value, value: o };
2551
+ });
2552
+ } else {
2553
+ const o = /* @__PURE__ */ new Map();
2554
+ for (const u of i) {
2555
+ const l = u.key, m = u.value;
2556
+ if (l.status === "aborted" || m.status === "aborted")
2557
+ return y;
2558
+ (l.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(l.value, m.value);
2559
+ }
2560
+ return { status: t.value, value: o };
2561
+ }
2562
+ }
2563
+ }
2564
+ Se.create = (n, e, t) => new Se({
2565
+ valueType: e,
2566
+ keyType: n,
2567
+ typeName: g.ZodMap,
2568
+ ..._(t)
2569
+ });
2570
+ class W extends v {
2571
+ _parse(e) {
2572
+ const { status: t, ctx: r } = this._processInputParams(e);
2573
+ if (r.parsedType !== p.set)
2574
+ return f(r, {
2575
+ code: c.invalid_type,
2576
+ expected: p.set,
2577
+ received: r.parsedType
2578
+ }), y;
2579
+ const s = this._def;
2580
+ s.minSize !== null && r.data.size < s.minSize.value && (f(r, {
2581
+ code: c.too_small,
2582
+ minimum: s.minSize.value,
2583
+ type: "set",
2584
+ inclusive: !0,
2585
+ exact: !1,
2586
+ message: s.minSize.message
2587
+ }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (f(r, {
2588
+ code: c.too_big,
2589
+ maximum: s.maxSize.value,
2590
+ type: "set",
2591
+ inclusive: !0,
2592
+ exact: !1,
2593
+ message: s.maxSize.message
2594
+ }), t.dirty());
2595
+ const a = this._def.valueType;
2596
+ function i(u) {
2597
+ const l = /* @__PURE__ */ new Set();
2598
+ for (const m of u) {
2599
+ if (m.status === "aborted")
2600
+ return y;
2601
+ m.status === "dirty" && t.dirty(), l.add(m.value);
2602
+ }
2603
+ return { status: t.value, value: l };
2604
+ }
2605
+ const o = [...r.data.values()].map((u, l) => a._parse(new C(r, u, r.path, l)));
2606
+ return r.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2607
+ }
2608
+ min(e, t) {
2609
+ return new W({
2610
+ ...this._def,
2611
+ minSize: { value: e, message: h.toString(t) }
2612
+ });
2613
+ }
2614
+ max(e, t) {
2615
+ return new W({
2616
+ ...this._def,
2617
+ maxSize: { value: e, message: h.toString(t) }
2618
+ });
2619
+ }
2620
+ size(e, t) {
2621
+ return this.min(e, t).max(e, t);
2622
+ }
2623
+ nonempty(e) {
2624
+ return this.min(1, e);
2625
+ }
2626
+ }
2627
+ W.create = (n, e) => new W({
2628
+ valueType: n,
2629
+ minSize: null,
2630
+ maxSize: null,
2631
+ typeName: g.ZodSet,
2632
+ ..._(e)
2633
+ });
2634
+ class Q extends v {
2635
+ constructor() {
2636
+ super(...arguments), this.validate = this.implement;
2637
+ }
2638
+ _parse(e) {
2639
+ const { ctx: t } = this._processInputParams(e);
2640
+ if (t.parsedType !== p.function)
2641
+ return f(t, {
2642
+ code: c.invalid_type,
2643
+ expected: p.function,
2644
+ received: t.parsedType
2645
+ }), y;
2646
+ function r(o, u) {
2647
+ return ke({
2648
+ data: o,
2649
+ path: t.path,
2650
+ errorMaps: [
2651
+ t.common.contextualErrorMap,
2652
+ t.schemaErrorMap,
2653
+ xe(),
2654
+ X
2655
+ ].filter((l) => !!l),
2656
+ issueData: {
2657
+ code: c.invalid_arguments,
2658
+ argumentsError: u
2659
+ }
2660
+ });
2661
+ }
2662
+ function s(o, u) {
2663
+ return ke({
2664
+ data: o,
2665
+ path: t.path,
2666
+ errorMaps: [
2667
+ t.common.contextualErrorMap,
2668
+ t.schemaErrorMap,
2669
+ xe(),
2670
+ X
2671
+ ].filter((l) => !!l),
2672
+ issueData: {
2673
+ code: c.invalid_return_type,
2674
+ returnTypeError: u
2675
+ }
2676
+ });
2677
+ }
2678
+ const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2679
+ if (this._def.returns instanceof te) {
2680
+ const o = this;
2681
+ return w(async function(...u) {
2682
+ const l = new I([]), m = await o._def.args.parseAsync(u, a).catch((Ze) => {
2683
+ throw l.addIssue(r(u, Ze)), l;
2684
+ }), T = await Reflect.apply(i, this, m);
2685
+ return await o._def.returns._def.type.parseAsync(T, a).catch((Ze) => {
2686
+ throw l.addIssue(s(T, Ze)), l;
2687
+ });
2688
+ });
2689
+ } else {
2690
+ const o = this;
2691
+ return w(function(...u) {
2692
+ const l = o._def.args.safeParse(u, a);
2693
+ if (!l.success)
2694
+ throw new I([r(u, l.error)]);
2695
+ const m = Reflect.apply(i, this, l.data), T = o._def.returns.safeParse(m, a);
2696
+ if (!T.success)
2697
+ throw new I([s(m, T.error)]);
2698
+ return T.data;
2699
+ });
2700
+ }
2701
+ }
2702
+ parameters() {
2703
+ return this._def.args;
2704
+ }
2705
+ returnType() {
2706
+ return this._def.returns;
2707
+ }
2708
+ args(...e) {
2709
+ return new Q({
2710
+ ...this._def,
2711
+ args: D.create(e).rest(G.create())
2712
+ });
2713
+ }
2714
+ returns(e) {
2715
+ return new Q({
2716
+ ...this._def,
2717
+ returns: e
2718
+ });
2719
+ }
2720
+ implement(e) {
2721
+ return this.parse(e);
2722
+ }
2723
+ strictImplement(e) {
2724
+ return this.parse(e);
2725
+ }
2726
+ static create(e, t, r) {
2727
+ return new Q({
2728
+ args: e || D.create([]).rest(G.create()),
2729
+ returns: t || G.create(),
2730
+ typeName: g.ZodFunction,
2731
+ ..._(r)
2732
+ });
2733
+ }
2734
+ }
2735
+ class fe extends v {
2736
+ get schema() {
2737
+ return this._def.getter();
2738
+ }
2739
+ _parse(e) {
2740
+ const { ctx: t } = this._processInputParams(e);
2741
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2742
+ }
2743
+ }
2744
+ fe.create = (n, e) => new fe({
2745
+ getter: n,
2746
+ typeName: g.ZodLazy,
2747
+ ..._(e)
2748
+ });
2749
+ class pe extends v {
2750
+ _parse(e) {
2751
+ if (e.data !== this._def.value) {
2752
+ const t = this._getOrReturnCtx(e);
2753
+ return f(t, {
2754
+ received: t.data,
2755
+ code: c.invalid_literal,
2756
+ expected: this._def.value
2757
+ }), y;
2758
+ }
2759
+ return { status: "valid", value: e.data };
2760
+ }
2761
+ get value() {
2762
+ return this._def.value;
2763
+ }
2764
+ }
2765
+ pe.create = (n, e) => new pe({
2766
+ value: n,
2767
+ typeName: g.ZodLiteral,
2768
+ ..._(e)
2769
+ });
2770
+ function mt(n, e) {
2771
+ return new M({
2772
+ values: n,
2773
+ typeName: g.ZodEnum,
2774
+ ..._(e)
2775
+ });
2776
+ }
2777
+ class M extends v {
2778
+ constructor() {
2779
+ super(...arguments), ne.set(this, void 0);
2780
+ }
2781
+ _parse(e) {
2782
+ if (typeof e.data != "string") {
2783
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2784
+ return f(t, {
2785
+ expected: b.joinValues(r),
2786
+ received: t.parsedType,
2787
+ code: c.invalid_type
2788
+ }), y;
2789
+ }
2790
+ if (Te(this, ne) || lt(this, ne, new Set(this._def.values)), !Te(this, ne).has(e.data)) {
2791
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2792
+ return f(t, {
2793
+ received: t.data,
2794
+ code: c.invalid_enum_value,
2795
+ options: r
2796
+ }), y;
2797
+ }
2798
+ return w(e.data);
2799
+ }
2800
+ get options() {
2801
+ return this._def.values;
2802
+ }
2803
+ get enum() {
2804
+ const e = {};
2805
+ for (const t of this._def.values)
2806
+ e[t] = t;
2807
+ return e;
2808
+ }
2809
+ get Values() {
2810
+ const e = {};
2811
+ for (const t of this._def.values)
2812
+ e[t] = t;
2813
+ return e;
2814
+ }
2815
+ get Enum() {
2816
+ const e = {};
2817
+ for (const t of this._def.values)
2818
+ e[t] = t;
2819
+ return e;
2820
+ }
2821
+ extract(e, t = this._def) {
2822
+ return M.create(e, {
2823
+ ...this._def,
2824
+ ...t
2825
+ });
2826
+ }
2827
+ exclude(e, t = this._def) {
2828
+ return M.create(this.options.filter((r) => !e.includes(r)), {
2829
+ ...this._def,
2830
+ ...t
2831
+ });
2832
+ }
2833
+ }
2834
+ ne = /* @__PURE__ */ new WeakMap();
2835
+ M.create = mt;
2836
+ class he extends v {
2837
+ constructor() {
2838
+ super(...arguments), re.set(this, void 0);
2839
+ }
2840
+ _parse(e) {
2841
+ const t = b.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2842
+ if (r.parsedType !== p.string && r.parsedType !== p.number) {
2843
+ const s = b.objectValues(t);
2844
+ return f(r, {
2845
+ expected: b.joinValues(s),
2846
+ received: r.parsedType,
2847
+ code: c.invalid_type
2848
+ }), y;
2849
+ }
2850
+ if (Te(this, re) || lt(this, re, new Set(b.getValidEnumValues(this._def.values))), !Te(this, re).has(e.data)) {
2851
+ const s = b.objectValues(t);
2852
+ return f(r, {
2853
+ received: r.data,
2854
+ code: c.invalid_enum_value,
2855
+ options: s
2856
+ }), y;
2857
+ }
2858
+ return w(e.data);
2859
+ }
2860
+ get enum() {
2861
+ return this._def.values;
2862
+ }
2863
+ }
2864
+ re = /* @__PURE__ */ new WeakMap();
2865
+ he.create = (n, e) => new he({
2866
+ values: n,
2867
+ typeName: g.ZodNativeEnum,
2868
+ ..._(e)
2869
+ });
2870
+ class te extends v {
2871
+ unwrap() {
2872
+ return this._def.type;
2873
+ }
2874
+ _parse(e) {
2875
+ const { ctx: t } = this._processInputParams(e);
2876
+ if (t.parsedType !== p.promise && t.common.async === !1)
2877
+ return f(t, {
2878
+ code: c.invalid_type,
2879
+ expected: p.promise,
2880
+ received: t.parsedType
2881
+ }), y;
2882
+ const r = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
2883
+ return w(r.then((s) => this._def.type.parseAsync(s, {
2884
+ path: t.path,
2885
+ errorMap: t.common.contextualErrorMap
2886
+ })));
2887
+ }
2888
+ }
2889
+ te.create = (n, e) => new te({
2890
+ type: n,
2891
+ typeName: g.ZodPromise,
2892
+ ..._(e)
2893
+ });
2894
+ class N extends v {
2895
+ innerType() {
2896
+ return this._def.schema;
2897
+ }
2898
+ sourceType() {
2899
+ return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2900
+ }
2901
+ _parse(e) {
2902
+ const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
2903
+ addIssue: (i) => {
2904
+ f(r, i), i.fatal ? t.abort() : t.dirty();
2905
+ },
2906
+ get path() {
2907
+ return r.path;
2908
+ }
2909
+ };
2910
+ if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2911
+ const i = s.transform(r.data, a);
2912
+ if (r.common.async)
2913
+ return Promise.resolve(i).then(async (o) => {
2914
+ if (t.value === "aborted")
2915
+ return y;
2916
+ const u = await this._def.schema._parseAsync({
2917
+ data: o,
2918
+ path: r.path,
2919
+ parent: r
2920
+ });
2921
+ return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? K(u.value) : u;
2922
+ });
2923
+ {
2924
+ if (t.value === "aborted")
2925
+ return y;
2926
+ const o = this._def.schema._parseSync({
2927
+ data: i,
2928
+ path: r.path,
2929
+ parent: r
2930
+ });
2931
+ return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? K(o.value) : o;
2932
+ }
2933
+ }
2934
+ if (s.type === "refinement") {
2935
+ const i = (o) => {
2936
+ const u = s.refinement(o, a);
2937
+ if (r.common.async)
2938
+ return Promise.resolve(u);
2939
+ if (u instanceof Promise)
2940
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2941
+ return o;
2942
+ };
2943
+ if (r.common.async === !1) {
2944
+ const o = this._def.schema._parseSync({
2945
+ data: r.data,
2946
+ path: r.path,
2947
+ parent: r
2948
+ });
2949
+ return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2950
+ } else
2951
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2952
+ }
2953
+ if (s.type === "transform")
2954
+ if (r.common.async === !1) {
2955
+ const i = this._def.schema._parseSync({
2956
+ data: r.data,
2957
+ path: r.path,
2958
+ parent: r
2959
+ });
2960
+ if (!H(i))
2961
+ return i;
2962
+ const o = s.transform(i.value, a);
2963
+ if (o instanceof Promise)
2964
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2965
+ return { status: t.value, value: o };
2966
+ } else
2967
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => H(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2968
+ b.assertNever(s);
2969
+ }
2970
+ }
2971
+ N.create = (n, e, t) => new N({
2972
+ schema: n,
2973
+ typeName: g.ZodEffects,
2974
+ effect: e,
2975
+ ..._(t)
2976
+ });
2977
+ N.createWithPreprocess = (n, e, t) => new N({
2978
+ schema: e,
2979
+ effect: { type: "preprocess", transform: n },
2980
+ typeName: g.ZodEffects,
2981
+ ..._(t)
2982
+ });
2983
+ class A extends v {
2984
+ _parse(e) {
2985
+ return this._getType(e) === p.undefined ? w(void 0) : this._def.innerType._parse(e);
2986
+ }
2987
+ unwrap() {
2988
+ return this._def.innerType;
2989
+ }
2990
+ }
2991
+ A.create = (n, e) => new A({
2992
+ innerType: n,
2993
+ typeName: g.ZodOptional,
2994
+ ..._(e)
2995
+ });
2996
+ class $ extends v {
2997
+ _parse(e) {
2998
+ return this._getType(e) === p.null ? w(null) : this._def.innerType._parse(e);
2999
+ }
3000
+ unwrap() {
3001
+ return this._def.innerType;
3002
+ }
3003
+ }
3004
+ $.create = (n, e) => new $({
3005
+ innerType: n,
3006
+ typeName: g.ZodNullable,
3007
+ ..._(e)
3008
+ });
3009
+ class me extends v {
3010
+ _parse(e) {
3011
+ const { ctx: t } = this._processInputParams(e);
3012
+ let r = t.data;
3013
+ return t.parsedType === p.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
3014
+ data: r,
3015
+ path: t.path,
3016
+ parent: t
3017
+ });
3018
+ }
3019
+ removeDefault() {
3020
+ return this._def.innerType;
3021
+ }
3022
+ }
3023
+ me.create = (n, e) => new me({
3024
+ innerType: n,
3025
+ typeName: g.ZodDefault,
3026
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
3027
+ ..._(e)
3028
+ });
3029
+ class ge extends v {
3030
+ _parse(e) {
3031
+ const { ctx: t } = this._processInputParams(e), r = {
3032
+ ...t,
3033
+ common: {
3034
+ ...t.common,
3035
+ issues: []
3036
+ }
3037
+ }, s = this._def.innerType._parse({
3038
+ data: r.data,
3039
+ path: r.path,
3040
+ parent: {
3041
+ ...r
3042
+ }
3043
+ });
3044
+ return ae(s) ? s.then((a) => ({
3045
+ status: "valid",
3046
+ value: a.status === "valid" ? a.value : this._def.catchValue({
3047
+ get error() {
3048
+ return new I(r.common.issues);
3049
+ },
3050
+ input: r.data
3051
+ })
3052
+ })) : {
3053
+ status: "valid",
3054
+ value: s.status === "valid" ? s.value : this._def.catchValue({
3055
+ get error() {
3056
+ return new I(r.common.issues);
3057
+ },
3058
+ input: r.data
3059
+ })
3060
+ };
3061
+ }
3062
+ removeCatch() {
3063
+ return this._def.innerType;
3064
+ }
3065
+ }
3066
+ ge.create = (n, e) => new ge({
3067
+ innerType: n,
3068
+ typeName: g.ZodCatch,
3069
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
3070
+ ..._(e)
3071
+ });
3072
+ class Ee extends v {
3073
+ _parse(e) {
3074
+ if (this._getType(e) !== p.nan) {
3075
+ const r = this._getOrReturnCtx(e);
3076
+ return f(r, {
3077
+ code: c.invalid_type,
3078
+ expected: p.nan,
3079
+ received: r.parsedType
3080
+ }), y;
3081
+ }
3082
+ return { status: "valid", value: e.data };
3083
+ }
3084
+ }
3085
+ Ee.create = (n) => new Ee({
3086
+ typeName: g.ZodNaN,
3087
+ ..._(n)
3088
+ });
3089
+ const In = Symbol("zod_brand");
3090
+ class $e extends v {
3091
+ _parse(e) {
3092
+ const { ctx: t } = this._processInputParams(e), r = t.data;
3093
+ return this._def.type._parse({
3094
+ data: r,
3095
+ path: t.path,
3096
+ parent: t
3097
+ });
3098
+ }
3099
+ unwrap() {
3100
+ return this._def.type;
3101
+ }
3102
+ }
3103
+ class ve extends v {
3104
+ _parse(e) {
3105
+ const { status: t, ctx: r } = this._processInputParams(e);
3106
+ if (r.common.async)
3107
+ return (async () => {
3108
+ const a = await this._def.in._parseAsync({
3109
+ data: r.data,
3110
+ path: r.path,
3111
+ parent: r
3112
+ });
3113
+ return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), K(a.value)) : this._def.out._parseAsync({
3114
+ data: a.value,
3115
+ path: r.path,
3116
+ parent: r
3117
+ });
3118
+ })();
3119
+ {
3120
+ const s = this._def.in._parseSync({
3121
+ data: r.data,
3122
+ path: r.path,
3123
+ parent: r
3124
+ });
3125
+ return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
3126
+ status: "dirty",
3127
+ value: s.value
3128
+ }) : this._def.out._parseSync({
3129
+ data: s.value,
3130
+ path: r.path,
3131
+ parent: r
3132
+ });
3133
+ }
3134
+ }
3135
+ static create(e, t) {
3136
+ return new ve({
3137
+ in: e,
3138
+ out: t,
3139
+ typeName: g.ZodPipeline
3140
+ });
3141
+ }
3142
+ }
3143
+ class ye extends v {
3144
+ _parse(e) {
3145
+ const t = this._def.innerType._parse(e), r = (s) => (H(s) && (s.value = Object.freeze(s.value)), s);
3146
+ return ae(t) ? t.then((s) => r(s)) : r(t);
3147
+ }
3148
+ unwrap() {
3149
+ return this._def.innerType;
3150
+ }
3151
+ }
3152
+ ye.create = (n, e) => new ye({
3153
+ innerType: n,
3154
+ typeName: g.ZodReadonly,
3155
+ ..._(e)
3156
+ });
3157
+ function gt(n, e = {}, t) {
3158
+ return n ? ee.create().superRefine((r, s) => {
3159
+ var a, i;
3160
+ if (!n(r)) {
3161
+ const o = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, l = typeof o == "string" ? { message: o } : o;
3162
+ s.addIssue({ code: "custom", ...l, fatal: u });
3163
+ }
3164
+ }) : ee.create();
3165
+ }
3166
+ const Sn = {
3167
+ object: x.lazycreate
3168
+ };
3169
+ var g;
3170
+ (function(n) {
3171
+ n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
3172
+ })(g || (g = {}));
3173
+ const En = (n, e = {
3174
+ message: `Input not instance of ${n.name}`
3175
+ }) => gt((t) => t instanceof n, e), yt = S.create, _t = z.create, Nn = Ee.create, On = L.create, vt = ie.create, An = q.create, Cn = we.create, Dn = oe.create, Rn = de.create, Zn = ee.create, Fn = G.create, jn = F.create, Pn = Ie.create, zn = E.create, Ln = x.create, Mn = x.strictCreate, $n = ce.create, Un = Ce.create, Vn = ue.create, Bn = D.create, Gn = le.create, Hn = Se.create, qn = W.create, Wn = Q.create, Yn = fe.create, Jn = pe.create, Kn = M.create, Qn = he.create, Xn = te.create, ct = N.create, er = A.create, tr = $.create, nr = N.createWithPreprocess, rr = ve.create, sr = () => yt().optional(), ar = () => _t().optional(), ir = () => vt().optional(), or = {
3176
+ string: (n) => S.create({ ...n, coerce: !0 }),
3177
+ number: (n) => z.create({ ...n, coerce: !0 }),
3178
+ boolean: (n) => ie.create({
3179
+ ...n,
3180
+ coerce: !0
3181
+ }),
3182
+ bigint: (n) => L.create({ ...n, coerce: !0 }),
3183
+ date: (n) => q.create({ ...n, coerce: !0 })
3184
+ }, dr = y;
3185
+ var d = /* @__PURE__ */ Object.freeze({
3186
+ __proto__: null,
3187
+ defaultErrorMap: X,
3188
+ setErrorMap: tn,
3189
+ getErrorMap: xe,
3190
+ makeIssue: ke,
3191
+ EMPTY_PATH: nn,
3192
+ addIssueToContext: f,
3193
+ ParseStatus: k,
3194
+ INVALID: y,
3195
+ DIRTY: K,
3196
+ OK: w,
3197
+ isAborted: Pe,
3198
+ isDirty: ze,
3199
+ isValid: H,
3200
+ isAsync: ae,
3201
+ get util() {
3202
+ return b;
3203
+ },
3204
+ get objectUtil() {
3205
+ return je;
3206
+ },
3207
+ ZodParsedType: p,
3208
+ getParsedType: Z,
3209
+ ZodType: v,
3210
+ datetimeRegex: ht,
3211
+ ZodString: S,
3212
+ ZodNumber: z,
3213
+ ZodBigInt: L,
3214
+ ZodBoolean: ie,
3215
+ ZodDate: q,
3216
+ ZodSymbol: we,
3217
+ ZodUndefined: oe,
3218
+ ZodNull: de,
3219
+ ZodAny: ee,
3220
+ ZodUnknown: G,
3221
+ ZodNever: F,
3222
+ ZodVoid: Ie,
3223
+ ZodArray: E,
3224
+ ZodObject: x,
3225
+ ZodUnion: ce,
3226
+ ZodDiscriminatedUnion: Ce,
3227
+ ZodIntersection: ue,
3228
+ ZodTuple: D,
3229
+ ZodRecord: le,
3230
+ ZodMap: Se,
3231
+ ZodSet: W,
3232
+ ZodFunction: Q,
3233
+ ZodLazy: fe,
3234
+ ZodLiteral: pe,
3235
+ ZodEnum: M,
3236
+ ZodNativeEnum: he,
3237
+ ZodPromise: te,
3238
+ ZodEffects: N,
3239
+ ZodTransformer: N,
3240
+ ZodOptional: A,
3241
+ ZodNullable: $,
3242
+ ZodDefault: me,
3243
+ ZodCatch: ge,
3244
+ ZodNaN: Ee,
3245
+ BRAND: In,
3246
+ ZodBranded: $e,
3247
+ ZodPipeline: ve,
3248
+ ZodReadonly: ye,
3249
+ custom: gt,
3250
+ Schema: v,
3251
+ ZodSchema: v,
3252
+ late: Sn,
3253
+ get ZodFirstPartyTypeKind() {
3254
+ return g;
3255
+ },
3256
+ coerce: or,
3257
+ any: Zn,
3258
+ array: zn,
3259
+ bigint: On,
3260
+ boolean: vt,
3261
+ date: An,
3262
+ discriminatedUnion: Un,
3263
+ effect: ct,
3264
+ enum: Kn,
3265
+ function: Wn,
3266
+ instanceof: En,
3267
+ intersection: Vn,
3268
+ lazy: Yn,
3269
+ literal: Jn,
3270
+ map: Hn,
3271
+ nan: Nn,
3272
+ nativeEnum: Qn,
3273
+ never: jn,
3274
+ null: Rn,
3275
+ nullable: tr,
3276
+ number: _t,
3277
+ object: Ln,
3278
+ oboolean: ir,
3279
+ onumber: ar,
3280
+ optional: er,
3281
+ ostring: sr,
3282
+ pipeline: rr,
3283
+ preprocess: nr,
3284
+ promise: Xn,
3285
+ record: Gn,
3286
+ set: qn,
3287
+ strictObject: Mn,
3288
+ string: yt,
3289
+ symbol: Cn,
3290
+ transformer: ct,
3291
+ tuple: Bn,
3292
+ undefined: Dn,
3293
+ union: $n,
3294
+ unknown: Fn,
3295
+ void: Pn,
3296
+ NEVER: dr,
3297
+ ZodIssueCode: c,
3298
+ quotelessJson: en,
3299
+ ZodError: I
3300
+ });
3301
+ const bt = (n) => n != null, cr = d.any().refine((n) => bt(n)), xt = d.enum([
3302
+ "Internal",
3303
+ "MatrixConnect",
3304
+ "PullResponder",
3305
+ "RESTWebhook",
3306
+ "SecureConnect",
3307
+ "SwitchboardPush"
3308
+ ]), kt = d.enum(["PullResponder"]);
3309
+ function Ue() {
3310
+ return d.object({
3311
+ document: d.unknown().nullish(),
3312
+ documentType: d.string(),
3313
+ id: d.string(),
3314
+ name: d.string(),
3315
+ parentFolder: d.string().nullish(),
3316
+ synchronizationUnits: d.array(De())
3317
+ });
3318
+ }
3319
+ function Ve() {
3320
+ return d.object({
3321
+ id: d.string(),
3322
+ name: d.string(),
3323
+ parentFolder: d.string().nullish()
3324
+ });
3325
+ }
3326
+ function Be() {
3327
+ return d.object({
3328
+ listener: We()
3329
+ });
3330
+ }
3331
+ function Ge() {
3332
+ return d.object({
3333
+ trigger: nt()
3334
+ });
3335
+ }
3336
+ function He() {
3337
+ return d.object({
3338
+ srcId: d.string(),
3339
+ synchronizationUnits: d.array(De()).nullish(),
3340
+ targetId: d.string(),
3341
+ targetName: d.string().nullish(),
3342
+ targetParentFolder: d.string().nullish()
3343
+ });
3344
+ }
3345
+ function qe() {
3346
+ return d.object({
3347
+ id: d.string()
3348
+ });
3349
+ }
3350
+ function ur() {
3351
+ return d.object({
3352
+ __typename: d.literal("DocumentDriveLocalState").optional(),
3353
+ availableOffline: d.boolean(),
3354
+ listeners: d.array(We()),
3355
+ sharingType: d.string().nullable(),
3356
+ triggers: d.array(nt())
3357
+ });
3358
+ }
3359
+ function lr() {
3360
+ return d.object({
3361
+ __typename: d.literal("DocumentDriveState").optional(),
3362
+ icon: d.string().nullable(),
3363
+ id: d.string(),
3364
+ name: d.string(),
3365
+ nodes: d.array(Et()),
3366
+ slug: d.string().nullable()
3367
+ });
3368
+ }
3369
+ function Tt() {
3370
+ return d.object({
3371
+ __typename: d.literal("FileNode").optional(),
3372
+ documentType: d.string(),
3373
+ id: d.string(),
3374
+ kind: d.string(),
3375
+ name: d.string(),
3376
+ parentFolder: d.string().nullable(),
3377
+ synchronizationUnits: d.array(De())
3378
+ });
3379
+ }
3380
+ function wt() {
3381
+ return d.object({
3382
+ __typename: d.literal("FolderNode").optional(),
3383
+ id: d.string(),
3384
+ kind: d.string(),
3385
+ name: d.string(),
3386
+ parentFolder: d.string().nullable()
3387
+ });
3388
+ }
3389
+ function We() {
3390
+ return d.object({
3391
+ __typename: d.literal("Listener").optional(),
3392
+ block: d.boolean(),
3393
+ callInfo: It().nullable(),
3394
+ filter: St(),
3395
+ label: d.string().nullable(),
3396
+ listenerId: d.string(),
3397
+ system: d.boolean()
3398
+ });
3399
+ }
3400
+ function It() {
3401
+ return d.object({
3402
+ __typename: d.literal("ListenerCallInfo").optional(),
3403
+ data: d.string().nullable(),
3404
+ name: d.string().nullable(),
3405
+ transmitterType: xt.nullable()
3406
+ });
3407
+ }
3408
+ function St() {
3409
+ return d.object({
3410
+ __typename: d.literal("ListenerFilter").optional(),
3411
+ branch: d.array(d.string()).nullable(),
3412
+ documentId: d.array(d.string()).nullable(),
3413
+ documentType: d.array(d.string()),
3414
+ scope: d.array(d.string()).nullable()
3415
+ });
3416
+ }
3417
+ function Ye() {
3418
+ return d.object({
3419
+ srcFolder: d.string(),
3420
+ targetParentFolder: d.string().nullish()
3421
+ });
3422
+ }
3423
+ function Et() {
3424
+ return d.union([Tt(), wt()]);
3425
+ }
3426
+ function Nt() {
3427
+ return d.object({
3428
+ __typename: d.literal("PullResponderTriggerData").optional(),
3429
+ interval: d.string(),
3430
+ listenerId: d.string(),
3431
+ url: d.string()
3432
+ });
3433
+ }
3434
+ function Je() {
3435
+ return d.object({
3436
+ listenerId: d.string()
3437
+ });
3438
+ }
3439
+ function Ke() {
3440
+ return d.object({
3441
+ triggerId: d.string()
3442
+ });
3443
+ }
3444
+ function Qe() {
3445
+ return d.object({
3446
+ availableOffline: d.boolean()
3447
+ });
3448
+ }
3449
+ function Xe() {
3450
+ return d.object({
3451
+ icon: d.string()
3452
+ });
3453
+ }
3454
+ function et() {
3455
+ return d.object({
3456
+ name: d.string()
3457
+ });
3458
+ }
3459
+ function tt() {
3460
+ return d.object({
3461
+ type: d.string()
3462
+ });
3463
+ }
3464
+ function De() {
3465
+ return d.object({
3466
+ __typename: d.literal("SynchronizationUnit").optional(),
3467
+ branch: d.string(),
3468
+ scope: d.string(),
3469
+ syncId: d.string()
3470
+ });
3471
+ }
3472
+ function nt() {
3473
+ return d.object({
3474
+ __typename: d.literal("Trigger").optional(),
3475
+ data: Ot().nullable(),
3476
+ id: d.string(),
3477
+ type: kt
3478
+ });
3479
+ }
3480
+ function Ot() {
3481
+ return Nt();
3482
+ }
3483
+ function rt() {
3484
+ return d.object({
3485
+ documentType: d.string().nullish(),
3486
+ id: d.string(),
3487
+ name: d.string().nullish(),
3488
+ parentFolder: d.string().nullish()
3489
+ });
3490
+ }
3491
+ function st() {
3492
+ return d.object({
3493
+ id: d.string(),
3494
+ name: d.string().nullish(),
3495
+ parentFolder: d.string().nullish()
3496
+ });
3497
+ }
3498
+ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3499
+ __proto__: null,
3500
+ AddFileInputSchema: Ue,
3501
+ AddFolderInputSchema: Ve,
3502
+ AddListenerInputSchema: Be,
3503
+ AddTriggerInputSchema: Ge,
3504
+ CopyNodeInputSchema: He,
3505
+ DeleteNodeInputSchema: qe,
3506
+ DocumentDriveLocalStateSchema: ur,
3507
+ DocumentDriveStateSchema: lr,
3508
+ FileNodeSchema: Tt,
3509
+ FolderNodeSchema: wt,
3510
+ ListenerCallInfoSchema: It,
3511
+ ListenerFilterSchema: St,
3512
+ ListenerSchema: We,
3513
+ MoveNodeInputSchema: Ye,
3514
+ NodeSchema: Et,
3515
+ PullResponderTriggerDataSchema: Nt,
3516
+ RemoveListenerInputSchema: Je,
3517
+ RemoveTriggerInputSchema: Ke,
3518
+ SetAvailableOfflineInputSchema: Qe,
3519
+ SetDriveIconInputSchema: Xe,
3520
+ SetDriveNameInputSchema: et,
3521
+ SetSharingTypeInputSchema: tt,
3522
+ SynchronizationUnitSchema: De,
3523
+ TransmitterTypeSchema: xt,
3524
+ TriggerDataSchema: Ot,
3525
+ TriggerSchema: nt,
3526
+ TriggerTypeSchema: kt,
3527
+ UpdateFileInputSchema: rt,
3528
+ UpdateNodeInputSchema: st,
3529
+ definedNonNullAnySchema: cr,
3530
+ isDefinedNonNullAny: bt
3531
+ }, Symbol.toStringTag, { value: "Module" })), V = {
3532
+ addFileOperation(n, e, t) {
3533
+ if (n.nodes.find((o) => o.id === e.input.id))
3534
+ throw new Error(`Node with id ${e.input.id} already exists!`);
3535
+ const r = B({
3536
+ nodes: n.nodes,
3537
+ srcName: e.input.name,
3538
+ targetParentFolder: e.input.parentFolder || null
3539
+ }), s = e.input.synchronizationUnits, a = s.find(
3540
+ (o) => !!n.nodes.find(
3541
+ (u) => P(u) && u.synchronizationUnits.find(
3542
+ (l) => l.syncId === o.syncId
3543
+ )
3544
+ )
3545
+ );
3546
+ if (a)
3547
+ throw new Error(
3548
+ `A synchronization unit with Id ${a.syncId} already exists`
3549
+ );
3550
+ const i = {
3551
+ id: e.input.id,
3552
+ name: r,
3553
+ kind: "file",
3554
+ parentFolder: e.input.parentFolder ?? null,
3555
+ synchronizationUnits: s,
3556
+ documentType: e.input.documentType
3557
+ };
3558
+ n.nodes.push(i), t == null || t({
3559
+ type: "CREATE_CHILD_DOCUMENT",
3560
+ input: {
3561
+ id: e.input.id,
3562
+ documentType: e.input.documentType,
3563
+ synchronizationUnits: s,
3564
+ document: e.input.document
3565
+ }
3566
+ });
3567
+ },
3568
+ addFolderOperation(n, e) {
3569
+ if (n.nodes.find((r) => r.id === e.input.id))
3570
+ throw new Error(`Node with id ${e.input.id} already exists!`);
3571
+ const t = B({
3572
+ nodes: n.nodes,
3573
+ srcName: e.input.name,
3574
+ targetParentFolder: e.input.parentFolder || null
3575
+ });
3576
+ n.nodes.push({
3577
+ ...e.input,
3578
+ name: t,
3579
+ kind: "folder",
3580
+ parentFolder: e.input.parentFolder ?? null
3581
+ });
3582
+ },
3583
+ deleteNodeOperation(n, e, t) {
3584
+ const r = n.nodes.find((a) => a.id === e.input.id);
3585
+ if (!r)
3586
+ throw new Error(`Node with id ${e.input.id} not found`);
3587
+ const s = _e(r, n.nodes);
3588
+ n.nodes = n.nodes.filter(
3589
+ (a) => a.id !== e.input.id && !s.find((i) => i.id === a.id)
3590
+ ), [r, ...s].filter((a) => P(a)).forEach((a) => {
3591
+ t == null || t({
3592
+ type: "DELETE_CHILD_DOCUMENT",
3593
+ input: {
3594
+ id: a.id
3595
+ }
3596
+ });
3597
+ });
3598
+ },
3599
+ updateFileOperation(n, e) {
3600
+ n.nodes = n.nodes.map(
3601
+ (t) => t.id === e.input.id ? {
3602
+ ...t,
3603
+ name: B({
3604
+ nodes: n.nodes,
3605
+ srcName: e.input.name ?? t.name,
3606
+ targetParentFolder: e.input.parentFolder || null
3607
+ }),
3608
+ documentType: e.input.documentType ?? t.documentType
3609
+ } : t
3610
+ );
3611
+ },
3612
+ updateNodeOperation(n, e) {
3613
+ n.nodes = n.nodes.map(
3614
+ (t) => t.id === e.input.id ? {
3615
+ ...t,
3616
+ name: B({
3617
+ nodes: n.nodes,
3618
+ srcName: e.input.name ?? t.name,
3619
+ targetParentFolder: e.input.parentFolder || null
3620
+ }),
3621
+ parentFolder: e.input.parentFolder === null ? null : t.parentFolder
3622
+ } : t
3623
+ );
3624
+ },
3625
+ copyNodeOperation(n, e, t) {
3626
+ const r = n.nodes.find((u) => u.id === e.input.srcId);
3627
+ if (!r)
3628
+ throw new Error(`Node with id ${e.input.srcId} not found`);
3629
+ if (n.nodes.find(
3630
+ (u) => u.id === e.input.targetId
3631
+ ))
3632
+ throw new Error(`Node with id ${e.input.targetId} already exists`);
3633
+ const a = B({
3634
+ nodes: n.nodes,
3635
+ srcName: e.input.targetName || r.name,
3636
+ targetParentFolder: e.input.targetParentFolder || null
3637
+ }), i = {
3638
+ ...r,
3639
+ name: a,
3640
+ id: e.input.targetId,
3641
+ parentFolder: e.input.targetParentFolder || null
3642
+ }, o = P(i);
3643
+ if (o) {
3644
+ const u = e.input.synchronizationUnits;
3645
+ if (!e.input.synchronizationUnits)
3646
+ throw new Error("Synchronization units were not provided");
3647
+ const l = u.find(
3648
+ (m) => !!n.nodes.find(
3649
+ (T) => P(T) && T.synchronizationUnits.find(
3650
+ (be) => be.syncId === m.syncId
3651
+ )
3652
+ )
3653
+ );
3654
+ if (l)
3655
+ throw new Error(
3656
+ `A synchronization unit with Id ${l.syncId} already exists`
3657
+ );
3658
+ i.synchronizationUnits = u;
3659
+ }
3660
+ n.nodes.push(i), o && (t == null || t({
3661
+ type: "COPY_CHILD_DOCUMENT",
3662
+ input: {
3663
+ id: e.input.srcId,
3664
+ newId: e.input.targetId,
3665
+ synchronizationUnits: i.synchronizationUnits
3666
+ }
3667
+ }));
3668
+ },
3669
+ moveNodeOperation(n, e) {
3670
+ if (e.input.srcFolder === e.input.targetParentFolder)
3671
+ throw new Error(
3672
+ "Circular Reference Error: Attempting to move a node to its current parent folder"
3673
+ );
3674
+ const t = n.nodes.find((s) => s.id === e.input.srcFolder);
3675
+ if (!t)
3676
+ throw new Error(`Node with id ${e.input.srcFolder} not found`);
3677
+ const r = B({
3678
+ nodes: n.nodes,
3679
+ srcName: t.name,
3680
+ targetParentFolder: e.input.targetParentFolder || null
3681
+ });
3682
+ if (Vt(t) && _e(t, n.nodes).find(
3683
+ (a) => a.id === e.input.targetParentFolder
3684
+ ))
3685
+ throw new Error(
3686
+ "Circular Reference Error: Cannot move a folder to one of its descendants"
3687
+ );
3688
+ n.nodes = n.nodes.map((s) => s.id === e.input.srcFolder ? {
3689
+ ...s,
3690
+ name: r,
3691
+ parentFolder: e.input.targetParentFolder || null
3692
+ } : s);
3693
+ }
3694
+ }, j = {
3695
+ setDriveNameOperation(n, e, t) {
3696
+ n.name = e.input.name;
3697
+ },
3698
+ setDriveIconOperation(n, e, t) {
3699
+ n.icon = e.input.icon;
3700
+ },
3701
+ setSharingTypeOperation(n, e, t) {
3702
+ n.sharingType = e.input.type;
3703
+ },
3704
+ setAvailableOfflineOperation(n, e, t) {
3705
+ n.availableOffline = e.input.availableOffline;
3706
+ },
3707
+ addListenerOperation(n, e, t) {
3708
+ if (n.listeners.find(
3709
+ (r) => r.listenerId === e.input.listener.listenerId
3710
+ ))
3711
+ throw new Error(
3712
+ `A listener with Id: ${e.input.listener.listenerId} already exists`
3713
+ );
3714
+ n.listeners.push(e.input.listener);
3715
+ },
3716
+ removeListenerOperation(n, e, t) {
3717
+ n.listeners = n.listeners.filter(
3718
+ (r) => r.listenerId !== e.input.listenerId
3719
+ );
3720
+ },
3721
+ addTriggerOperation(n, e, t) {
3722
+ if (n.triggers.find((r) => r.id === e.input.trigger.id))
3723
+ throw new Error(
3724
+ `A trigger with Id: ${e.input.trigger.id} already exists`
3725
+ );
3726
+ n.triggers.push(e.input.trigger);
3727
+ },
3728
+ removeTriggerOperation(n, e, t) {
3729
+ n.triggers = n.triggers.filter(
3730
+ (r) => r.id !== e.input.triggerId
3731
+ );
3732
+ }
3733
+ }, fr = (n, e, t) => {
3734
+ if (O.isBaseAction(e))
3735
+ return n;
3736
+ switch (e.type) {
3737
+ case "ADD_FILE":
3738
+ Ue().parse(e.input), V.addFileOperation(n[e.scope], e, t);
3739
+ break;
3740
+ case "ADD_FOLDER":
3741
+ Ve().parse(e.input), V.addFolderOperation(n[e.scope], e, t);
3742
+ break;
3743
+ case "DELETE_NODE":
3744
+ qe().parse(e.input), V.deleteNodeOperation(n[e.scope], e, t);
3745
+ break;
3746
+ case "UPDATE_FILE":
3747
+ rt().parse(e.input), V.updateFileOperation(n[e.scope], e, t);
3748
+ break;
3749
+ case "UPDATE_NODE":
3750
+ st().parse(e.input), V.updateNodeOperation(n[e.scope], e, t);
3751
+ break;
3752
+ case "COPY_NODE":
3753
+ He().parse(e.input), V.copyNodeOperation(n[e.scope], e, t);
3754
+ break;
3755
+ case "MOVE_NODE":
3756
+ Ye().parse(e.input), V.moveNodeOperation(n[e.scope], e, t);
3757
+ break;
3758
+ case "SET_DRIVE_NAME":
3759
+ et().parse(e.input), j.setDriveNameOperation(n[e.scope], e, t);
3760
+ break;
3761
+ case "SET_DRIVE_ICON":
3762
+ Xe().parse(e.input), j.setDriveIconOperation(n[e.scope], e, t);
3763
+ break;
3764
+ case "SET_SHARING_TYPE":
3765
+ tt().parse(e.input), j.setSharingTypeOperation(
3766
+ n[e.scope],
3767
+ e,
3768
+ t
3769
+ );
3770
+ break;
3771
+ case "SET_AVAILABLE_OFFLINE":
3772
+ Qe().parse(e.input), j.setAvailableOfflineOperation(
3773
+ n[e.scope],
3774
+ e,
3775
+ t
3776
+ );
3777
+ break;
3778
+ case "ADD_LISTENER":
3779
+ Be().parse(e.input), j.addListenerOperation(n[e.scope], e, t);
3780
+ break;
3781
+ case "REMOVE_LISTENER":
3782
+ Je().parse(e.input), j.removeListenerOperation(
3783
+ n[e.scope],
3784
+ e,
3785
+ t
3786
+ );
3787
+ break;
3788
+ case "ADD_TRIGGER":
3789
+ Ge().parse(e.input), j.addTriggerOperation(n[e.scope], e, t);
3790
+ break;
3791
+ case "REMOVE_TRIGGER":
3792
+ Ke().parse(e.input), j.removeTriggerOperation(
3793
+ n[e.scope],
3794
+ e,
3795
+ t
3796
+ );
3797
+ break;
3798
+ default:
3799
+ return n;
3800
+ }
3801
+ }, Ne = O.createReducer(fr), pr = {
3802
+ id: "",
3803
+ name: "",
3804
+ nodes: [],
3805
+ icon: null,
3806
+ slug: null
3807
+ }, hr = {
3808
+ listeners: [],
3809
+ triggers: [],
3810
+ sharingType: "private",
3811
+ availableOffline: !1
3812
+ }, se = {
3813
+ fileExtension: "phdd",
3814
+ createState(n) {
3815
+ return {
3816
+ global: { ...pr, ...n == null ? void 0 : n.global },
3817
+ local: { ...hr, ...n == null ? void 0 : n.local }
3818
+ };
3819
+ },
3820
+ createExtendedState(n) {
3821
+ return O.createExtendedState(
3822
+ { ...n, documentType: "powerhouse/document-drive" },
3823
+ se.createState
3824
+ );
3825
+ },
3826
+ createDocument(n) {
3827
+ return O.createDocument(
3828
+ se.createExtendedState(n),
3829
+ se.createState
3830
+ );
3831
+ },
3832
+ saveToFile(n, e, t) {
3833
+ return O.saveToFile(n, e, "phdd", t);
3834
+ },
3835
+ saveToFileHandle(n, e) {
3836
+ return O.saveToFileHandle(n, e);
3837
+ },
3838
+ loadFromFile(n) {
3839
+ return O.loadFromFile(n, Ne);
3840
+ },
3841
+ loadFromInput(n) {
3842
+ return O.loadFromInput(n, Ne);
3843
+ }
3844
+ }, { createAction: Y } = O, at = (n) => Y(
3845
+ "ADD_FILE",
3846
+ { ...n },
3847
+ void 0,
3848
+ Ue,
3849
+ "global"
3850
+ ), At = (n) => Y(
3851
+ "ADD_FOLDER",
3852
+ { ...n },
3853
+ void 0,
3854
+ Ve,
3855
+ "global"
3856
+ ), Ct = (n) => Y(
3857
+ "DELETE_NODE",
3858
+ { ...n },
3859
+ void 0,
3860
+ qe,
3861
+ "global"
3862
+ ), Dt = (n) => Y(
3863
+ "UPDATE_FILE",
3864
+ { ...n },
3865
+ void 0,
3866
+ rt,
3867
+ "global"
3868
+ ), Rt = (n) => Y(
3869
+ "UPDATE_NODE",
3870
+ { ...n },
3871
+ void 0,
3872
+ st,
3873
+ "global"
3874
+ ), it = (n) => Y(
3875
+ "COPY_NODE",
3876
+ { ...n },
3877
+ void 0,
3878
+ He,
3879
+ "global"
3880
+ ), Zt = (n) => Y(
3881
+ "MOVE_NODE",
3882
+ { ...n },
3883
+ void 0,
3884
+ Ye,
3885
+ "global"
3886
+ );
3887
+ class mr extends Me {
3888
+ addFile(e) {
3889
+ return this.dispatch(at(e));
3890
+ }
3891
+ addFolder(e) {
3892
+ return this.dispatch(At(e));
3893
+ }
3894
+ deleteNode(e) {
3895
+ return this.dispatch(Ct(e));
3896
+ }
3897
+ updateFile(e) {
3898
+ return this.dispatch(Dt(e));
3899
+ }
3900
+ updateNode(e) {
3901
+ return this.dispatch(Rt(e));
3902
+ }
3903
+ copyNode(e) {
3904
+ return this.dispatch(it(e));
3905
+ }
3906
+ moveNode(e) {
3907
+ return this.dispatch(Zt(e));
3908
+ }
3909
+ }
3910
+ const { createAction: U } = O, Ft = (n) => U(
3911
+ "SET_DRIVE_NAME",
3912
+ { ...n },
3913
+ void 0,
3914
+ et,
3915
+ "global"
3916
+ ), jt = (n) => U(
3917
+ "SET_DRIVE_ICON",
3918
+ { ...n },
3919
+ void 0,
3920
+ Xe,
3921
+ "global"
3922
+ ), Pt = (n) => U(
3923
+ "SET_SHARING_TYPE",
3924
+ { ...n },
3925
+ void 0,
3926
+ tt,
3927
+ "local"
3928
+ ), zt = (n) => U(
3929
+ "SET_AVAILABLE_OFFLINE",
3930
+ { ...n },
3931
+ void 0,
3932
+ Qe,
3933
+ "local"
3934
+ ), Lt = (n) => U(
3935
+ "ADD_LISTENER",
3936
+ { ...n },
3937
+ void 0,
3938
+ Be,
3939
+ "local"
3940
+ ), Mt = (n) => U(
3941
+ "REMOVE_LISTENER",
3942
+ { ...n },
3943
+ void 0,
3944
+ Je,
3945
+ "local"
3946
+ ), $t = (n) => U(
3947
+ "ADD_TRIGGER",
3948
+ { ...n },
3949
+ void 0,
3950
+ Ge,
3951
+ "local"
3952
+ ), Ut = (n) => U(
3953
+ "REMOVE_TRIGGER",
3954
+ { ...n },
3955
+ void 0,
3956
+ Ke,
3957
+ "local"
3958
+ );
3959
+ class gr extends Me {
3960
+ setDriveName(e) {
3961
+ return this.dispatch(Ft(e));
3962
+ }
3963
+ setDriveIcon(e) {
3964
+ return this.dispatch(jt(e));
3965
+ }
3966
+ setSharingType(e) {
3967
+ return this.dispatch(Pt(e));
3968
+ }
3969
+ setAvailableOffline(e) {
3970
+ return this.dispatch(zt(e));
3971
+ }
3972
+ addListener(e) {
3973
+ return this.dispatch(Lt(e));
3974
+ }
3975
+ removeListener(e) {
3976
+ return this.dispatch(Mt(e));
3977
+ }
3978
+ addTrigger(e) {
3979
+ return this.dispatch($t(e));
3980
+ }
3981
+ removeTrigger(e) {
3982
+ return this.dispatch(Ut(e));
3983
+ }
3984
+ }
3985
+ const Ae = class Ae extends Me {
3986
+ constructor(e, t) {
3987
+ super(Ne, se.createDocument(e), t);
3988
+ }
3989
+ saveToFile(e, t) {
3990
+ return super.saveToFile(e, Ae.fileExtension, t);
3991
+ }
3992
+ loadFromFile(e) {
3993
+ return super.loadFromFile(e);
3994
+ }
3995
+ static async fromFile(e) {
3996
+ const t = new this();
3997
+ return await t.loadFromFile(e), t;
3998
+ }
3999
+ };
4000
+ ot(Ae, "fileExtension", "phdd");
4001
+ let Oe = Ae;
4002
+ Jt(Oe, [mr, gr]);
4003
+ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4004
+ __proto__: null,
4005
+ addFile: at,
4006
+ addFolder: At,
4007
+ addListener: Lt,
4008
+ addTrigger: $t,
4009
+ copyNode: it,
4010
+ deleteNode: Ct,
4011
+ moveNode: Zt,
4012
+ removeListener: Mt,
4013
+ removeTrigger: Ut,
4014
+ setAvailableOffline: zt,
4015
+ setDriveIcon: jt,
4016
+ setDriveName: Ft,
4017
+ setSharingType: Pt,
4018
+ updateFile: Dt,
4019
+ updateNode: Rt
4020
+ }, Symbol.toStringTag, { value: "Module" }));
4021
+ function P(n) {
4022
+ return n.kind === "file";
4023
+ }
4024
+ function Vt(n) {
4025
+ return n.kind === "folder";
4026
+ }
4027
+ function Bt(n, e) {
4028
+ if (n.parentFolder) {
4029
+ const t = e.find((r) => r.id === n.parentFolder);
4030
+ if (!t)
4031
+ throw new Error(`Parent node with id ${n.parentFolder} not found`);
4032
+ return [t, ...Bt(t, e)];
4033
+ } else
4034
+ return [];
4035
+ }
4036
+ function _e(n, e) {
4037
+ const t = e.filter((s) => s.parentFolder === n.id), r = t.map((s) => _e(s, e));
4038
+ return [...t, ...r.flat()];
4039
+ }
4040
+ function _r(n, e, t) {
4041
+ const r = t.find((u) => u.id === n.srcId);
4042
+ if (!r)
4043
+ throw new Error(`Node with id ${n.srcId} not found`);
4044
+ const s = [
4045
+ {
4046
+ ...r,
4047
+ name: n.targetName || r.name,
4048
+ parentFolder: n.targetParentFolder || null
4049
+ },
4050
+ ..._e(r, t)
4051
+ ], a = {};
4052
+ n.targetParentFolder && (a[n.targetParentFolder] = n.targetParentFolder);
4053
+ const i = (u) => {
4054
+ let l = a[u];
4055
+ if (!l) {
4056
+ const m = u;
4057
+ l = e(u), a[m] = l;
4058
+ }
4059
+ return l;
4060
+ };
4061
+ return s.map((u) => ({
4062
+ srcId: u.id,
4063
+ targetId: i(u.id),
4064
+ targetName: u.name,
4065
+ targetParentFolder: u.parentFolder ? i(u.parentFolder) : null,
4066
+ synchronizationUnits: P(u) ? u.synchronizationUnits.map((l) => ({
4067
+ ...l,
4068
+ syncId: Re(t)
4069
+ })) : void 0
4070
+ }));
4071
+ }
4072
+ function Re(n) {
4073
+ let e = "";
4074
+ for (; !e || n.find(
4075
+ (t) => P(t) && t.synchronizationUnits.find((r) => r.syncId === e)
4076
+ ); )
4077
+ e = Qt();
4078
+ return e;
4079
+ }
4080
+ function Gt(n, e, t = "main") {
4081
+ return e.map((r) => ({
4082
+ scope: r,
4083
+ branch: t,
4084
+ syncId: Re(n.nodes)
4085
+ }));
4086
+ }
4087
+ function vr(n, e, t) {
4088
+ return at({
4089
+ ...e,
4090
+ synchronizationUnits: Gt(n, t)
4091
+ });
4092
+ }
4093
+ function br(n, e) {
4094
+ const t = n.nodes.find((s) => s.id === e.srcId);
4095
+ if (!t)
4096
+ throw new Error(`Node with id ${e.srcId} not found`);
4097
+ let r;
4098
+ return P(t) && (r = t.synchronizationUnits.map(
4099
+ (s) => ({
4100
+ ...s,
4101
+ syncId: Re(n.nodes)
4102
+ })
4103
+ )), it({
4104
+ ...e,
4105
+ synchronizationUnits: r
4106
+ });
4107
+ }
4108
+ function Ht(n, e) {
4109
+ let t = 0;
4110
+ const r = new RegExp(
4111
+ `^${qt(e)} \\(copy\\)(?: (\\d+))?$`
4112
+ );
4113
+ for (const s of n) {
4114
+ const a = s.match(r);
4115
+ if (a) {
4116
+ const i = a[1] ? parseInt(a[1], 10) : 1;
4117
+ i > t && (t = i);
4118
+ }
4119
+ }
4120
+ return t + 1;
4121
+ }
4122
+ function qt(n) {
4123
+ return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4124
+ }
4125
+ function B(n) {
4126
+ const { nodes: e, targetParentFolder: t, srcName: r } = n, s = e.filter(
4127
+ (o) => t === "" ? o.parentFolder === null : o.parentFolder === t
4128
+ ).map((o) => o.name);
4129
+ return s.includes(r) ? `${r} (copy) ${Ht(s, r)}` : r;
4130
+ }
4131
+ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4132
+ __proto__: null,
4133
+ escapeRegExp: qt,
4134
+ generateAddNodeAction: vr,
4135
+ generateCopyNodeAction: br,
4136
+ generateNodesCopy: _r,
4137
+ generateSynchronizationUnitId: Re,
4138
+ generateSynchronizationUnits: Gt,
4139
+ getAncestors: Bt,
4140
+ getDescendants: _e,
4141
+ getNextCopyNumber: Ht,
4142
+ handleTargetNameCollisions: B,
4143
+ isFileNode: P,
4144
+ isFolderNode: Vt
4145
+ }, Symbol.toStringTag, { value: "Module" })), kr = Oe, Tr = { ...se, ...xr }, wr = { ...Kt, ...yr }, Or = {
4146
+ Document: kr,
4147
+ reducer: Ne,
4148
+ actions: wr,
4149
+ utils: Tr,
4150
+ documentModel: Xt
4151
+ };
4152
+ export {
4153
+ kr as Document,
4154
+ Oe as DocumentDrive,
4155
+ wr as actions,
4156
+ Xt as documentModel,
4157
+ qt as escapeRegExp,
4158
+ vr as generateAddNodeAction,
4159
+ br as generateCopyNodeAction,
4160
+ _r as generateNodesCopy,
4161
+ Re as generateSynchronizationUnitId,
4162
+ Gt as generateSynchronizationUnits,
4163
+ Bt as getAncestors,
4164
+ _e as getDescendants,
4165
+ Ht as getNextCopyNumber,
4166
+ B as handleTargetNameCollisions,
4167
+ P as isFileNode,
4168
+ Vt as isFolderNode,
4169
+ Or as module,
4170
+ Ne as reducer,
4171
+ Tr as utils,
4172
+ Nr as z
4173
+ };