document-model 1.0.54 → 1.1.0-debug.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/browser/cjs/_virtual/_commonjsHelpers.js +7 -0
  3. package/dist/browser/cjs/_virtual/_commonjsHelpers.js.map +1 -0
  4. package/dist/browser/cjs/_virtual/browser.js +35 -0
  5. package/dist/browser/cjs/_virtual/browser.js.map +1 -0
  6. package/dist/browser/cjs/_virtual/index.js +5 -0
  7. package/dist/browser/cjs/_virtual/index.js.map +1 -0
  8. package/dist/browser/cjs/_virtual/index2.js +5 -0
  9. package/dist/browser/cjs/_virtual/index2.js.map +1 -0
  10. package/dist/browser/cjs/_virtual/index3.js +5 -0
  11. package/dist/browser/cjs/_virtual/index3.js.map +1 -0
  12. package/dist/browser/cjs/_virtual/index4.js +5 -0
  13. package/dist/browser/cjs/_virtual/index4.js.map +1 -0
  14. package/dist/browser/cjs/_virtual/index5.js +5 -0
  15. package/dist/browser/cjs/_virtual/index5.js.map +1 -0
  16. package/dist/browser/cjs/_virtual/inherits_browser.js +5 -0
  17. package/dist/browser/cjs/_virtual/inherits_browser.js.map +1 -0
  18. package/dist/browser/cjs/document-model.js +41 -1
  19. package/dist/browser/cjs/document-model.js.map +1 -0
  20. package/dist/browser/cjs/document.js +15 -1
  21. package/dist/browser/cjs/document.js.map +1 -0
  22. package/dist/browser/cjs/index.js +14 -1
  23. package/dist/browser/cjs/index.js.map +1 -0
  24. package/dist/browser/cjs/src/document/actions/creators.js +46 -0
  25. package/dist/browser/cjs/src/document/actions/creators.js.map +1 -0
  26. package/dist/browser/cjs/src/document/actions/index.js +173 -0
  27. package/dist/browser/cjs/src/document/actions/index.js.map +1 -0
  28. package/dist/browser/cjs/src/document/actions/types.js +15 -0
  29. package/dist/browser/cjs/src/document/actions/types.js.map +1 -0
  30. package/dist/browser/cjs/src/document/object.js +190 -0
  31. package/dist/browser/cjs/src/document/object.js.map +1 -0
  32. package/dist/browser/cjs/src/document/reducer.js +192 -0
  33. package/dist/browser/cjs/src/document/reducer.js.map +1 -0
  34. package/dist/browser/cjs/src/document/schema/zod.js +137 -0
  35. package/dist/browser/cjs/src/document/schema/zod.js.map +1 -0
  36. package/dist/browser/cjs/src/document/utils/base.js +220 -0
  37. package/dist/browser/cjs/src/document/utils/base.js.map +1 -0
  38. package/dist/browser/cjs/src/document/utils/document-helpers.js +324 -0
  39. package/dist/browser/cjs/src/document/utils/document-helpers.js.map +1 -0
  40. package/dist/browser/cjs/src/document/utils/file.js +135 -0
  41. package/dist/browser/cjs/src/document/utils/file.js.map +1 -0
  42. package/dist/browser/cjs/src/document/utils/index.js +33 -0
  43. package/dist/browser/cjs/src/document/utils/index.js.map +1 -0
  44. package/dist/browser/cjs/src/document/utils/validation.js +24 -0
  45. package/dist/browser/cjs/src/document/utils/validation.js.map +1 -0
  46. package/dist/browser/cjs/src/document-model/custom/reducers/header.js +26 -0
  47. package/dist/browser/cjs/src/document-model/custom/reducers/header.js.map +1 -0
  48. package/dist/browser/cjs/src/document-model/custom/reducers/module.js +46 -0
  49. package/dist/browser/cjs/src/document-model/custom/reducers/module.js.map +1 -0
  50. package/dist/browser/cjs/src/document-model/custom/reducers/operation-error.js +95 -0
  51. package/dist/browser/cjs/src/document-model/custom/reducers/operation-error.js.map +1 -0
  52. package/dist/browser/cjs/src/document-model/custom/reducers/operation-example.js +58 -0
  53. package/dist/browser/cjs/src/document-model/custom/reducers/operation-example.js.map +1 -0
  54. package/dist/browser/cjs/src/document-model/custom/reducers/operation.js +123 -0
  55. package/dist/browser/cjs/src/document-model/custom/reducers/operation.js.map +1 -0
  56. package/dist/browser/cjs/src/document-model/custom/reducers/state.js +66 -0
  57. package/dist/browser/cjs/src/document-model/custom/reducers/state.js.map +1 -0
  58. package/dist/browser/cjs/src/document-model/custom/reducers/versioning.js +31 -0
  59. package/dist/browser/cjs/src/document-model/custom/reducers/versioning.js.map +1 -0
  60. package/dist/browser/cjs/src/document-model/custom/utils.js +117 -0
  61. package/dist/browser/cjs/src/document-model/custom/utils.js.map +1 -0
  62. package/dist/browser/cjs/src/document-model/gen/creators.js +53 -0
  63. package/dist/browser/cjs/src/document-model/gen/creators.js.map +1 -0
  64. package/dist/browser/cjs/src/document-model/gen/document-model.js +545 -0
  65. package/dist/browser/cjs/src/document-model/gen/document-model.js.map +1 -0
  66. package/dist/browser/cjs/src/document-model/gen/header/creators.js +39 -0
  67. package/dist/browser/cjs/src/document-model/gen/header/creators.js.map +1 -0
  68. package/dist/browser/cjs/src/document-model/gen/header/object.js +26 -0
  69. package/dist/browser/cjs/src/document-model/gen/header/object.js.map +1 -0
  70. package/dist/browser/cjs/src/document-model/gen/module/creators.js +34 -0
  71. package/dist/browser/cjs/src/document-model/gen/module/creators.js.map +1 -0
  72. package/dist/browser/cjs/src/document-model/gen/module/object.js +23 -0
  73. package/dist/browser/cjs/src/document-model/gen/module/object.js.map +1 -0
  74. package/dist/browser/cjs/src/document-model/gen/object.js +47 -0
  75. package/dist/browser/cjs/src/document-model/gen/object.js.map +1 -0
  76. package/dist/browser/cjs/src/document-model/gen/operation/creators.js +59 -0
  77. package/dist/browser/cjs/src/document-model/gen/operation/creators.js.map +1 -0
  78. package/dist/browser/cjs/src/document-model/gen/operation/object.js +38 -0
  79. package/dist/browser/cjs/src/document-model/gen/operation/object.js.map +1 -0
  80. package/dist/browser/cjs/src/document-model/gen/operation-error/creators.js +44 -0
  81. package/dist/browser/cjs/src/document-model/gen/operation-error/creators.js.map +1 -0
  82. package/dist/browser/cjs/src/document-model/gen/operation-error/object.js +29 -0
  83. package/dist/browser/cjs/src/document-model/gen/operation-error/object.js.map +1 -0
  84. package/dist/browser/cjs/src/document-model/gen/operation-example/creators.js +29 -0
  85. package/dist/browser/cjs/src/document-model/gen/operation-example/creators.js.map +1 -0
  86. package/dist/browser/cjs/src/document-model/gen/operation-example/object.js +20 -0
  87. package/dist/browser/cjs/src/document-model/gen/operation-example/object.js.map +1 -0
  88. package/dist/browser/cjs/src/document-model/gen/reducer.js +255 -0
  89. package/dist/browser/cjs/src/document-model/gen/reducer.js.map +1 -0
  90. package/dist/browser/cjs/src/document-model/gen/schema/zod.js +449 -0
  91. package/dist/browser/cjs/src/document-model/gen/schema/zod.js.map +1 -0
  92. package/dist/browser/cjs/src/document-model/gen/state/creators.js +39 -0
  93. package/dist/browser/cjs/src/document-model/gen/state/creators.js.map +1 -0
  94. package/dist/browser/cjs/src/document-model/gen/state/object.js +26 -0
  95. package/dist/browser/cjs/src/document-model/gen/state/object.js.map +1 -0
  96. package/dist/browser/cjs/src/document-model/gen/utils.js +75 -0
  97. package/dist/browser/cjs/src/document-model/gen/utils.js.map +1 -0
  98. package/dist/browser/cjs/src/document-model/gen/versioning/creators.js +33 -0
  99. package/dist/browser/cjs/src/document-model/gen/versioning/creators.js.map +1 -0
  100. package/dist/browser/cjs/src/document-model/gen/versioning/object.js +23 -0
  101. package/dist/browser/cjs/src/document-model/gen/versioning/object.js.map +1 -0
  102. package/dist/browser/es/_virtual/_commonjsHelpers.js +7 -0
  103. package/dist/browser/es/_virtual/_commonjsHelpers.js.map +1 -0
  104. package/dist/browser/es/_virtual/browser.js +35 -0
  105. package/dist/browser/es/_virtual/browser.js.map +1 -0
  106. package/dist/browser/es/_virtual/index.js +5 -0
  107. package/dist/browser/es/_virtual/index.js.map +1 -0
  108. package/dist/browser/es/_virtual/index2.js +5 -0
  109. package/dist/browser/es/_virtual/index2.js.map +1 -0
  110. package/dist/browser/es/_virtual/index3.js +5 -0
  111. package/dist/browser/es/_virtual/index3.js.map +1 -0
  112. package/dist/browser/es/_virtual/index4.js +5 -0
  113. package/dist/browser/es/_virtual/index4.js.map +1 -0
  114. package/dist/browser/es/_virtual/index5.js +5 -0
  115. package/dist/browser/es/_virtual/index5.js.map +1 -0
  116. package/dist/browser/es/_virtual/inherits_browser.js +5 -0
  117. package/dist/browser/es/_virtual/inherits_browser.js.map +1 -0
  118. package/dist/browser/es/document-model.js +38 -16
  119. package/dist/browser/es/document-model.js.map +1 -0
  120. package/dist/browser/es/document.js +13 -12
  121. package/dist/browser/es/document.js.map +1 -0
  122. package/dist/browser/es/index.js +12 -14
  123. package/dist/browser/es/index.js.map +1 -0
  124. package/dist/browser/es/src/document/actions/creators.js +46 -0
  125. package/dist/browser/es/src/document/actions/creators.js.map +1 -0
  126. package/dist/browser/es/src/document/actions/index.js +174 -0
  127. package/dist/browser/es/src/document/actions/index.js.map +1 -0
  128. package/dist/browser/es/src/document/actions/types.js +15 -0
  129. package/dist/browser/es/src/document/actions/types.js.map +1 -0
  130. package/dist/browser/es/src/document/object.js +190 -0
  131. package/dist/browser/es/src/document/object.js.map +1 -0
  132. package/dist/browser/es/src/document/reducer.js +192 -0
  133. package/dist/browser/es/src/document/reducer.js.map +1 -0
  134. package/dist/browser/es/src/document/schema/zod.js +137 -0
  135. package/dist/browser/es/src/document/schema/zod.js.map +1 -0
  136. package/dist/browser/es/src/document/utils/base.js +220 -0
  137. package/dist/browser/es/src/document/utils/base.js.map +1 -0
  138. package/dist/browser/es/src/document/utils/document-helpers.js +324 -0
  139. package/dist/browser/es/src/document/utils/document-helpers.js.map +1 -0
  140. package/dist/browser/es/src/document/utils/file.js +135 -0
  141. package/dist/browser/es/src/document/utils/file.js.map +1 -0
  142. package/dist/browser/es/src/document/utils/index.js +33 -0
  143. package/dist/browser/es/src/document/utils/index.js.map +1 -0
  144. package/dist/browser/es/src/document/utils/validation.js +24 -0
  145. package/dist/browser/es/src/document/utils/validation.js.map +1 -0
  146. package/dist/browser/es/src/document-model/custom/reducers/header.js +26 -0
  147. package/dist/browser/es/src/document-model/custom/reducers/header.js.map +1 -0
  148. package/dist/browser/es/src/document-model/custom/reducers/module.js +46 -0
  149. package/dist/browser/es/src/document-model/custom/reducers/module.js.map +1 -0
  150. package/dist/browser/es/src/document-model/custom/reducers/operation-error.js +95 -0
  151. package/dist/browser/es/src/document-model/custom/reducers/operation-error.js.map +1 -0
  152. package/dist/browser/es/src/document-model/custom/reducers/operation-example.js +58 -0
  153. package/dist/browser/es/src/document-model/custom/reducers/operation-example.js.map +1 -0
  154. package/dist/browser/es/src/document-model/custom/reducers/operation.js +123 -0
  155. package/dist/browser/es/src/document-model/custom/reducers/operation.js.map +1 -0
  156. package/dist/browser/es/src/document-model/custom/reducers/state.js +66 -0
  157. package/dist/browser/es/src/document-model/custom/reducers/state.js.map +1 -0
  158. package/dist/browser/es/src/document-model/custom/reducers/versioning.js +31 -0
  159. package/dist/browser/es/src/document-model/custom/reducers/versioning.js.map +1 -0
  160. package/dist/browser/es/src/document-model/custom/utils.js +117 -0
  161. package/dist/browser/es/src/document-model/custom/utils.js.map +1 -0
  162. package/dist/browser/es/src/document-model/gen/creators.js +53 -0
  163. package/dist/browser/es/src/document-model/gen/creators.js.map +1 -0
  164. package/dist/browser/es/src/document-model/gen/document-model.js +545 -0
  165. package/dist/browser/es/src/document-model/gen/document-model.js.map +1 -0
  166. package/dist/browser/es/src/document-model/gen/header/creators.js +39 -0
  167. package/dist/browser/es/src/document-model/gen/header/creators.js.map +1 -0
  168. package/dist/browser/es/src/document-model/gen/header/object.js +26 -0
  169. package/dist/browser/es/src/document-model/gen/header/object.js.map +1 -0
  170. package/dist/browser/es/src/document-model/gen/module/creators.js +34 -0
  171. package/dist/browser/es/src/document-model/gen/module/creators.js.map +1 -0
  172. package/dist/browser/es/src/document-model/gen/module/object.js +23 -0
  173. package/dist/browser/es/src/document-model/gen/module/object.js.map +1 -0
  174. package/dist/browser/es/src/document-model/gen/object.js +47 -0
  175. package/dist/browser/es/src/document-model/gen/object.js.map +1 -0
  176. package/dist/browser/es/src/document-model/gen/operation/creators.js +59 -0
  177. package/dist/browser/es/src/document-model/gen/operation/creators.js.map +1 -0
  178. package/dist/browser/es/src/document-model/gen/operation/object.js +38 -0
  179. package/dist/browser/es/src/document-model/gen/operation/object.js.map +1 -0
  180. package/dist/browser/es/src/document-model/gen/operation-error/creators.js +44 -0
  181. package/dist/browser/es/src/document-model/gen/operation-error/creators.js.map +1 -0
  182. package/dist/browser/es/src/document-model/gen/operation-error/object.js +29 -0
  183. package/dist/browser/es/src/document-model/gen/operation-error/object.js.map +1 -0
  184. package/dist/browser/es/src/document-model/gen/operation-example/creators.js +29 -0
  185. package/dist/browser/es/src/document-model/gen/operation-example/creators.js.map +1 -0
  186. package/dist/browser/es/src/document-model/gen/operation-example/object.js +20 -0
  187. package/dist/browser/es/src/document-model/gen/operation-example/object.js.map +1 -0
  188. package/dist/browser/es/src/document-model/gen/reducer.js +255 -0
  189. package/dist/browser/es/src/document-model/gen/reducer.js.map +1 -0
  190. package/dist/browser/es/src/document-model/gen/schema/zod.js +449 -0
  191. package/dist/browser/es/src/document-model/gen/schema/zod.js.map +1 -0
  192. package/dist/browser/es/src/document-model/gen/state/creators.js +39 -0
  193. package/dist/browser/es/src/document-model/gen/state/creators.js.map +1 -0
  194. package/dist/browser/es/src/document-model/gen/state/object.js +26 -0
  195. package/dist/browser/es/src/document-model/gen/state/object.js.map +1 -0
  196. package/dist/browser/es/src/document-model/gen/utils.js +75 -0
  197. package/dist/browser/es/src/document-model/gen/utils.js.map +1 -0
  198. package/dist/browser/es/src/document-model/gen/versioning/creators.js +33 -0
  199. package/dist/browser/es/src/document-model/gen/versioning/creators.js.map +1 -0
  200. package/dist/browser/es/src/document-model/gen/versioning/object.js +23 -0
  201. package/dist/browser/es/src/document-model/gen/versioning/object.js.map +1 -0
  202. package/dist/browser/src/document/reducer.d.ts +13 -2
  203. package/dist/browser/src/document/utils/base.d.ts +1 -1
  204. package/dist/browser/src/document/utils/document-helpers.d.ts +53 -0
  205. package/dist/browser/src/document/utils/index.d.ts +1 -0
  206. package/dist/node/cjs/_virtual/_commonjsHelpers.js +7 -0
  207. package/dist/node/cjs/_virtual/_commonjsHelpers.js.map +1 -0
  208. package/dist/node/cjs/_virtual/index.js +5 -0
  209. package/dist/node/cjs/_virtual/index.js.map +1 -0
  210. package/dist/node/cjs/document-model.js +43 -1
  211. package/dist/node/cjs/document-model.js.map +1 -0
  212. package/dist/node/cjs/document.js +15 -1
  213. package/dist/node/cjs/document.js.map +1 -0
  214. package/dist/node/cjs/index.js +14 -1
  215. package/dist/node/cjs/index.js.map +1 -0
  216. package/dist/node/cjs/src/document/actions/creators.js +46 -0
  217. package/dist/node/cjs/src/document/actions/creators.js.map +1 -0
  218. package/dist/node/cjs/src/document/actions/index.js +173 -0
  219. package/dist/node/cjs/src/document/actions/index.js.map +1 -0
  220. package/dist/node/cjs/src/document/actions/types.js +15 -0
  221. package/dist/node/cjs/src/document/actions/types.js.map +1 -0
  222. package/dist/node/cjs/src/document/object.js +190 -0
  223. package/dist/node/cjs/src/document/object.js.map +1 -0
  224. package/dist/node/cjs/src/document/reducer.js +194 -0
  225. package/dist/node/cjs/src/document/reducer.js.map +1 -0
  226. package/dist/node/cjs/src/document/schema/zod.js +137 -0
  227. package/dist/node/cjs/src/document/schema/zod.js.map +1 -0
  228. package/dist/node/cjs/src/document/utils/base.js +220 -0
  229. package/dist/node/cjs/src/document/utils/base.js.map +1 -0
  230. package/dist/node/cjs/src/document/utils/document-helpers.js +324 -0
  231. package/dist/node/cjs/src/document/utils/document-helpers.js.map +1 -0
  232. package/dist/node/cjs/src/document/utils/file.js +136 -0
  233. package/dist/node/cjs/src/document/utils/file.js.map +1 -0
  234. package/dist/node/cjs/src/document/utils/index.js +33 -0
  235. package/dist/node/cjs/src/document/utils/index.js.map +1 -0
  236. package/dist/node/cjs/src/document/utils/node.js +54 -0
  237. package/dist/node/cjs/src/document/utils/node.js.map +1 -0
  238. package/dist/node/cjs/src/document/utils/validation.js +24 -0
  239. package/dist/node/cjs/src/document/utils/validation.js.map +1 -0
  240. package/dist/node/cjs/src/document-model/custom/reducers/header.js +26 -0
  241. package/dist/node/cjs/src/document-model/custom/reducers/header.js.map +1 -0
  242. package/dist/node/cjs/src/document-model/custom/reducers/module.js +46 -0
  243. package/dist/node/cjs/src/document-model/custom/reducers/module.js.map +1 -0
  244. package/dist/node/cjs/src/document-model/custom/reducers/operation-error.js +95 -0
  245. package/dist/node/cjs/src/document-model/custom/reducers/operation-error.js.map +1 -0
  246. package/dist/node/cjs/src/document-model/custom/reducers/operation-example.js +58 -0
  247. package/dist/node/cjs/src/document-model/custom/reducers/operation-example.js.map +1 -0
  248. package/dist/node/cjs/src/document-model/custom/reducers/operation.js +123 -0
  249. package/dist/node/cjs/src/document-model/custom/reducers/operation.js.map +1 -0
  250. package/dist/node/cjs/src/document-model/custom/reducers/state.js +66 -0
  251. package/dist/node/cjs/src/document-model/custom/reducers/state.js.map +1 -0
  252. package/dist/node/cjs/src/document-model/custom/reducers/versioning.js +31 -0
  253. package/dist/node/cjs/src/document-model/custom/reducers/versioning.js.map +1 -0
  254. package/dist/node/cjs/src/document-model/custom/utils.js +117 -0
  255. package/dist/node/cjs/src/document-model/custom/utils.js.map +1 -0
  256. package/dist/node/cjs/src/document-model/gen/creators.js +53 -0
  257. package/dist/node/cjs/src/document-model/gen/creators.js.map +1 -0
  258. package/dist/node/cjs/src/document-model/gen/document-model.js +545 -0
  259. package/dist/node/cjs/src/document-model/gen/document-model.js.map +1 -0
  260. package/dist/node/cjs/src/document-model/gen/header/creators.js +41 -0
  261. package/dist/node/cjs/src/document-model/gen/header/creators.js.map +1 -0
  262. package/dist/node/cjs/src/document-model/gen/header/object.js +26 -0
  263. package/dist/node/cjs/src/document-model/gen/header/object.js.map +1 -0
  264. package/dist/node/cjs/src/document-model/gen/module/creators.js +36 -0
  265. package/dist/node/cjs/src/document-model/gen/module/creators.js.map +1 -0
  266. package/dist/node/cjs/src/document-model/gen/module/object.js +23 -0
  267. package/dist/node/cjs/src/document-model/gen/module/object.js.map +1 -0
  268. package/dist/node/cjs/src/document-model/gen/object.js +47 -0
  269. package/dist/node/cjs/src/document-model/gen/object.js.map +1 -0
  270. package/dist/node/cjs/src/document-model/gen/operation/creators.js +61 -0
  271. package/dist/node/cjs/src/document-model/gen/operation/creators.js.map +1 -0
  272. package/dist/node/cjs/src/document-model/gen/operation/object.js +38 -0
  273. package/dist/node/cjs/src/document-model/gen/operation/object.js.map +1 -0
  274. package/dist/node/cjs/src/document-model/gen/operation-error/creators.js +46 -0
  275. package/dist/node/cjs/src/document-model/gen/operation-error/creators.js.map +1 -0
  276. package/dist/node/cjs/src/document-model/gen/operation-error/object.js +29 -0
  277. package/dist/node/cjs/src/document-model/gen/operation-error/object.js.map +1 -0
  278. package/dist/node/cjs/src/document-model/gen/operation-example/creators.js +31 -0
  279. package/dist/node/cjs/src/document-model/gen/operation-example/creators.js.map +1 -0
  280. package/dist/node/cjs/src/document-model/gen/operation-example/object.js +20 -0
  281. package/dist/node/cjs/src/document-model/gen/operation-example/object.js.map +1 -0
  282. package/dist/node/cjs/src/document-model/gen/reducer.js +257 -0
  283. package/dist/node/cjs/src/document-model/gen/reducer.js.map +1 -0
  284. package/dist/node/cjs/src/document-model/gen/schema/zod.js +449 -0
  285. package/dist/node/cjs/src/document-model/gen/schema/zod.js.map +1 -0
  286. package/dist/node/cjs/src/document-model/gen/state/creators.js +41 -0
  287. package/dist/node/cjs/src/document-model/gen/state/creators.js.map +1 -0
  288. package/dist/node/cjs/src/document-model/gen/state/object.js +26 -0
  289. package/dist/node/cjs/src/document-model/gen/state/object.js.map +1 -0
  290. package/dist/node/cjs/src/document-model/gen/utils.js +75 -0
  291. package/dist/node/cjs/src/document-model/gen/utils.js.map +1 -0
  292. package/dist/node/cjs/src/document-model/gen/versioning/creators.js +35 -0
  293. package/dist/node/cjs/src/document-model/gen/versioning/creators.js.map +1 -0
  294. package/dist/node/cjs/src/document-model/gen/versioning/object.js +23 -0
  295. package/dist/node/cjs/src/document-model/gen/versioning/object.js.map +1 -0
  296. package/dist/node/es/_virtual/_commonjsHelpers.js +7 -0
  297. package/dist/node/es/_virtual/_commonjsHelpers.js.map +1 -0
  298. package/dist/node/es/_virtual/index.js +5 -0
  299. package/dist/node/es/_virtual/index.js.map +1 -0
  300. package/dist/node/es/document-model.js +37 -17
  301. package/dist/node/es/document-model.js.map +1 -0
  302. package/dist/node/es/document.js +13 -16
  303. package/dist/node/es/document.js.map +1 -0
  304. package/dist/node/es/index.js +12 -18
  305. package/dist/node/es/index.js.map +1 -0
  306. package/dist/node/es/src/document/actions/creators.js +46 -0
  307. package/dist/node/es/src/document/actions/creators.js.map +1 -0
  308. package/dist/node/es/src/document/actions/index.js +174 -0
  309. package/dist/node/es/src/document/actions/index.js.map +1 -0
  310. package/dist/node/es/src/document/actions/types.js +15 -0
  311. package/dist/node/es/src/document/actions/types.js.map +1 -0
  312. package/dist/node/es/src/document/object.js +190 -0
  313. package/dist/node/es/src/document/object.js.map +1 -0
  314. package/dist/node/es/src/document/reducer.js +194 -0
  315. package/dist/node/es/src/document/reducer.js.map +1 -0
  316. package/dist/node/es/src/document/schema/zod.js +137 -0
  317. package/dist/node/es/src/document/schema/zod.js.map +1 -0
  318. package/dist/node/es/src/document/utils/base.js +220 -0
  319. package/dist/node/es/src/document/utils/base.js.map +1 -0
  320. package/dist/node/es/src/document/utils/document-helpers.js +324 -0
  321. package/dist/node/es/src/document/utils/document-helpers.js.map +1 -0
  322. package/dist/node/es/src/document/utils/file.js +136 -0
  323. package/dist/node/es/src/document/utils/file.js.map +1 -0
  324. package/dist/node/es/src/document/utils/index.js +33 -0
  325. package/dist/node/es/src/document/utils/index.js.map +1 -0
  326. package/dist/node/es/src/document/utils/node.js +54 -0
  327. package/dist/node/es/src/document/utils/node.js.map +1 -0
  328. package/dist/node/es/src/document/utils/validation.js +24 -0
  329. package/dist/node/es/src/document/utils/validation.js.map +1 -0
  330. package/dist/node/es/src/document-model/custom/reducers/header.js +26 -0
  331. package/dist/node/es/src/document-model/custom/reducers/header.js.map +1 -0
  332. package/dist/node/es/src/document-model/custom/reducers/module.js +46 -0
  333. package/dist/node/es/src/document-model/custom/reducers/module.js.map +1 -0
  334. package/dist/node/es/src/document-model/custom/reducers/operation-error.js +95 -0
  335. package/dist/node/es/src/document-model/custom/reducers/operation-error.js.map +1 -0
  336. package/dist/node/es/src/document-model/custom/reducers/operation-example.js +58 -0
  337. package/dist/node/es/src/document-model/custom/reducers/operation-example.js.map +1 -0
  338. package/dist/node/es/src/document-model/custom/reducers/operation.js +123 -0
  339. package/dist/node/es/src/document-model/custom/reducers/operation.js.map +1 -0
  340. package/dist/node/es/src/document-model/custom/reducers/state.js +66 -0
  341. package/dist/node/es/src/document-model/custom/reducers/state.js.map +1 -0
  342. package/dist/node/es/src/document-model/custom/reducers/versioning.js +31 -0
  343. package/dist/node/es/src/document-model/custom/reducers/versioning.js.map +1 -0
  344. package/dist/node/es/src/document-model/custom/utils.js +117 -0
  345. package/dist/node/es/src/document-model/custom/utils.js.map +1 -0
  346. package/dist/node/es/src/document-model/gen/creators.js +53 -0
  347. package/dist/node/es/src/document-model/gen/creators.js.map +1 -0
  348. package/dist/node/es/src/document-model/gen/document-model.js +545 -0
  349. package/dist/node/es/src/document-model/gen/document-model.js.map +1 -0
  350. package/dist/node/es/src/document-model/gen/header/creators.js +41 -0
  351. package/dist/node/es/src/document-model/gen/header/creators.js.map +1 -0
  352. package/dist/node/es/src/document-model/gen/header/object.js +26 -0
  353. package/dist/node/es/src/document-model/gen/header/object.js.map +1 -0
  354. package/dist/node/es/src/document-model/gen/module/creators.js +36 -0
  355. package/dist/node/es/src/document-model/gen/module/creators.js.map +1 -0
  356. package/dist/node/es/src/document-model/gen/module/object.js +23 -0
  357. package/dist/node/es/src/document-model/gen/module/object.js.map +1 -0
  358. package/dist/node/es/src/document-model/gen/object.js +47 -0
  359. package/dist/node/es/src/document-model/gen/object.js.map +1 -0
  360. package/dist/node/es/src/document-model/gen/operation/creators.js +61 -0
  361. package/dist/node/es/src/document-model/gen/operation/creators.js.map +1 -0
  362. package/dist/node/es/src/document-model/gen/operation/object.js +38 -0
  363. package/dist/node/es/src/document-model/gen/operation/object.js.map +1 -0
  364. package/dist/node/es/src/document-model/gen/operation-error/creators.js +46 -0
  365. package/dist/node/es/src/document-model/gen/operation-error/creators.js.map +1 -0
  366. package/dist/node/es/src/document-model/gen/operation-error/object.js +29 -0
  367. package/dist/node/es/src/document-model/gen/operation-error/object.js.map +1 -0
  368. package/dist/node/es/src/document-model/gen/operation-example/creators.js +31 -0
  369. package/dist/node/es/src/document-model/gen/operation-example/creators.js.map +1 -0
  370. package/dist/node/es/src/document-model/gen/operation-example/object.js +20 -0
  371. package/dist/node/es/src/document-model/gen/operation-example/object.js.map +1 -0
  372. package/dist/node/es/src/document-model/gen/reducer.js +257 -0
  373. package/dist/node/es/src/document-model/gen/reducer.js.map +1 -0
  374. package/dist/node/es/src/document-model/gen/schema/zod.js +449 -0
  375. package/dist/node/es/src/document-model/gen/schema/zod.js.map +1 -0
  376. package/dist/node/es/src/document-model/gen/state/creators.js +41 -0
  377. package/dist/node/es/src/document-model/gen/state/creators.js.map +1 -0
  378. package/dist/node/es/src/document-model/gen/state/object.js +26 -0
  379. package/dist/node/es/src/document-model/gen/state/object.js.map +1 -0
  380. package/dist/node/es/src/document-model/gen/utils.js +75 -0
  381. package/dist/node/es/src/document-model/gen/utils.js.map +1 -0
  382. package/dist/node/es/src/document-model/gen/versioning/creators.js +35 -0
  383. package/dist/node/es/src/document-model/gen/versioning/creators.js.map +1 -0
  384. package/dist/node/es/src/document-model/gen/versioning/object.js +23 -0
  385. package/dist/node/es/src/document-model/gen/versioning/object.js.map +1 -0
  386. package/dist/node/src/document/reducer.d.ts +13 -2
  387. package/dist/node/src/document/utils/base.d.ts +1 -1
  388. package/dist/node/src/document/utils/document-helpers.d.ts +53 -0
  389. package/dist/node/src/document/utils/index.d.ts +1 -0
  390. package/package.json +7 -2
  391. package/dist/browser/cjs/internal/index-BVWyYyNE.js +0 -1
  392. package/dist/browser/cjs/internal/index-CnVGNZ9_.js +0 -22
  393. package/dist/browser/cjs/internal/object-5l5_pTNL.js +0 -25
  394. package/dist/browser/es/internal/index-CF0d1_Cg.js +0 -42
  395. package/dist/browser/es/internal/index-aS_vqu4O.js +0 -2104
  396. package/dist/browser/es/internal/object-BdaEhPk1.js +0 -2507
  397. package/dist/node/cjs/internal/index-B9gc2lPN.js +0 -1
  398. package/dist/node/cjs/internal/index-JtuONOcD.js +0 -22
  399. package/dist/node/cjs/internal/object-D6wRzEDN.js +0 -20
  400. package/dist/node/es/internal/index-BclkoIYP.js +0 -2108
  401. package/dist/node/es/internal/index-EY0PPZnJ.js +0 -42
  402. package/dist/node/es/internal/object-BxC3xMqY.js +0 -1405
@@ -1,2507 +0,0 @@
1
- var De = Object.defineProperty;
2
- var Ce = (r, i, s) => i in r ? De(r, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[i] = s;
3
- var At = (r, i, s) => (Ce(r, typeof i != "symbol" ? i + "" : i, s), s);
4
- import { produce as xt, castDraft as Ut, castImmutable as Ne, freeze as Me } from "immer";
5
- import { z as v } from "zod";
6
- import ee from "jszip";
7
- const re = (r) => r != null, Re = v.any().refine((r) => re(r)), ie = v.enum(["LOAD_STATE"]), ne = v.enum(["PRUNE"]), oe = v.enum(["REDO"]), ae = v.enum(["SET_NAME"]), se = v.enum(["UNDO"]);
8
- function Le() {
9
- return v.object({
10
- __typename: v.literal("Action").optional(),
11
- type: v.string()
12
- });
13
- }
14
- function dt() {
15
- return v.literal("global").or(v.literal("local"));
16
- }
17
- function pe() {
18
- return v.union([
19
- ce(),
20
- ue(),
21
- fe(),
22
- he(),
23
- me()
24
- ]);
25
- }
26
- function ze() {
27
- return v.object({
28
- __typename: v.literal("DocumentFile").optional(),
29
- data: v.string(),
30
- extension: v.string().nullable(),
31
- fileName: v.string().nullable(),
32
- mimeType: v.string()
33
- });
34
- }
35
- function ce() {
36
- return v.object({
37
- input: v.lazy(() => Mt()),
38
- type: ie,
39
- scope: dt()
40
- });
41
- }
42
- function Mt() {
43
- return v.object({
44
- operations: v.number(),
45
- state: v.lazy(() => le())
46
- });
47
- }
48
- function le() {
49
- return v.object({
50
- data: v.unknown().nullish(),
51
- name: v.string()
52
- });
53
- }
54
- function Pe() {
55
- return v.object({
56
- __typename: v.literal("Operation").optional(),
57
- hash: v.string(),
58
- index: v.number(),
59
- timestamp: v.string().datetime(),
60
- type: v.string()
61
- });
62
- }
63
- function ue() {
64
- return v.object({
65
- input: v.lazy(() => Rt()),
66
- type: ne,
67
- scope: dt()
68
- });
69
- }
70
- function Rt() {
71
- return v.object({
72
- end: v.number().nullish(),
73
- start: v.number().nullish()
74
- });
75
- }
76
- const Lt = v.number;
77
- function fe() {
78
- return v.object({
79
- input: Lt(),
80
- type: oe,
81
- scope: dt()
82
- });
83
- }
84
- const zt = v.string;
85
- function he() {
86
- return v.object({
87
- input: zt(),
88
- type: ae,
89
- scope: v.literal("global")
90
- });
91
- }
92
- function qe() {
93
- return v.object({
94
- __typename: v.literal("SetNameOperation").optional(),
95
- hash: v.string(),
96
- index: v.number(),
97
- input: v.string(),
98
- timestamp: v.string().datetime(),
99
- type: v.string()
100
- });
101
- }
102
- const Pt = v.number;
103
- function me() {
104
- return v.object({
105
- input: Pt(),
106
- type: se,
107
- scope: dt()
108
- });
109
- }
110
- const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
111
- __proto__: null,
112
- ActionSchema: Le,
113
- BaseActionSchema: pe,
114
- DocumentFileSchema: ze,
115
- LoadStateActionInputSchema: Mt,
116
- LoadStateActionSchema: ce,
117
- LoadStateActionStateInputSchema: le,
118
- Load_StateSchema: ie,
119
- OperationSchema: Pe,
120
- OperationScopeSchema: dt,
121
- PruneActionInputSchema: Rt,
122
- PruneActionSchema: ue,
123
- PruneSchema: ne,
124
- RedoActionInputSchema: Lt,
125
- RedoActionSchema: fe,
126
- RedoSchema: oe,
127
- SetNameActionInputSchema: zt,
128
- SetNameActionSchema: he,
129
- SetNameOperationSchema: qe,
130
- Set_NameSchema: ae,
131
- UndoActionInputSchema: Pt,
132
- UndoActionSchema: me,
133
- UndoSchema: se,
134
- definedNonNullAnySchema: Re,
135
- isDefinedNonNullAny: re
136
- }, Symbol.toStringTag, { value: "Module" }));
137
- function qt(r) {
138
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
139
- }
140
- var $t = { exports: {} };
141
- (function(r, i) {
142
- const { hasOwnProperty: s } = Object.prototype, p = C();
143
- p.configure = C, p.stringify = p, p.default = p, i.stringify = p, i.configure = C, r.exports = p;
144
- const f = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
145
- function u(y) {
146
- return y.length < 5e3 && !f.test(y) ? `"${y}"` : JSON.stringify(y);
147
- }
148
- function l(y) {
149
- if (y.length > 200)
150
- return y.sort();
151
- for (let b = 1; b < y.length; b++) {
152
- const I = y[b];
153
- let W = b;
154
- for (; W !== 0 && y[W - 1] > I; )
155
- y[W] = y[W - 1], W--;
156
- y[W] = I;
157
- }
158
- return y;
159
- }
160
- const a = Object.getOwnPropertyDescriptor(
161
- Object.getPrototypeOf(
162
- Object.getPrototypeOf(
163
- new Int8Array()
164
- )
165
- ),
166
- Symbol.toStringTag
167
- ).get;
168
- function h(y) {
169
- return a.call(y) !== void 0 && y.length !== 0;
170
- }
171
- function w(y, b, I) {
172
- y.length < I && (I = y.length);
173
- const W = b === "," ? "" : " ";
174
- let Y = `"0":${W}${y[0]}`;
175
- for (let G = 1; G < I; G++)
176
- Y += `${b}"${G}":${W}${y[G]}`;
177
- return Y;
178
- }
179
- function g(y) {
180
- if (s.call(y, "circularValue")) {
181
- const b = y.circularValue;
182
- if (typeof b == "string")
183
- return `"${b}"`;
184
- if (b == null)
185
- return b;
186
- if (b === Error || b === TypeError)
187
- return {
188
- toString() {
189
- throw new TypeError("Converting circular structure to JSON");
190
- }
191
- };
192
- throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
193
- }
194
- return '"[Circular]"';
195
- }
196
- function A(y, b) {
197
- let I;
198
- if (s.call(y, b) && (I = y[b], typeof I != "boolean"))
199
- throw new TypeError(`The "${b}" argument must be of type boolean`);
200
- return I === void 0 ? !0 : I;
201
- }
202
- function _(y, b) {
203
- let I;
204
- if (s.call(y, b)) {
205
- if (I = y[b], typeof I != "number")
206
- throw new TypeError(`The "${b}" argument must be of type number`);
207
- if (!Number.isInteger(I))
208
- throw new TypeError(`The "${b}" argument must be an integer`);
209
- if (I < 1)
210
- throw new RangeError(`The "${b}" argument must be >= 1`);
211
- }
212
- return I === void 0 ? 1 / 0 : I;
213
- }
214
- function F(y) {
215
- return y === 1 ? "1 item" : `${y} items`;
216
- }
217
- function U(y) {
218
- const b = /* @__PURE__ */ new Set();
219
- for (const I of y)
220
- (typeof I == "string" || typeof I == "number") && b.add(String(I));
221
- return b;
222
- }
223
- function L(y) {
224
- if (s.call(y, "strict")) {
225
- const b = y.strict;
226
- if (typeof b != "boolean")
227
- throw new TypeError('The "strict" argument must be of type boolean');
228
- if (b)
229
- return (I) => {
230
- let W = `Object can not safely be stringified. Received type ${typeof I}`;
231
- throw typeof I != "function" && (W += ` (${I.toString()})`), new Error(W);
232
- };
233
- }
234
- }
235
- function C(y) {
236
- y = { ...y };
237
- const b = L(y);
238
- b && (y.bigint === void 0 && (y.bigint = !1), "circularValue" in y || (y.circularValue = Error));
239
- const I = g(y), W = A(y, "bigint"), Y = A(y, "deterministic"), G = _(y, "maximumDepth"), R = _(y, "maximumBreadth");
240
- function ct(V, m, E, T, j, D) {
241
- let S = m[V];
242
- switch (typeof S == "object" && S !== null && typeof S.toJSON == "function" && (S = S.toJSON(V)), S = T.call(m, V, S), typeof S) {
243
- case "string":
244
- return u(S);
245
- case "object": {
246
- if (S === null)
247
- return "null";
248
- if (E.indexOf(S) !== -1)
249
- return I;
250
- let k = "", B = ",";
251
- const O = D;
252
- if (Array.isArray(S)) {
253
- if (S.length === 0)
254
- return "[]";
255
- if (G < E.length + 1)
256
- return '"[Array]"';
257
- E.push(S), j !== "" && (D += j, k += `
258
- ${D}`, B = `,
259
- ${D}`);
260
- const H = Math.min(S.length, R);
261
- let Q = 0;
262
- for (; Q < H - 1; Q++) {
263
- const st = ct(String(Q), S, E, T, j, D);
264
- k += st !== void 0 ? st : "null", k += B;
265
- }
266
- const tt = ct(String(Q), S, E, T, j, D);
267
- if (k += tt !== void 0 ? tt : "null", S.length - 1 > R) {
268
- const st = S.length - R - 1;
269
- k += `${B}"... ${F(st)} not stringified"`;
270
- }
271
- return j !== "" && (k += `
272
- ${O}`), E.pop(), `[${k}]`;
273
- }
274
- let z = Object.keys(S);
275
- const J = z.length;
276
- if (J === 0)
277
- return "{}";
278
- if (G < E.length + 1)
279
- return '"[Object]"';
280
- let N = "", K = "";
281
- j !== "" && (D += j, B = `,
282
- ${D}`, N = " ");
283
- const X = Math.min(J, R);
284
- Y && !h(S) && (z = l(z)), E.push(S);
285
- for (let H = 0; H < X; H++) {
286
- const Q = z[H], tt = ct(Q, S, E, T, j, D);
287
- tt !== void 0 && (k += `${K}${u(Q)}:${N}${tt}`, K = B);
288
- }
289
- if (J > R) {
290
- const H = J - R;
291
- k += `${K}"...":${N}"${F(H)} not stringified"`, K = B;
292
- }
293
- return j !== "" && K.length > 1 && (k = `
294
- ${D}${k}
295
- ${O}`), E.pop(), `{${k}}`;
296
- }
297
- case "number":
298
- return isFinite(S) ? String(S) : b ? b(S) : "null";
299
- case "boolean":
300
- return S === !0 ? "true" : "false";
301
- case "undefined":
302
- return;
303
- case "bigint":
304
- if (W)
305
- return String(S);
306
- default:
307
- return b ? b(S) : void 0;
308
- }
309
- }
310
- function lt(V, m, E, T, j, D) {
311
- switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(V)), typeof m) {
312
- case "string":
313
- return u(m);
314
- case "object": {
315
- if (m === null)
316
- return "null";
317
- if (E.indexOf(m) !== -1)
318
- return I;
319
- const S = D;
320
- let k = "", B = ",";
321
- if (Array.isArray(m)) {
322
- if (m.length === 0)
323
- return "[]";
324
- if (G < E.length + 1)
325
- return '"[Array]"';
326
- E.push(m), j !== "" && (D += j, k += `
327
- ${D}`, B = `,
328
- ${D}`);
329
- const J = Math.min(m.length, R);
330
- let N = 0;
331
- for (; N < J - 1; N++) {
332
- const X = lt(String(N), m[N], E, T, j, D);
333
- k += X !== void 0 ? X : "null", k += B;
334
- }
335
- const K = lt(String(N), m[N], E, T, j, D);
336
- if (k += K !== void 0 ? K : "null", m.length - 1 > R) {
337
- const X = m.length - R - 1;
338
- k += `${B}"... ${F(X)} not stringified"`;
339
- }
340
- return j !== "" && (k += `
341
- ${S}`), E.pop(), `[${k}]`;
342
- }
343
- E.push(m);
344
- let O = "";
345
- j !== "" && (D += j, B = `,
346
- ${D}`, O = " ");
347
- let z = "";
348
- for (const J of T) {
349
- const N = lt(J, m[J], E, T, j, D);
350
- N !== void 0 && (k += `${z}${u(J)}:${O}${N}`, z = B);
351
- }
352
- return j !== "" && z.length > 1 && (k = `
353
- ${D}${k}
354
- ${S}`), E.pop(), `{${k}}`;
355
- }
356
- case "number":
357
- return isFinite(m) ? String(m) : b ? b(m) : "null";
358
- case "boolean":
359
- return m === !0 ? "true" : "false";
360
- case "undefined":
361
- return;
362
- case "bigint":
363
- if (W)
364
- return String(m);
365
- default:
366
- return b ? b(m) : void 0;
367
- }
368
- }
369
- function ot(V, m, E, T, j) {
370
- switch (typeof m) {
371
- case "string":
372
- return u(m);
373
- case "object": {
374
- if (m === null)
375
- return "null";
376
- if (typeof m.toJSON == "function") {
377
- if (m = m.toJSON(V), typeof m != "object")
378
- return ot(V, m, E, T, j);
379
- if (m === null)
380
- return "null";
381
- }
382
- if (E.indexOf(m) !== -1)
383
- return I;
384
- const D = j;
385
- if (Array.isArray(m)) {
386
- if (m.length === 0)
387
- return "[]";
388
- if (G < E.length + 1)
389
- return '"[Array]"';
390
- E.push(m), j += T;
391
- let N = `
392
- ${j}`;
393
- const K = `,
394
- ${j}`, X = Math.min(m.length, R);
395
- let H = 0;
396
- for (; H < X - 1; H++) {
397
- const tt = ot(String(H), m[H], E, T, j);
398
- N += tt !== void 0 ? tt : "null", N += K;
399
- }
400
- const Q = ot(String(H), m[H], E, T, j);
401
- if (N += Q !== void 0 ? Q : "null", m.length - 1 > R) {
402
- const tt = m.length - R - 1;
403
- N += `${K}"... ${F(tt)} not stringified"`;
404
- }
405
- return N += `
406
- ${D}`, E.pop(), `[${N}]`;
407
- }
408
- let S = Object.keys(m);
409
- const k = S.length;
410
- if (k === 0)
411
- return "{}";
412
- if (G < E.length + 1)
413
- return '"[Object]"';
414
- j += T;
415
- const B = `,
416
- ${j}`;
417
- let O = "", z = "", J = Math.min(k, R);
418
- h(m) && (O += w(m, B, R), S = S.slice(m.length), J -= m.length, z = B), Y && (S = l(S)), E.push(m);
419
- for (let N = 0; N < J; N++) {
420
- const K = S[N], X = ot(K, m[K], E, T, j);
421
- X !== void 0 && (O += `${z}${u(K)}: ${X}`, z = B);
422
- }
423
- if (k > R) {
424
- const N = k - R;
425
- O += `${z}"...": "${F(N)} not stringified"`, z = B;
426
- }
427
- return z !== "" && (O = `
428
- ${j}${O}
429
- ${D}`), E.pop(), `{${O}}`;
430
- }
431
- case "number":
432
- return isFinite(m) ? String(m) : b ? b(m) : "null";
433
- case "boolean":
434
- return m === !0 ? "true" : "false";
435
- case "undefined":
436
- return;
437
- case "bigint":
438
- if (W)
439
- return String(m);
440
- default:
441
- return b ? b(m) : void 0;
442
- }
443
- }
444
- function at(V, m, E) {
445
- switch (typeof m) {
446
- case "string":
447
- return u(m);
448
- case "object": {
449
- if (m === null)
450
- return "null";
451
- if (typeof m.toJSON == "function") {
452
- if (m = m.toJSON(V), typeof m != "object")
453
- return at(V, m, E);
454
- if (m === null)
455
- return "null";
456
- }
457
- if (E.indexOf(m) !== -1)
458
- return I;
459
- let T = "";
460
- if (Array.isArray(m)) {
461
- if (m.length === 0)
462
- return "[]";
463
- if (G < E.length + 1)
464
- return '"[Array]"';
465
- E.push(m);
466
- const B = Math.min(m.length, R);
467
- let O = 0;
468
- for (; O < B - 1; O++) {
469
- const J = at(String(O), m[O], E);
470
- T += J !== void 0 ? J : "null", T += ",";
471
- }
472
- const z = at(String(O), m[O], E);
473
- if (T += z !== void 0 ? z : "null", m.length - 1 > R) {
474
- const J = m.length - R - 1;
475
- T += `,"... ${F(J)} not stringified"`;
476
- }
477
- return E.pop(), `[${T}]`;
478
- }
479
- let j = Object.keys(m);
480
- const D = j.length;
481
- if (D === 0)
482
- return "{}";
483
- if (G < E.length + 1)
484
- return '"[Object]"';
485
- let S = "", k = Math.min(D, R);
486
- h(m) && (T += w(m, ",", R), j = j.slice(m.length), k -= m.length, S = ","), Y && (j = l(j)), E.push(m);
487
- for (let B = 0; B < k; B++) {
488
- const O = j[B], z = at(O, m[O], E);
489
- z !== void 0 && (T += `${S}${u(O)}:${z}`, S = ",");
490
- }
491
- if (D > R) {
492
- const B = D - R;
493
- T += `${S}"...":"${F(B)} not stringified"`;
494
- }
495
- return E.pop(), `{${T}}`;
496
- }
497
- case "number":
498
- return isFinite(m) ? String(m) : b ? b(m) : "null";
499
- case "boolean":
500
- return m === !0 ? "true" : "false";
501
- case "undefined":
502
- return;
503
- case "bigint":
504
- if (W)
505
- return String(m);
506
- default:
507
- return b ? b(m) : void 0;
508
- }
509
- }
510
- function It(V, m, E) {
511
- if (arguments.length > 1) {
512
- let T = "";
513
- if (typeof E == "number" ? T = " ".repeat(Math.min(E, 10)) : typeof E == "string" && (T = E.slice(0, 10)), m != null) {
514
- if (typeof m == "function")
515
- return ct("", { "": V }, [], m, T, "");
516
- if (Array.isArray(m))
517
- return lt("", V, [], U(m), T, "");
518
- }
519
- if (T.length !== 0)
520
- return ot("", V, [], T, "");
521
- }
522
- return at("", V, []);
523
- }
524
- return It;
525
- }
526
- })($t, $t.exports);
527
- var Je = $t.exports;
528
- const St = /* @__PURE__ */ qt(Je);
529
- St.configure;
530
- function We(r, i) {
531
- return { ...r, name: i };
532
- }
533
- function Ve(r, i, s) {
534
- const p = {
535
- skip: s,
536
- document: r
537
- }, { scope: f } = i;
538
- return !f || i.skip === void 0 ? p : xt(p, (u) => {
539
- const [l] = u.document.operations[f].slice(-1);
540
- i.skip && i.skip > 0 && (u.skip = i.skip), l.type === "NOOP" && i.index === l.index && u.skip > l.skip && u.document.operations[f].pop();
541
- });
542
- }
543
- function He(r, i, s) {
544
- const { scope: p, input: f } = i;
545
- return xt({
546
- document: r,
547
- action: i,
548
- skip: s
549
- }, (l) => {
550
- if (l.document.operations[p].length < 1)
551
- throw new Error(
552
- `Cannot undo: no operations in history for scope "${p}"`
553
- );
554
- if (f < 1)
555
- throw new Error(
556
- "Invalid UNDO action: input value must be greater than 0"
557
- );
558
- if (l.skip > 0)
559
- throw new Error(
560
- "Cannot undo: skip value from reducer cannot be used with UNDO action"
561
- );
562
- const [a] = l.document.operations[p].slice(-1), h = a.type === "NOOP" && a.skip > 0;
563
- if (l.skip += f, h) {
564
- l.skip += a.skip;
565
- const _ = l.document.operations[p][l.document.operations[p].length - 2];
566
- _ && a.index - _.index === 1 && l.document.operations[p].pop();
567
- }
568
- if (l.document.operations[p].length < l.skip)
569
- throw new Error(
570
- "Cannot undo: you can't undo more operations than the ones in the scope history"
571
- );
572
- const w = l.document.operations[p].length - 1;
573
- let g = f, A = h ? w - a.skip : w;
574
- for (; g > 0 && A >= 0; ) {
575
- const _ = l.document.operations[p][A];
576
- if (!_) {
577
- g--, A--;
578
- continue;
579
- }
580
- _.type === "NOOP" && _.skip > 0 ? (A = A - (_.skip + 1), l.skip += _.skip + 1) : (l.document.clipboard.push({ ..._ }), g--, A--);
581
- }
582
- l.action = Zt(p);
583
- });
584
- }
585
- function Ke(r, i, s) {
586
- const { scope: p, input: f } = i;
587
- return xt({
588
- document: r,
589
- action: i,
590
- skip: s
591
- }, (l) => {
592
- if (l.skip > 0)
593
- throw new Error(
594
- "Cannot redo: skip value from reducer cannot be used with REDO action"
595
- );
596
- if (f > 1)
597
- throw new Error(
598
- "Cannot redo: you can only redo one operation at a time"
599
- );
600
- if (f < 1)
601
- throw new Error("Invalid REDO action: invalid redo input value");
602
- if (l.document.clipboard.length < 1)
603
- throw new Error("Cannot redo: no operations in the clipboard");
604
- const a = l.document.clipboard.findLastIndex(
605
- (w) => w.scope === p
606
- );
607
- if (a < 0)
608
- throw new Error(
609
- `Cannot redo: no operations in clipboard for scope "${p}"`
610
- );
611
- const h = l.document.clipboard.splice(a, 1)[0];
612
- l.action = Ut({
613
- type: h.type,
614
- scope: h.scope,
615
- input: h.input
616
- });
617
- });
618
- }
619
- function Ze(r, i, s) {
620
- const { scope: p } = i, f = r.operations[p];
621
- let {
622
- input: { start: u, end: l }
623
- } = i;
624
- u = u || 0, l = l || f.length;
625
- const a = f.slice(u, l), h = f.slice(0, u), w = f.slice(l), g = Nt(
626
- r.initialState,
627
- {
628
- ...r.operations,
629
- [p]: h.concat(a)
630
- },
631
- s
632
- ), { name: A, state: _ } = g, F = h.length, U = h.length ? h[h.length - 1].timestamp : w.length ? w[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
633
- return Nt(
634
- r.initialState,
635
- {
636
- ...r.operations,
637
- [p]: [
638
- ...h,
639
- {
640
- ...Kt(
641
- { name: A, state: _ },
642
- a.length
643
- ),
644
- timestamp: U,
645
- index: F,
646
- hash: Ht({ state: _ }, "global")
647
- },
648
- ...w.map((L, C) => ({
649
- ...L,
650
- index: F + C + 1
651
- }))
652
- ]
653
- },
654
- s
655
- );
656
- }
657
- function Ge(r, i) {
658
- return {
659
- ...r,
660
- name: i.name,
661
- state: i.state ?? { global: {}, local: {} }
662
- };
663
- }
664
- const xe = "SET_NAME", gt = "UNDO", yt = "REDO", Ft = "PRUNE", de = "LOAD_STATE", Ye = "NOOP";
665
- function Xe(r, i) {
666
- let s;
667
- return "index" in i ? s = { ...i } : s = r.operations[i.scope].slice(-1)[0], ((s == null ? void 0 : s.index) ?? -1) + 1;
668
- }
669
- function Qe(r, i) {
670
- return {
671
- ...r,
672
- revision: {
673
- ...r.revision,
674
- [i.scope]: Xe(r, i)
675
- },
676
- lastModified: (/* @__PURE__ */ new Date()).toISOString()
677
- };
678
- }
679
- function tr(r, i, s = 0) {
680
- if ([gt, yt, Ft].includes(i.type))
681
- return r;
682
- const { scope: p } = i, f = r.operations[p].slice(
683
- 0,
684
- r.revision[p]
685
- ), u = [...f].pop();
686
- let l = ((u == null ? void 0 : u.index) ?? -1) + 1;
687
- if ("index" in i) {
688
- if (i.index > l + s)
689
- throw new Error(
690
- `Missing operations: expected ${l} with skip 0 or equivalent, got index ${i.index} with skip ${s}`
691
- );
692
- l = i.index;
693
- }
694
- return f.push({
695
- ...i,
696
- index: l,
697
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
698
- hash: "",
699
- scope: p,
700
- skip: s,
701
- error: void 0
702
- }), {
703
- ...r,
704
- operations: { ...r.operations, [p]: f }
705
- };
706
- }
707
- function er(r, i, s = 0) {
708
- let p = tr(r, i, s);
709
- return p = Qe(p, i), p;
710
- }
711
- function rr(r, i, s) {
712
- switch (pe().parse(i), i.type) {
713
- case xe:
714
- return We(r, i.input);
715
- case Ft:
716
- return Ze(r, i, s);
717
- case de:
718
- return Ge(r, i.input.state);
719
- default:
720
- return r;
721
- }
722
- }
723
- function ir(r, i, s) {
724
- switch (i.type) {
725
- case gt:
726
- return He(r, i, s);
727
- case yt:
728
- return Ke(r, i, s);
729
- default:
730
- return { document: r, action: i, skip: s };
731
- }
732
- }
733
- function ge(r, i, s, p, f = {}) {
734
- const { skip: u, ignoreSkipOperations: l = !1, reuseHash: a = !1 } = f;
735
- let h = { ...i }, w = u || 0, g = r, A = [...r.clipboard];
736
- if (Mr(h)) {
737
- const { document: _, skip: F } = Ve(g, h, w);
738
- w = F, g = _;
739
- }
740
- if (Xt(h)) {
741
- const {
742
- skip: _,
743
- action: F,
744
- document: U
745
- } = ir(r, h, w);
746
- h = F, w = _, g = U, A = [...g.clipboard];
747
- }
748
- if (Qt(h) && (g = rr(g, h, s)), w > 0 && !l) {
749
- let _ = w;
750
- "index" in h && (_ = qr(
751
- g.operations[h.scope],
752
- h.index,
753
- w
754
- )), g = Nt(
755
- g.initialState,
756
- g.operations,
757
- s,
758
- void 0,
759
- void 0,
760
- void 0,
761
- { [h.scope]: _ }
762
- // TODO reuse hash?
763
- );
764
- }
765
- return g = er(g, h, w), g = xt(g, (_) => {
766
- try {
767
- const F = s(
768
- _.state,
769
- h,
770
- p
771
- ), U = Xt(i) ? [...A] : [];
772
- if (F)
773
- return Ut({
774
- ...g,
775
- clipboard: [...U],
776
- state: F
777
- });
778
- _.clipboard = Ut([...U]);
779
- } catch (F) {
780
- const U = g.operations[h.scope].length - 1;
781
- _.operations[h.scope][U].error = F.message, console.error(
782
- `Error thrown in reducer. Action: ${JSON.stringify(h)}, Error:`,
783
- F
784
- );
785
- }
786
- }), xt(g, (_) => {
787
- if ([gt, yt, Ft].includes(h.type))
788
- return _;
789
- const F = h.scope || "global", U = a && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : Ht(_, F);
790
- _.operations[F][_.operations[F].length - 1].hash = U, !Qt(h) && h.attachments && h.attachments.forEach((L) => {
791
- const { hash: C, ...y } = L;
792
- _.attachments[C] = {
793
- ...y
794
- };
795
- });
796
- });
797
- }
798
- var Dt = { exports: {} };
799
- typeof Object.create == "function" ? Dt.exports = function(i, s) {
800
- s && (i.super_ = s, i.prototype = Object.create(s.prototype, {
801
- constructor: {
802
- value: i,
803
- enumerable: !1,
804
- writable: !0,
805
- configurable: !0
806
- }
807
- }));
808
- } : Dt.exports = function(i, s) {
809
- if (s) {
810
- i.super_ = s;
811
- var p = function() {
812
- };
813
- p.prototype = s.prototype, i.prototype = new p(), i.prototype.constructor = i;
814
- }
815
- };
816
- var ye = Dt.exports, Ct = { exports: {} }, we = {}, Bt = {};
817
- Bt.byteLength = ar;
818
- Bt.toByteArray = pr;
819
- Bt.fromByteArray = ur;
820
- var nt = [], rt = [], nr = typeof Uint8Array < "u" ? Uint8Array : Array, kt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
821
- for (var ut = 0, or = kt.length; ut < or; ++ut)
822
- nt[ut] = kt[ut], rt[kt.charCodeAt(ut)] = ut;
823
- rt[45] = 62;
824
- rt[95] = 63;
825
- function be(r) {
826
- var i = r.length;
827
- if (i % 4 > 0)
828
- throw new Error("Invalid string. Length must be a multiple of 4");
829
- var s = r.indexOf("=");
830
- s === -1 && (s = i);
831
- var p = s === i ? 0 : 4 - s % 4;
832
- return [s, p];
833
- }
834
- function ar(r) {
835
- var i = be(r), s = i[0], p = i[1];
836
- return (s + p) * 3 / 4 - p;
837
- }
838
- function sr(r, i, s) {
839
- return (i + s) * 3 / 4 - s;
840
- }
841
- function pr(r) {
842
- var i, s = be(r), p = s[0], f = s[1], u = new nr(sr(r, p, f)), l = 0, a = f > 0 ? p - 4 : p, h;
843
- for (h = 0; h < a; h += 4)
844
- i = rt[r.charCodeAt(h)] << 18 | rt[r.charCodeAt(h + 1)] << 12 | rt[r.charCodeAt(h + 2)] << 6 | rt[r.charCodeAt(h + 3)], u[l++] = i >> 16 & 255, u[l++] = i >> 8 & 255, u[l++] = i & 255;
845
- return f === 2 && (i = rt[r.charCodeAt(h)] << 2 | rt[r.charCodeAt(h + 1)] >> 4, u[l++] = i & 255), f === 1 && (i = rt[r.charCodeAt(h)] << 10 | rt[r.charCodeAt(h + 1)] << 4 | rt[r.charCodeAt(h + 2)] >> 2, u[l++] = i >> 8 & 255, u[l++] = i & 255), u;
846
- }
847
- function cr(r) {
848
- return nt[r >> 18 & 63] + nt[r >> 12 & 63] + nt[r >> 6 & 63] + nt[r & 63];
849
- }
850
- function lr(r, i, s) {
851
- for (var p, f = [], u = i; u < s; u += 3)
852
- p = (r[u] << 16 & 16711680) + (r[u + 1] << 8 & 65280) + (r[u + 2] & 255), f.push(cr(p));
853
- return f.join("");
854
- }
855
- function ur(r) {
856
- for (var i, s = r.length, p = s % 3, f = [], u = 16383, l = 0, a = s - p; l < a; l += u)
857
- f.push(lr(r, l, l + u > a ? a : l + u));
858
- return p === 1 ? (i = r[s - 1], f.push(
859
- nt[i >> 2] + nt[i << 4 & 63] + "=="
860
- )) : p === 2 && (i = (r[s - 2] << 8) + r[s - 1], f.push(
861
- nt[i >> 10] + nt[i >> 4 & 63] + nt[i << 2 & 63] + "="
862
- )), f.join("");
863
- }
864
- var Jt = {};
865
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
866
- Jt.read = function(r, i, s, p, f) {
867
- var u, l, a = f * 8 - p - 1, h = (1 << a) - 1, w = h >> 1, g = -7, A = s ? f - 1 : 0, _ = s ? -1 : 1, F = r[i + A];
868
- for (A += _, u = F & (1 << -g) - 1, F >>= -g, g += a; g > 0; u = u * 256 + r[i + A], A += _, g -= 8)
869
- ;
870
- for (l = u & (1 << -g) - 1, u >>= -g, g += p; g > 0; l = l * 256 + r[i + A], A += _, g -= 8)
871
- ;
872
- if (u === 0)
873
- u = 1 - w;
874
- else {
875
- if (u === h)
876
- return l ? NaN : (F ? -1 : 1) * (1 / 0);
877
- l = l + Math.pow(2, p), u = u - w;
878
- }
879
- return (F ? -1 : 1) * l * Math.pow(2, u - p);
880
- };
881
- Jt.write = function(r, i, s, p, f, u) {
882
- var l, a, h, w = u * 8 - f - 1, g = (1 << w) - 1, A = g >> 1, _ = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = p ? 0 : u - 1, U = p ? 1 : -1, L = i < 0 || i === 0 && 1 / i < 0 ? 1 : 0;
883
- for (i = Math.abs(i), isNaN(i) || i === 1 / 0 ? (a = isNaN(i) ? 1 : 0, l = g) : (l = Math.floor(Math.log(i) / Math.LN2), i * (h = Math.pow(2, -l)) < 1 && (l--, h *= 2), l + A >= 1 ? i += _ / h : i += _ * Math.pow(2, 1 - A), i * h >= 2 && (l++, h /= 2), l + A >= g ? (a = 0, l = g) : l + A >= 1 ? (a = (i * h - 1) * Math.pow(2, f), l = l + A) : (a = i * Math.pow(2, A - 1) * Math.pow(2, f), l = 0)); f >= 8; r[s + F] = a & 255, F += U, a /= 256, f -= 8)
884
- ;
885
- for (l = l << f | a, w += f; w > 0; r[s + F] = l & 255, F += U, l /= 256, w -= 8)
886
- ;
887
- r[s + F - U] |= L * 128;
888
- };
889
- /*!
890
- * The buffer module from node.js, for the browser.
891
- *
892
- * @author Feross Aboukhadijeh <https://feross.org>
893
- * @license MIT
894
- */
895
- (function(r) {
896
- var i = Bt, s = Jt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
897
- r.Buffer = a, r.SlowBuffer = b, r.INSPECT_MAX_BYTES = 50;
898
- var f = 2147483647;
899
- r.kMaxLength = f, a.TYPED_ARRAY_SUPPORT = u(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
900
- "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
901
- );
902
- function u() {
903
- try {
904
- var n = new Uint8Array(1), t = { foo: function() {
905
- return 42;
906
- } };
907
- return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(n, t), n.foo() === 42;
908
- } catch {
909
- return !1;
910
- }
911
- }
912
- Object.defineProperty(a.prototype, "parent", {
913
- enumerable: !0,
914
- get: function() {
915
- if (a.isBuffer(this))
916
- return this.buffer;
917
- }
918
- }), Object.defineProperty(a.prototype, "offset", {
919
- enumerable: !0,
920
- get: function() {
921
- if (a.isBuffer(this))
922
- return this.byteOffset;
923
- }
924
- });
925
- function l(n) {
926
- if (n > f)
927
- throw new RangeError('The value "' + n + '" is invalid for option "size"');
928
- var t = new Uint8Array(n);
929
- return Object.setPrototypeOf(t, a.prototype), t;
930
- }
931
- function a(n, t, e) {
932
- if (typeof n == "number") {
933
- if (typeof t == "string")
934
- throw new TypeError(
935
- 'The "string" argument must be of type string. Received type number'
936
- );
937
- return A(n);
938
- }
939
- return h(n, t, e);
940
- }
941
- a.poolSize = 8192;
942
- function h(n, t, e) {
943
- if (typeof n == "string")
944
- return _(n, t);
945
- if (ArrayBuffer.isView(n))
946
- return U(n);
947
- if (n == null)
948
- throw new TypeError(
949
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
950
- );
951
- if (it(n, ArrayBuffer) || n && it(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (it(n, SharedArrayBuffer) || n && it(n.buffer, SharedArrayBuffer)))
952
- return L(n, t, e);
953
- if (typeof n == "number")
954
- throw new TypeError(
955
- 'The "value" argument must not be of type number. Received type number'
956
- );
957
- var o = n.valueOf && n.valueOf();
958
- if (o != null && o !== n)
959
- return a.from(o, t, e);
960
- var c = C(n);
961
- if (c)
962
- return c;
963
- if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
964
- return a.from(
965
- n[Symbol.toPrimitive]("string"),
966
- t,
967
- e
968
- );
969
- throw new TypeError(
970
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
971
- );
972
- }
973
- a.from = function(n, t, e) {
974
- return h(n, t, e);
975
- }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
976
- function w(n) {
977
- if (typeof n != "number")
978
- throw new TypeError('"size" argument must be of type number');
979
- if (n < 0)
980
- throw new RangeError('The value "' + n + '" is invalid for option "size"');
981
- }
982
- function g(n, t, e) {
983
- return w(n), n <= 0 ? l(n) : t !== void 0 ? typeof e == "string" ? l(n).fill(t, e) : l(n).fill(t) : l(n);
984
- }
985
- a.alloc = function(n, t, e) {
986
- return g(n, t, e);
987
- };
988
- function A(n) {
989
- return w(n), l(n < 0 ? 0 : y(n) | 0);
990
- }
991
- a.allocUnsafe = function(n) {
992
- return A(n);
993
- }, a.allocUnsafeSlow = function(n) {
994
- return A(n);
995
- };
996
- function _(n, t) {
997
- if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
998
- throw new TypeError("Unknown encoding: " + t);
999
- var e = I(n, t) | 0, o = l(e), c = o.write(n, t);
1000
- return c !== e && (o = o.slice(0, c)), o;
1001
- }
1002
- function F(n) {
1003
- for (var t = n.length < 0 ? 0 : y(n.length) | 0, e = l(t), o = 0; o < t; o += 1)
1004
- e[o] = n[o] & 255;
1005
- return e;
1006
- }
1007
- function U(n) {
1008
- if (it(n, Uint8Array)) {
1009
- var t = new Uint8Array(n);
1010
- return L(t.buffer, t.byteOffset, t.byteLength);
1011
- }
1012
- return F(n);
1013
- }
1014
- function L(n, t, e) {
1015
- if (t < 0 || n.byteLength < t)
1016
- throw new RangeError('"offset" is outside of buffer bounds');
1017
- if (n.byteLength < t + (e || 0))
1018
- throw new RangeError('"length" is outside of buffer bounds');
1019
- var o;
1020
- return t === void 0 && e === void 0 ? o = new Uint8Array(n) : e === void 0 ? o = new Uint8Array(n, t) : o = new Uint8Array(n, t, e), Object.setPrototypeOf(o, a.prototype), o;
1021
- }
1022
- function C(n) {
1023
- if (a.isBuffer(n)) {
1024
- var t = y(n.length) | 0, e = l(t);
1025
- return e.length === 0 || n.copy(e, 0, 0, t), e;
1026
- }
1027
- if (n.length !== void 0)
1028
- return typeof n.length != "number" || Tt(n.length) ? l(0) : F(n);
1029
- if (n.type === "Buffer" && Array.isArray(n.data))
1030
- return F(n.data);
1031
- }
1032
- function y(n) {
1033
- if (n >= f)
1034
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + f.toString(16) + " bytes");
1035
- return n | 0;
1036
- }
1037
- function b(n) {
1038
- return +n != n && (n = 0), a.alloc(+n);
1039
- }
1040
- a.isBuffer = function(t) {
1041
- return t != null && t._isBuffer === !0 && t !== a.prototype;
1042
- }, a.compare = function(t, e) {
1043
- if (it(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), it(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e))
1044
- throw new TypeError(
1045
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
1046
- );
1047
- if (t === e)
1048
- return 0;
1049
- for (var o = t.length, c = e.length, x = 0, d = Math.min(o, c); x < d; ++x)
1050
- if (t[x] !== e[x]) {
1051
- o = t[x], c = e[x];
1052
- break;
1053
- }
1054
- return o < c ? -1 : c < o ? 1 : 0;
1055
- }, a.isEncoding = function(t) {
1056
- switch (String(t).toLowerCase()) {
1057
- case "hex":
1058
- case "utf8":
1059
- case "utf-8":
1060
- case "ascii":
1061
- case "latin1":
1062
- case "binary":
1063
- case "base64":
1064
- case "ucs2":
1065
- case "ucs-2":
1066
- case "utf16le":
1067
- case "utf-16le":
1068
- return !0;
1069
- default:
1070
- return !1;
1071
- }
1072
- }, a.concat = function(t, e) {
1073
- if (!Array.isArray(t))
1074
- throw new TypeError('"list" argument must be an Array of Buffers');
1075
- if (t.length === 0)
1076
- return a.alloc(0);
1077
- var o;
1078
- if (e === void 0)
1079
- for (e = 0, o = 0; o < t.length; ++o)
1080
- e += t[o].length;
1081
- var c = a.allocUnsafe(e), x = 0;
1082
- for (o = 0; o < t.length; ++o) {
1083
- var d = t[o];
1084
- if (it(d, Uint8Array))
1085
- x + d.length > c.length ? a.from(d).copy(c, x) : Uint8Array.prototype.set.call(
1086
- c,
1087
- d,
1088
- x
1089
- );
1090
- else if (a.isBuffer(d))
1091
- d.copy(c, x);
1092
- else
1093
- throw new TypeError('"list" argument must be an Array of Buffers');
1094
- x += d.length;
1095
- }
1096
- return c;
1097
- };
1098
- function I(n, t) {
1099
- if (a.isBuffer(n))
1100
- return n.length;
1101
- if (ArrayBuffer.isView(n) || it(n, ArrayBuffer))
1102
- return n.byteLength;
1103
- if (typeof n != "string")
1104
- throw new TypeError(
1105
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof n
1106
- );
1107
- var e = n.length, o = arguments.length > 2 && arguments[2] === !0;
1108
- if (!o && e === 0)
1109
- return 0;
1110
- for (var c = !1; ; )
1111
- switch (t) {
1112
- case "ascii":
1113
- case "latin1":
1114
- case "binary":
1115
- return e;
1116
- case "utf8":
1117
- case "utf-8":
1118
- return H(n).length;
1119
- case "ucs2":
1120
- case "ucs-2":
1121
- case "utf16le":
1122
- case "utf-16le":
1123
- return e * 2;
1124
- case "hex":
1125
- return e >>> 1;
1126
- case "base64":
1127
- return st(n).length;
1128
- default:
1129
- if (c)
1130
- return o ? -1 : H(n).length;
1131
- t = ("" + t).toLowerCase(), c = !0;
1132
- }
1133
- }
1134
- a.byteLength = I;
1135
- function W(n, t, e) {
1136
- var o = !1;
1137
- if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
1138
- return "";
1139
- for (n || (n = "utf8"); ; )
1140
- switch (n) {
1141
- case "hex":
1142
- return S(this, t, e);
1143
- case "utf8":
1144
- case "utf-8":
1145
- return m(this, t, e);
1146
- case "ascii":
1147
- return j(this, t, e);
1148
- case "latin1":
1149
- case "binary":
1150
- return D(this, t, e);
1151
- case "base64":
1152
- return V(this, t, e);
1153
- case "ucs2":
1154
- case "ucs-2":
1155
- case "utf16le":
1156
- case "utf-16le":
1157
- return k(this, t, e);
1158
- default:
1159
- if (o)
1160
- throw new TypeError("Unknown encoding: " + n);
1161
- n = (n + "").toLowerCase(), o = !0;
1162
- }
1163
- }
1164
- a.prototype._isBuffer = !0;
1165
- function Y(n, t, e) {
1166
- var o = n[t];
1167
- n[t] = n[e], n[e] = o;
1168
- }
1169
- a.prototype.swap16 = function() {
1170
- var t = this.length;
1171
- if (t % 2 !== 0)
1172
- throw new RangeError("Buffer size must be a multiple of 16-bits");
1173
- for (var e = 0; e < t; e += 2)
1174
- Y(this, e, e + 1);
1175
- return this;
1176
- }, a.prototype.swap32 = function() {
1177
- var t = this.length;
1178
- if (t % 4 !== 0)
1179
- throw new RangeError("Buffer size must be a multiple of 32-bits");
1180
- for (var e = 0; e < t; e += 4)
1181
- Y(this, e, e + 3), Y(this, e + 1, e + 2);
1182
- return this;
1183
- }, a.prototype.swap64 = function() {
1184
- var t = this.length;
1185
- if (t % 8 !== 0)
1186
- throw new RangeError("Buffer size must be a multiple of 64-bits");
1187
- for (var e = 0; e < t; e += 8)
1188
- Y(this, e, e + 7), Y(this, e + 1, e + 6), Y(this, e + 2, e + 5), Y(this, e + 3, e + 4);
1189
- return this;
1190
- }, a.prototype.toString = function() {
1191
- var t = this.length;
1192
- return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : W.apply(this, arguments);
1193
- }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
1194
- if (!a.isBuffer(t))
1195
- throw new TypeError("Argument must be a Buffer");
1196
- return this === t ? !0 : a.compare(this, t) === 0;
1197
- }, a.prototype.inspect = function() {
1198
- var t = "", e = r.INSPECT_MAX_BYTES;
1199
- return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
1200
- }, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, o, c, x) {
1201
- if (it(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
1202
- throw new TypeError(
1203
- 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
1204
- );
1205
- if (e === void 0 && (e = 0), o === void 0 && (o = t ? t.length : 0), c === void 0 && (c = 0), x === void 0 && (x = this.length), e < 0 || o > t.length || c < 0 || x > this.length)
1206
- throw new RangeError("out of range index");
1207
- if (c >= x && e >= o)
1208
- return 0;
1209
- if (c >= x)
1210
- return -1;
1211
- if (e >= o)
1212
- return 1;
1213
- if (e >>>= 0, o >>>= 0, c >>>= 0, x >>>= 0, this === t)
1214
- return 0;
1215
- for (var d = x - c, $ = o - e, M = Math.min(d, $), P = this.slice(c, x), Z = t.slice(e, o), q = 0; q < M; ++q)
1216
- if (P[q] !== Z[q]) {
1217
- d = P[q], $ = Z[q];
1218
- break;
1219
- }
1220
- return d < $ ? -1 : $ < d ? 1 : 0;
1221
- };
1222
- function G(n, t, e, o, c) {
1223
- if (n.length === 0)
1224
- return -1;
1225
- if (typeof e == "string" ? (o = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, Tt(e) && (e = c ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
1226
- if (c)
1227
- return -1;
1228
- e = n.length - 1;
1229
- } else if (e < 0)
1230
- if (c)
1231
- e = 0;
1232
- else
1233
- return -1;
1234
- if (typeof t == "string" && (t = a.from(t, o)), a.isBuffer(t))
1235
- return t.length === 0 ? -1 : R(n, t, e, o, c);
1236
- if (typeof t == "number")
1237
- return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? c ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : R(n, [t], e, o, c);
1238
- throw new TypeError("val must be string, number or Buffer");
1239
- }
1240
- function R(n, t, e, o, c) {
1241
- var x = 1, d = n.length, $ = t.length;
1242
- if (o !== void 0 && (o = String(o).toLowerCase(), o === "ucs2" || o === "ucs-2" || o === "utf16le" || o === "utf-16le")) {
1243
- if (n.length < 2 || t.length < 2)
1244
- return -1;
1245
- x = 2, d /= 2, $ /= 2, e /= 2;
1246
- }
1247
- function M(Gt, Yt) {
1248
- return x === 1 ? Gt[Yt] : Gt.readUInt16BE(Yt * x);
1249
- }
1250
- var P;
1251
- if (c) {
1252
- var Z = -1;
1253
- for (P = e; P < d; P++)
1254
- if (M(n, P) === M(t, Z === -1 ? 0 : P - Z)) {
1255
- if (Z === -1 && (Z = P), P - Z + 1 === $)
1256
- return Z * x;
1257
- } else
1258
- Z !== -1 && (P -= P - Z), Z = -1;
1259
- } else
1260
- for (e + $ > d && (e = d - $), P = e; P >= 0; P--) {
1261
- for (var q = !0, vt = 0; vt < $; vt++)
1262
- if (M(n, P + vt) !== M(t, vt)) {
1263
- q = !1;
1264
- break;
1265
- }
1266
- if (q)
1267
- return P;
1268
- }
1269
- return -1;
1270
- }
1271
- a.prototype.includes = function(t, e, o) {
1272
- return this.indexOf(t, e, o) !== -1;
1273
- }, a.prototype.indexOf = function(t, e, o) {
1274
- return G(this, t, e, o, !0);
1275
- }, a.prototype.lastIndexOf = function(t, e, o) {
1276
- return G(this, t, e, o, !1);
1277
- };
1278
- function ct(n, t, e, o) {
1279
- e = Number(e) || 0;
1280
- var c = n.length - e;
1281
- o ? (o = Number(o), o > c && (o = c)) : o = c;
1282
- var x = t.length;
1283
- o > x / 2 && (o = x / 2);
1284
- for (var d = 0; d < o; ++d) {
1285
- var $ = parseInt(t.substr(d * 2, 2), 16);
1286
- if (Tt($))
1287
- return d;
1288
- n[e + d] = $;
1289
- }
1290
- return d;
1291
- }
1292
- function lt(n, t, e, o) {
1293
- return Et(H(t, n.length - e), n, e, o);
1294
- }
1295
- function ot(n, t, e, o) {
1296
- return Et(Q(t), n, e, o);
1297
- }
1298
- function at(n, t, e, o) {
1299
- return Et(st(t), n, e, o);
1300
- }
1301
- function It(n, t, e, o) {
1302
- return Et(tt(t, n.length - e), n, e, o);
1303
- }
1304
- a.prototype.write = function(t, e, o, c) {
1305
- if (e === void 0)
1306
- c = "utf8", o = this.length, e = 0;
1307
- else if (o === void 0 && typeof e == "string")
1308
- c = e, o = this.length, e = 0;
1309
- else if (isFinite(e))
1310
- e = e >>> 0, isFinite(o) ? (o = o >>> 0, c === void 0 && (c = "utf8")) : (c = o, o = void 0);
1311
- else
1312
- throw new Error(
1313
- "Buffer.write(string, encoding, offset[, length]) is no longer supported"
1314
- );
1315
- var x = this.length - e;
1316
- if ((o === void 0 || o > x) && (o = x), t.length > 0 && (o < 0 || e < 0) || e > this.length)
1317
- throw new RangeError("Attempt to write outside buffer bounds");
1318
- c || (c = "utf8");
1319
- for (var d = !1; ; )
1320
- switch (c) {
1321
- case "hex":
1322
- return ct(this, t, e, o);
1323
- case "utf8":
1324
- case "utf-8":
1325
- return lt(this, t, e, o);
1326
- case "ascii":
1327
- case "latin1":
1328
- case "binary":
1329
- return ot(this, t, e, o);
1330
- case "base64":
1331
- return at(this, t, e, o);
1332
- case "ucs2":
1333
- case "ucs-2":
1334
- case "utf16le":
1335
- case "utf-16le":
1336
- return It(this, t, e, o);
1337
- default:
1338
- if (d)
1339
- throw new TypeError("Unknown encoding: " + c);
1340
- c = ("" + c).toLowerCase(), d = !0;
1341
- }
1342
- }, a.prototype.toJSON = function() {
1343
- return {
1344
- type: "Buffer",
1345
- data: Array.prototype.slice.call(this._arr || this, 0)
1346
- };
1347
- };
1348
- function V(n, t, e) {
1349
- return t === 0 && e === n.length ? i.fromByteArray(n) : i.fromByteArray(n.slice(t, e));
1350
- }
1351
- function m(n, t, e) {
1352
- e = Math.min(n.length, e);
1353
- for (var o = [], c = t; c < e; ) {
1354
- var x = n[c], d = null, $ = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1355
- if (c + $ <= e) {
1356
- var M, P, Z, q;
1357
- switch ($) {
1358
- case 1:
1359
- x < 128 && (d = x);
1360
- break;
1361
- case 2:
1362
- M = n[c + 1], (M & 192) === 128 && (q = (x & 31) << 6 | M & 63, q > 127 && (d = q));
1363
- break;
1364
- case 3:
1365
- M = n[c + 1], P = n[c + 2], (M & 192) === 128 && (P & 192) === 128 && (q = (x & 15) << 12 | (M & 63) << 6 | P & 63, q > 2047 && (q < 55296 || q > 57343) && (d = q));
1366
- break;
1367
- case 4:
1368
- M = n[c + 1], P = n[c + 2], Z = n[c + 3], (M & 192) === 128 && (P & 192) === 128 && (Z & 192) === 128 && (q = (x & 15) << 18 | (M & 63) << 12 | (P & 63) << 6 | Z & 63, q > 65535 && q < 1114112 && (d = q));
1369
- }
1370
- }
1371
- d === null ? (d = 65533, $ = 1) : d > 65535 && (d -= 65536, o.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), o.push(d), c += $;
1372
- }
1373
- return T(o);
1374
- }
1375
- var E = 4096;
1376
- function T(n) {
1377
- var t = n.length;
1378
- if (t <= E)
1379
- return String.fromCharCode.apply(String, n);
1380
- for (var e = "", o = 0; o < t; )
1381
- e += String.fromCharCode.apply(
1382
- String,
1383
- n.slice(o, o += E)
1384
- );
1385
- return e;
1386
- }
1387
- function j(n, t, e) {
1388
- var o = "";
1389
- e = Math.min(n.length, e);
1390
- for (var c = t; c < e; ++c)
1391
- o += String.fromCharCode(n[c] & 127);
1392
- return o;
1393
- }
1394
- function D(n, t, e) {
1395
- var o = "";
1396
- e = Math.min(n.length, e);
1397
- for (var c = t; c < e; ++c)
1398
- o += String.fromCharCode(n[c]);
1399
- return o;
1400
- }
1401
- function S(n, t, e) {
1402
- var o = n.length;
1403
- (!t || t < 0) && (t = 0), (!e || e < 0 || e > o) && (e = o);
1404
- for (var c = "", x = t; x < e; ++x)
1405
- c += $e[n[x]];
1406
- return c;
1407
- }
1408
- function k(n, t, e) {
1409
- for (var o = n.slice(t, e), c = "", x = 0; x < o.length - 1; x += 2)
1410
- c += String.fromCharCode(o[x] + o[x + 1] * 256);
1411
- return c;
1412
- }
1413
- a.prototype.slice = function(t, e) {
1414
- var o = this.length;
1415
- t = ~~t, e = e === void 0 ? o : ~~e, t < 0 ? (t += o, t < 0 && (t = 0)) : t > o && (t = o), e < 0 ? (e += o, e < 0 && (e = 0)) : e > o && (e = o), e < t && (e = t);
1416
- var c = this.subarray(t, e);
1417
- return Object.setPrototypeOf(c, a.prototype), c;
1418
- };
1419
- function B(n, t, e) {
1420
- if (n % 1 !== 0 || n < 0)
1421
- throw new RangeError("offset is not uint");
1422
- if (n + t > e)
1423
- throw new RangeError("Trying to access beyond buffer length");
1424
- }
1425
- a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, o) {
1426
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1427
- for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1428
- c += this[t + d] * x;
1429
- return c;
1430
- }, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, o) {
1431
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1432
- for (var c = this[t + --e], x = 1; e > 0 && (x *= 256); )
1433
- c += this[t + --e] * x;
1434
- return c;
1435
- }, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
1436
- return t = t >>> 0, e || B(t, 1, this.length), this[t];
1437
- }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
1438
- return t = t >>> 0, e || B(t, 2, this.length), this[t] | this[t + 1] << 8;
1439
- }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
1440
- return t = t >>> 0, e || B(t, 2, this.length), this[t] << 8 | this[t + 1];
1441
- }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
1442
- return t = t >>> 0, e || B(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1443
- }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
1444
- return t = t >>> 0, e || B(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1445
- }, a.prototype.readIntLE = function(t, e, o) {
1446
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1447
- for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1448
- c += this[t + d] * x;
1449
- return x *= 128, c >= x && (c -= Math.pow(2, 8 * e)), c;
1450
- }, a.prototype.readIntBE = function(t, e, o) {
1451
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1452
- for (var c = e, x = 1, d = this[t + --c]; c > 0 && (x *= 256); )
1453
- d += this[t + --c] * x;
1454
- return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
1455
- }, a.prototype.readInt8 = function(t, e) {
1456
- return t = t >>> 0, e || B(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1457
- }, a.prototype.readInt16LE = function(t, e) {
1458
- t = t >>> 0, e || B(t, 2, this.length);
1459
- var o = this[t] | this[t + 1] << 8;
1460
- return o & 32768 ? o | 4294901760 : o;
1461
- }, a.prototype.readInt16BE = function(t, e) {
1462
- t = t >>> 0, e || B(t, 2, this.length);
1463
- var o = this[t + 1] | this[t] << 8;
1464
- return o & 32768 ? o | 4294901760 : o;
1465
- }, a.prototype.readInt32LE = function(t, e) {
1466
- return t = t >>> 0, e || B(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1467
- }, a.prototype.readInt32BE = function(t, e) {
1468
- return t = t >>> 0, e || B(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1469
- }, a.prototype.readFloatLE = function(t, e) {
1470
- return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !0, 23, 4);
1471
- }, a.prototype.readFloatBE = function(t, e) {
1472
- return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !1, 23, 4);
1473
- }, a.prototype.readDoubleLE = function(t, e) {
1474
- return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !0, 52, 8);
1475
- }, a.prototype.readDoubleBE = function(t, e) {
1476
- return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !1, 52, 8);
1477
- };
1478
- function O(n, t, e, o, c, x) {
1479
- if (!a.isBuffer(n))
1480
- throw new TypeError('"buffer" argument must be a Buffer instance');
1481
- if (t > c || t < x)
1482
- throw new RangeError('"value" argument is out of bounds');
1483
- if (e + o > n.length)
1484
- throw new RangeError("Index out of range");
1485
- }
1486
- a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, o, c) {
1487
- if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1488
- var x = Math.pow(2, 8 * o) - 1;
1489
- O(this, t, e, o, x, 0);
1490
- }
1491
- var d = 1, $ = 0;
1492
- for (this[e] = t & 255; ++$ < o && (d *= 256); )
1493
- this[e + $] = t / d & 255;
1494
- return e + o;
1495
- }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, o, c) {
1496
- if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1497
- var x = Math.pow(2, 8 * o) - 1;
1498
- O(this, t, e, o, x, 0);
1499
- }
1500
- var d = o - 1, $ = 1;
1501
- for (this[e + d] = t & 255; --d >= 0 && ($ *= 256); )
1502
- this[e + d] = t / $ & 255;
1503
- return e + o;
1504
- }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, o) {
1505
- return t = +t, e = e >>> 0, o || O(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1506
- }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, o) {
1507
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1508
- }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, o) {
1509
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1510
- }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, o) {
1511
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1512
- }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, o) {
1513
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1514
- }, a.prototype.writeIntLE = function(t, e, o, c) {
1515
- if (t = +t, e = e >>> 0, !c) {
1516
- var x = Math.pow(2, 8 * o - 1);
1517
- O(this, t, e, o, x - 1, -x);
1518
- }
1519
- var d = 0, $ = 1, M = 0;
1520
- for (this[e] = t & 255; ++d < o && ($ *= 256); )
1521
- t < 0 && M === 0 && this[e + d - 1] !== 0 && (M = 1), this[e + d] = (t / $ >> 0) - M & 255;
1522
- return e + o;
1523
- }, a.prototype.writeIntBE = function(t, e, o, c) {
1524
- if (t = +t, e = e >>> 0, !c) {
1525
- var x = Math.pow(2, 8 * o - 1);
1526
- O(this, t, e, o, x - 1, -x);
1527
- }
1528
- var d = o - 1, $ = 1, M = 0;
1529
- for (this[e + d] = t & 255; --d >= 0 && ($ *= 256); )
1530
- t < 0 && M === 0 && this[e + d + 1] !== 0 && (M = 1), this[e + d] = (t / $ >> 0) - M & 255;
1531
- return e + o;
1532
- }, a.prototype.writeInt8 = function(t, e, o) {
1533
- return t = +t, e = e >>> 0, o || O(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1534
- }, a.prototype.writeInt16LE = function(t, e, o) {
1535
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1536
- }, a.prototype.writeInt16BE = function(t, e, o) {
1537
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1538
- }, a.prototype.writeInt32LE = function(t, e, o) {
1539
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1540
- }, a.prototype.writeInt32BE = function(t, e, o) {
1541
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1542
- };
1543
- function z(n, t, e, o, c, x) {
1544
- if (e + o > n.length)
1545
- throw new RangeError("Index out of range");
1546
- if (e < 0)
1547
- throw new RangeError("Index out of range");
1548
- }
1549
- function J(n, t, e, o, c) {
1550
- return t = +t, e = e >>> 0, c || z(n, t, e, 4), s.write(n, t, e, o, 23, 4), e + 4;
1551
- }
1552
- a.prototype.writeFloatLE = function(t, e, o) {
1553
- return J(this, t, e, !0, o);
1554
- }, a.prototype.writeFloatBE = function(t, e, o) {
1555
- return J(this, t, e, !1, o);
1556
- };
1557
- function N(n, t, e, o, c) {
1558
- return t = +t, e = e >>> 0, c || z(n, t, e, 8), s.write(n, t, e, o, 52, 8), e + 8;
1559
- }
1560
- a.prototype.writeDoubleLE = function(t, e, o) {
1561
- return N(this, t, e, !0, o);
1562
- }, a.prototype.writeDoubleBE = function(t, e, o) {
1563
- return N(this, t, e, !1, o);
1564
- }, a.prototype.copy = function(t, e, o, c) {
1565
- if (!a.isBuffer(t))
1566
- throw new TypeError("argument should be a Buffer");
1567
- if (o || (o = 0), !c && c !== 0 && (c = this.length), e >= t.length && (e = t.length), e || (e = 0), c > 0 && c < o && (c = o), c === o || t.length === 0 || this.length === 0)
1568
- return 0;
1569
- if (e < 0)
1570
- throw new RangeError("targetStart out of bounds");
1571
- if (o < 0 || o >= this.length)
1572
- throw new RangeError("Index out of range");
1573
- if (c < 0)
1574
- throw new RangeError("sourceEnd out of bounds");
1575
- c > this.length && (c = this.length), t.length - e < c - o && (c = t.length - e + o);
1576
- var x = c - o;
1577
- return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, o, c) : Uint8Array.prototype.set.call(
1578
- t,
1579
- this.subarray(o, c),
1580
- e
1581
- ), x;
1582
- }, a.prototype.fill = function(t, e, o, c) {
1583
- if (typeof t == "string") {
1584
- if (typeof e == "string" ? (c = e, e = 0, o = this.length) : typeof o == "string" && (c = o, o = this.length), c !== void 0 && typeof c != "string")
1585
- throw new TypeError("encoding must be a string");
1586
- if (typeof c == "string" && !a.isEncoding(c))
1587
- throw new TypeError("Unknown encoding: " + c);
1588
- if (t.length === 1) {
1589
- var x = t.charCodeAt(0);
1590
- (c === "utf8" && x < 128 || c === "latin1") && (t = x);
1591
- }
1592
- } else
1593
- typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
1594
- if (e < 0 || this.length < e || this.length < o)
1595
- throw new RangeError("Out of range index");
1596
- if (o <= e)
1597
- return this;
1598
- e = e >>> 0, o = o === void 0 ? this.length : o >>> 0, t || (t = 0);
1599
- var d;
1600
- if (typeof t == "number")
1601
- for (d = e; d < o; ++d)
1602
- this[d] = t;
1603
- else {
1604
- var $ = a.isBuffer(t) ? t : a.from(t, c), M = $.length;
1605
- if (M === 0)
1606
- throw new TypeError('The value "' + t + '" is invalid for argument "value"');
1607
- for (d = 0; d < o - e; ++d)
1608
- this[d + e] = $[d % M];
1609
- }
1610
- return this;
1611
- };
1612
- var K = /[^+/0-9A-Za-z-_]/g;
1613
- function X(n) {
1614
- if (n = n.split("=")[0], n = n.trim().replace(K, ""), n.length < 2)
1615
- return "";
1616
- for (; n.length % 4 !== 0; )
1617
- n = n + "=";
1618
- return n;
1619
- }
1620
- function H(n, t) {
1621
- t = t || 1 / 0;
1622
- for (var e, o = n.length, c = null, x = [], d = 0; d < o; ++d) {
1623
- if (e = n.charCodeAt(d), e > 55295 && e < 57344) {
1624
- if (!c) {
1625
- if (e > 56319) {
1626
- (t -= 3) > -1 && x.push(239, 191, 189);
1627
- continue;
1628
- } else if (d + 1 === o) {
1629
- (t -= 3) > -1 && x.push(239, 191, 189);
1630
- continue;
1631
- }
1632
- c = e;
1633
- continue;
1634
- }
1635
- if (e < 56320) {
1636
- (t -= 3) > -1 && x.push(239, 191, 189), c = e;
1637
- continue;
1638
- }
1639
- e = (c - 55296 << 10 | e - 56320) + 65536;
1640
- } else
1641
- c && (t -= 3) > -1 && x.push(239, 191, 189);
1642
- if (c = null, e < 128) {
1643
- if ((t -= 1) < 0)
1644
- break;
1645
- x.push(e);
1646
- } else if (e < 2048) {
1647
- if ((t -= 2) < 0)
1648
- break;
1649
- x.push(
1650
- e >> 6 | 192,
1651
- e & 63 | 128
1652
- );
1653
- } else if (e < 65536) {
1654
- if ((t -= 3) < 0)
1655
- break;
1656
- x.push(
1657
- e >> 12 | 224,
1658
- e >> 6 & 63 | 128,
1659
- e & 63 | 128
1660
- );
1661
- } else if (e < 1114112) {
1662
- if ((t -= 4) < 0)
1663
- break;
1664
- x.push(
1665
- e >> 18 | 240,
1666
- e >> 12 & 63 | 128,
1667
- e >> 6 & 63 | 128,
1668
- e & 63 | 128
1669
- );
1670
- } else
1671
- throw new Error("Invalid code point");
1672
- }
1673
- return x;
1674
- }
1675
- function Q(n) {
1676
- for (var t = [], e = 0; e < n.length; ++e)
1677
- t.push(n.charCodeAt(e) & 255);
1678
- return t;
1679
- }
1680
- function tt(n, t) {
1681
- for (var e, o, c, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
1682
- e = n.charCodeAt(d), o = e >> 8, c = e % 256, x.push(c), x.push(o);
1683
- return x;
1684
- }
1685
- function st(n) {
1686
- return i.toByteArray(X(n));
1687
- }
1688
- function Et(n, t, e, o) {
1689
- for (var c = 0; c < o && !(c + e >= t.length || c >= n.length); ++c)
1690
- t[c + e] = n[c];
1691
- return c;
1692
- }
1693
- function it(n, t) {
1694
- return n instanceof t || n != null && n.constructor != null && n.constructor.name != null && n.constructor.name === t.name;
1695
- }
1696
- function Tt(n) {
1697
- return n !== n;
1698
- }
1699
- var $e = function() {
1700
- for (var n = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
1701
- for (var o = e * 16, c = 0; c < 16; ++c)
1702
- t[o + c] = n[e] + n[c];
1703
- return t;
1704
- }();
1705
- })(we);
1706
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1707
- (function(r, i) {
1708
- var s = we, p = s.Buffer;
1709
- function f(l, a) {
1710
- for (var h in l)
1711
- a[h] = l[h];
1712
- }
1713
- p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? r.exports = s : (f(s, i), i.Buffer = u);
1714
- function u(l, a, h) {
1715
- return p(l, a, h);
1716
- }
1717
- u.prototype = Object.create(p.prototype), f(p, u), u.from = function(l, a, h) {
1718
- if (typeof l == "number")
1719
- throw new TypeError("Argument must not be a number");
1720
- return p(l, a, h);
1721
- }, u.alloc = function(l, a, h) {
1722
- if (typeof l != "number")
1723
- throw new TypeError("Argument must be a number");
1724
- var w = p(l);
1725
- return a !== void 0 ? typeof h == "string" ? w.fill(a, h) : w.fill(a) : w.fill(0), w;
1726
- }, u.allocUnsafe = function(l) {
1727
- if (typeof l != "number")
1728
- throw new TypeError("Argument must be a number");
1729
- return p(l);
1730
- }, u.allocUnsafeSlow = function(l) {
1731
- if (typeof l != "number")
1732
- throw new TypeError("Argument must be a number");
1733
- return s.SlowBuffer(l);
1734
- };
1735
- })(Ct, Ct.exports);
1736
- var Wt = Ct.exports, Ee = Wt.Buffer;
1737
- function jt(r, i) {
1738
- this._block = Ee.alloc(r), this._finalSize = i, this._blockSize = r, this._len = 0;
1739
- }
1740
- jt.prototype.update = function(r, i) {
1741
- typeof r == "string" && (i = i || "utf8", r = Ee.from(r, i));
1742
- for (var s = this._block, p = this._blockSize, f = r.length, u = this._len, l = 0; l < f; ) {
1743
- for (var a = u % p, h = Math.min(f - l, p - a), w = 0; w < h; w++)
1744
- s[a + w] = r[l + w];
1745
- u += h, l += h, u % p === 0 && this._update(s);
1746
- }
1747
- return this._len += f, this;
1748
- };
1749
- jt.prototype.digest = function(r) {
1750
- var i = this._len % this._blockSize;
1751
- this._block[i] = 128, this._block.fill(0, i + 1), i >= this._finalSize && (this._update(this._block), this._block.fill(0));
1752
- var s = this._len * 8;
1753
- if (s <= 4294967295)
1754
- this._block.writeUInt32BE(s, this._blockSize - 4);
1755
- else {
1756
- var p = (s & 4294967295) >>> 0, f = (s - p) / 4294967296;
1757
- this._block.writeUInt32BE(f, this._blockSize - 8), this._block.writeUInt32BE(p, this._blockSize - 4);
1758
- }
1759
- this._update(this._block);
1760
- var u = this._hash();
1761
- return r ? u.toString(r) : u;
1762
- };
1763
- jt.prototype._update = function() {
1764
- throw new Error("_update must be implemented by subclass");
1765
- };
1766
- var ve = jt, fr = ye, Ae = ve, hr = Wt.Buffer, mr = [
1767
- 1518500249,
1768
- 1859775393,
1769
- -1894007588,
1770
- -899497514
1771
- ], xr = new Array(80);
1772
- function wt() {
1773
- this.init(), this._w = xr, Ae.call(this, 64, 56);
1774
- }
1775
- fr(wt, Ae);
1776
- wt.prototype.init = function() {
1777
- return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1778
- };
1779
- function dr(r) {
1780
- return r << 1 | r >>> 31;
1781
- }
1782
- function gr(r) {
1783
- return r << 5 | r >>> 27;
1784
- }
1785
- function yr(r) {
1786
- return r << 30 | r >>> 2;
1787
- }
1788
- function wr(r, i, s, p) {
1789
- return r === 0 ? i & s | ~i & p : r === 2 ? i & s | i & p | s & p : i ^ s ^ p;
1790
- }
1791
- wt.prototype._update = function(r) {
1792
- for (var i = this._w, s = this._a | 0, p = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
1793
- i[a] = r.readInt32BE(a * 4);
1794
- for (; a < 80; ++a)
1795
- i[a] = dr(i[a - 3] ^ i[a - 8] ^ i[a - 14] ^ i[a - 16]);
1796
- for (var h = 0; h < 80; ++h) {
1797
- var w = ~~(h / 20), g = gr(s) + wr(w, p, f, u) + l + i[h] + mr[w] | 0;
1798
- l = u, u = f, f = yr(p), p = s, s = g;
1799
- }
1800
- this._a = s + this._a | 0, this._b = p + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0;
1801
- };
1802
- wt.prototype._hash = function() {
1803
- var r = hr.allocUnsafe(20);
1804
- return r.writeInt32BE(this._a | 0, 0), r.writeInt32BE(this._b | 0, 4), r.writeInt32BE(this._c | 0, 8), r.writeInt32BE(this._d | 0, 12), r.writeInt32BE(this._e | 0, 16), r;
1805
- };
1806
- var br = wt;
1807
- const Er = /* @__PURE__ */ qt(br);
1808
- var vr = ye, _e = ve, Ar = Wt.Buffer, _r = [
1809
- 1116352408,
1810
- 1899447441,
1811
- 3049323471,
1812
- 3921009573,
1813
- 961987163,
1814
- 1508970993,
1815
- 2453635748,
1816
- 2870763221,
1817
- 3624381080,
1818
- 310598401,
1819
- 607225278,
1820
- 1426881987,
1821
- 1925078388,
1822
- 2162078206,
1823
- 2614888103,
1824
- 3248222580,
1825
- 3835390401,
1826
- 4022224774,
1827
- 264347078,
1828
- 604807628,
1829
- 770255983,
1830
- 1249150122,
1831
- 1555081692,
1832
- 1996064986,
1833
- 2554220882,
1834
- 2821834349,
1835
- 2952996808,
1836
- 3210313671,
1837
- 3336571891,
1838
- 3584528711,
1839
- 113926993,
1840
- 338241895,
1841
- 666307205,
1842
- 773529912,
1843
- 1294757372,
1844
- 1396182291,
1845
- 1695183700,
1846
- 1986661051,
1847
- 2177026350,
1848
- 2456956037,
1849
- 2730485921,
1850
- 2820302411,
1851
- 3259730800,
1852
- 3345764771,
1853
- 3516065817,
1854
- 3600352804,
1855
- 4094571909,
1856
- 275423344,
1857
- 430227734,
1858
- 506948616,
1859
- 659060556,
1860
- 883997877,
1861
- 958139571,
1862
- 1322822218,
1863
- 1537002063,
1864
- 1747873779,
1865
- 1955562222,
1866
- 2024104815,
1867
- 2227730452,
1868
- 2361852424,
1869
- 2428436474,
1870
- 2756734187,
1871
- 3204031479,
1872
- 3329325298
1873
- ], Sr = new Array(64);
1874
- function bt() {
1875
- this.init(), this._w = Sr, _e.call(this, 64, 56);
1876
- }
1877
- vr(bt, _e);
1878
- bt.prototype.init = function() {
1879
- return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
1880
- };
1881
- function Fr(r, i, s) {
1882
- return s ^ r & (i ^ s);
1883
- }
1884
- function Br(r, i, s) {
1885
- return r & i | s & (r | i);
1886
- }
1887
- function jr(r) {
1888
- return (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10);
1889
- }
1890
- function Or(r) {
1891
- return (r >>> 6 | r << 26) ^ (r >>> 11 | r << 21) ^ (r >>> 25 | r << 7);
1892
- }
1893
- function Ir(r) {
1894
- return (r >>> 7 | r << 25) ^ (r >>> 18 | r << 14) ^ r >>> 3;
1895
- }
1896
- function Tr(r) {
1897
- return (r >>> 17 | r << 15) ^ (r >>> 19 | r << 13) ^ r >>> 10;
1898
- }
1899
- bt.prototype._update = function(r) {
1900
- for (var i = this._w, s = this._a | 0, p = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = this._f | 0, h = this._g | 0, w = this._h | 0, g = 0; g < 16; ++g)
1901
- i[g] = r.readInt32BE(g * 4);
1902
- for (; g < 64; ++g)
1903
- i[g] = Tr(i[g - 2]) + i[g - 7] + Ir(i[g - 15]) + i[g - 16] | 0;
1904
- for (var A = 0; A < 64; ++A) {
1905
- var _ = w + Or(l) + Fr(l, a, h) + _r[A] + i[A] | 0, F = jr(s) + Br(s, p, f) | 0;
1906
- w = h, h = a, a = l, l = u + _ | 0, u = f, f = p, p = s, s = _ + F | 0;
1907
- }
1908
- this._a = s + this._a | 0, this._b = p + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0, this._f = a + this._f | 0, this._g = h + this._g | 0, this._h = w + this._h | 0;
1909
- };
1910
- bt.prototype._hash = function() {
1911
- var r = Ar.allocUnsafe(32);
1912
- return r.writeInt32BE(this._a, 0), r.writeInt32BE(this._b, 4), r.writeInt32BE(this._c, 8), r.writeInt32BE(this._d, 12), r.writeInt32BE(this._e, 16), r.writeInt32BE(this._f, 20), r.writeInt32BE(this._g, 24), r.writeInt32BE(this._h, 28), r;
1913
- };
1914
- var kr = bt;
1915
- const Ur = /* @__PURE__ */ qt(kr), Vt = new Error("File system not available.");
1916
- function $r(r, i, s) {
1917
- throw Vt;
1918
- }
1919
- function Se(r) {
1920
- throw Vt;
1921
- }
1922
- function Dr(r) {
1923
- throw Vt;
1924
- }
1925
- const Cr = async (r) => Se(), Nr = {
1926
- sha1: Er,
1927
- sha256: Ur
1928
- }, Ot = (r, i = "sha1") => {
1929
- if (!["sha1", "sha256"].includes(i))
1930
- throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
1931
- const s = Nr[i];
1932
- return new s().update(r).digest("base64");
1933
- };
1934
- function Mr(r) {
1935
- return r.type === Ye && r.skip !== void 0 && r.skip > 0 && r.hash !== void 0;
1936
- }
1937
- function Xt(r) {
1938
- return [gt, yt].includes(r.type);
1939
- }
1940
- function Qt(r) {
1941
- return [xe, gt, yt, Ft, de].includes(r.type);
1942
- }
1943
- function ht(r, i, s, p, f = "global") {
1944
- if (!r)
1945
- throw new Error("Empty action type");
1946
- if (typeof r != "string")
1947
- throw new Error(`Invalid action type: ${JSON.stringify(r)}`);
1948
- const u = { type: r, input: i, scope: f };
1949
- s && (u.attachments = s);
1950
- try {
1951
- p == null || p().parse(u.input);
1952
- } catch (l) {
1953
- throw new Error(`Invalid action input: ${l}`);
1954
- }
1955
- return u;
1956
- }
1957
- function Rr(r, i = ge) {
1958
- return (s, p, f, u) => i(s, p, r, f, u);
1959
- }
1960
- const Lr = (r, i) => ({
1961
- name: "",
1962
- documentType: "",
1963
- revision: {
1964
- global: 0,
1965
- local: 0
1966
- },
1967
- created: (/* @__PURE__ */ new Date()).toISOString(),
1968
- lastModified: (/* @__PURE__ */ new Date()).toISOString(),
1969
- attachments: {},
1970
- ...r,
1971
- state: (i == null ? void 0 : i(r == null ? void 0 : r.state)) ?? (r == null ? void 0 : r.state) ?? { global: {}, local: {} }
1972
- }), zr = (r, i) => {
1973
- const s = Lr(
1974
- r,
1975
- i
1976
- );
1977
- return {
1978
- ...s,
1979
- initialState: s,
1980
- operations: { global: [], local: [] },
1981
- clipboard: []
1982
- };
1983
- }, Ht = (r, i = "global") => Ot(St(r.state[i] || "")), ri = (r, i = 1e3) => {
1984
- const s = Math.random() * i;
1985
- return Ot(`${(r ?? /* @__PURE__ */ new Date()).toISOString()}${s}`);
1986
- };
1987
- function _t(r) {
1988
- return Ne(Me(r, !0));
1989
- }
1990
- function Pr(r, i) {
1991
- const s = [...r];
1992
- let p = i || 0, f = s.length > 0 ? s[s.length - 1].index : 0;
1993
- const u = [];
1994
- for (const l of s.reverse()) {
1995
- if (p > 0) {
1996
- const w = f - l.index;
1997
- p -= w;
1998
- }
1999
- if (p < 0)
2000
- throw new Error("Invalid operation index, missing operations");
2001
- const a = {
2002
- ignore: p > 0,
2003
- operation: l
2004
- }, h = l.skip > 0 ? l.skip + 1 : 0;
2005
- if (h > 0 && h > p) {
2006
- const w = h - p;
2007
- p = p + w;
2008
- }
2009
- f = l.index, u.push(a);
2010
- }
2011
- return u.reverse();
2012
- }
2013
- function qr(r, i, s) {
2014
- const p = r.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
2015
- let f = s, u = 0, l = i;
2016
- for (const a of p.reverse()) {
2017
- const h = l - a.index;
2018
- if (f = f - h, f > -1)
2019
- u++, l = a.index;
2020
- else
2021
- break;
2022
- }
2023
- return u;
2024
- }
2025
- function ii(r) {
2026
- return Object.values(r).flatMap((i) => i).sort(
2027
- (i, s) => new Date(i.timestamp).getTime() - new Date(s.timestamp).getTime()
2028
- );
2029
- }
2030
- function Jr(r) {
2031
- return Object.values(r).flatMap((i) => i).sort(
2032
- (i, s) => new Date(i.operation.timestamp).getTime() - new Date(s.operation.timestamp).getTime()
2033
- );
2034
- }
2035
- function Nt(r, i, s, p, f, u = ge, l = {}, a) {
2036
- const h = Rr(s, u);
2037
- return Fe(
2038
- r,
2039
- i,
2040
- h,
2041
- p,
2042
- f,
2043
- l,
2044
- a
2045
- );
2046
- }
2047
- function Fe(r, i, s, p, f, u = {}, l) {
2048
- const a = (l == null ? void 0 : l.checkHashes) ?? !0, h = zr(r), w = Object.keys(i).reduce((U, L) => {
2049
- const C = L;
2050
- return {
2051
- ...U,
2052
- [C]: Pr(
2053
- i[C],
2054
- u[C]
2055
- )
2056
- };
2057
- }, {}), g = Jr(w), A = g.reduce(
2058
- (U, { ignore: L, operation: C }) => L ? s(U, Zt(C.scope), p, {
2059
- skip: C.skip,
2060
- ignoreSkipOperations: !0
2061
- // TODO: reuse hash?
2062
- }) : s(U, C, p, {
2063
- skip: C.skip,
2064
- ignoreSkipOperations: !0,
2065
- reuseHash: !a
2066
- }),
2067
- h
2068
- );
2069
- if (!a)
2070
- for (const U of Object.keys(A.state))
2071
- for (let L = g.length - 1; L >= 0; L--) {
2072
- const { ignore: C, operation: y } = g[L];
2073
- if (!(C || y.scope !== U)) {
2074
- if (y.hash !== Ht(A, U))
2075
- throw new Error(`Hash mismatch for scope ${U}`);
2076
- break;
2077
- }
2078
- }
2079
- const _ = Object.keys(
2080
- A.operations
2081
- ).reduce(
2082
- (U, L) => {
2083
- const C = L;
2084
- return {
2085
- ...U,
2086
- [C]: [
2087
- ...A.operations[C].map((y, b) => {
2088
- var I;
2089
- return {
2090
- ...y,
2091
- timestamp: ((I = i[C][b]) == null ? void 0 : I.timestamp) ?? y.timestamp
2092
- };
2093
- })
2094
- ]
2095
- };
2096
- },
2097
- { global: [], local: [] }
2098
- ), F = Object.values(_).reduce((U, L) => {
2099
- const C = L[L.length - 1];
2100
- return (C == null ? void 0 : C.timestamp) > U && (U = C.timestamp), U;
2101
- }, r.lastModified);
2102
- return { ...A, operations: _, lastModified: F };
2103
- }
2104
- function ni(r, i) {
2105
- return St(r) === St(i);
2106
- }
2107
- const Be = (r) => ht(
2108
- "SET_NAME",
2109
- r,
2110
- void 0,
2111
- zt,
2112
- void 0
2113
- ), je = (r = 1, i = "global") => ht(
2114
- "UNDO",
2115
- r,
2116
- void 0,
2117
- Pt,
2118
- i
2119
- ), Oe = (r = 1, i = "global") => ht(
2120
- "REDO",
2121
- r,
2122
- void 0,
2123
- Lt,
2124
- i
2125
- ), Ie = (r, i, s = "global") => ht(
2126
- "PRUNE",
2127
- { start: r, end: i },
2128
- void 0,
2129
- Rt,
2130
- s
2131
- ), Kt = (r, i) => ht(
2132
- "LOAD_STATE",
2133
- { state: r, operations: i },
2134
- void 0,
2135
- Mt
2136
- ), Zt = (r = "global") => ht("NOOP", {}, void 0, void 0, r), oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2137
- __proto__: null,
2138
- loadState: Kt,
2139
- noop: Zt,
2140
- prune: Ie,
2141
- redo: Oe,
2142
- setName: Be,
2143
- undo: je
2144
- }, Symbol.toStringTag, { value: "Module" })), Te = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
2145
- Object.freeze(Te);
2146
- var et = function(r, i, s, p) {
2147
- if (s === "a" && !p)
2148
- throw new TypeError("Private accessor was defined without a getter");
2149
- if (typeof i == "function" ? r !== i || !p : !i.has(r))
2150
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
2151
- return s === "m" ? p : s === "a" ? p.call(r) : p ? p.value : i.get(r);
2152
- }, ft, mt, pt;
2153
- class Wr {
2154
- constructor(...i) {
2155
- ft.set(this, /* @__PURE__ */ new Map()), mt.set(this, /* @__PURE__ */ new Map()), pt.set(this, /* @__PURE__ */ new Map());
2156
- for (const s of i)
2157
- this.define(s);
2158
- }
2159
- define(i, s = !1) {
2160
- for (let [p, f] of Object.entries(i)) {
2161
- p = p.toLowerCase(), f = f.map((a) => a.toLowerCase()), et(this, pt, "f").has(p) || et(this, pt, "f").set(p, /* @__PURE__ */ new Set());
2162
- const u = et(this, pt, "f").get(p);
2163
- let l = !0;
2164
- for (let a of f) {
2165
- const h = a.startsWith("*");
2166
- if (a = h ? a.slice(1) : a, u == null || u.add(a), l && et(this, mt, "f").set(p, a), l = !1, h)
2167
- continue;
2168
- const w = et(this, ft, "f").get(a);
2169
- if (w && w != p && !s)
2170
- throw new Error(`"${p} -> ${a}" conflicts with "${w} -> ${a}". Pass \`force=true\` to override this definition.`);
2171
- et(this, ft, "f").set(a, p);
2172
- }
2173
- }
2174
- return this;
2175
- }
2176
- getType(i) {
2177
- if (typeof i != "string")
2178
- return null;
2179
- const s = i.replace(/^.*[/\\]/, "").toLowerCase(), p = s.replace(/^.*\./, "").toLowerCase(), f = s.length < i.length;
2180
- return !(p.length < s.length - 1) && f ? null : et(this, ft, "f").get(p) ?? null;
2181
- }
2182
- getExtension(i) {
2183
- var s;
2184
- return typeof i != "string" ? null : (i = (s = i == null ? void 0 : i.split) == null ? void 0 : s.call(i, ";")[0], (i && et(this, mt, "f").get(i.trim().toLowerCase())) ?? null);
2185
- }
2186
- getAllExtensions(i) {
2187
- return typeof i != "string" ? null : et(this, pt, "f").get(i.toLowerCase()) ?? null;
2188
- }
2189
- _freeze() {
2190
- this.define = () => {
2191
- throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
2192
- }, Object.freeze(this);
2193
- for (const i of et(this, pt, "f").values())
2194
- Object.freeze(i);
2195
- return this;
2196
- }
2197
- _getTestState() {
2198
- return {
2199
- types: et(this, ft, "f"),
2200
- extensions: et(this, mt, "f")
2201
- };
2202
- }
2203
- }
2204
- ft = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap();
2205
- const Vr = new Wr(Te)._freeze();
2206
- function Hr(r) {
2207
- const i = [], s = Object.keys(r);
2208
- for (const p of s) {
2209
- const f = r[p].sort((u, l) => u.index - l.index);
2210
- for (let u = 0; u < f.length; u++)
2211
- f[u].index !== u && i.push({
2212
- message: `Invalid operation index ${f[u].index} at position ${u}`,
2213
- details: {
2214
- position: u,
2215
- operation: f[u],
2216
- scope: f[u].scope
2217
- }
2218
- });
2219
- }
2220
- return i;
2221
- }
2222
- const ke = async (r) => {
2223
- const i = new ee(), { name: s, revision: p, documentType: f, created: u, lastModified: l } = r, a = {
2224
- name: s,
2225
- revision: p,
2226
- documentType: f,
2227
- created: u,
2228
- lastModified: l
2229
- };
2230
- return i.file("header.json", JSON.stringify(a, null, 2)), i.file(
2231
- "state.json",
2232
- JSON.stringify(r.initialState || {}, null, 2)
2233
- ), i.file("operations.json", JSON.stringify(r.operations, null, 2)), Object.keys(r.attachments).forEach((w) => {
2234
- const { data: g, ...A } = r.attachments[w];
2235
- i.file(w, g, {
2236
- base64: !0,
2237
- createFolders: !0,
2238
- comment: JSON.stringify(A)
2239
- });
2240
- }), i;
2241
- }, Kr = async (r, i, s, p) => {
2242
- await (await ke(r)).generateAsync({
2243
- type: "uint8array",
2244
- streamFiles: !0
2245
- });
2246
- const u = p ?? r.name, l = `.${s}.zip`;
2247
- return $r(
2248
- i,
2249
- u.endsWith(l) ? u : `${u}${l}`
2250
- );
2251
- }, ai = async (r, i) => {
2252
- const p = await (await ke(r)).generateAsync({ type: "blob" }), f = await i.createWritable();
2253
- await f.write(p), await f.close();
2254
- }, te = async (r, i, s) => {
2255
- const p = Se();
2256
- return Zr(p, i, s);
2257
- }, Zr = async (r, i, s) => {
2258
- const p = new ee();
2259
- return await p.loadAsync(r), Gr(p, i, s);
2260
- };
2261
- async function Gr(r, i, s) {
2262
- const p = r.file("state.json");
2263
- if (!p)
2264
- throw new Error("Initial state not found");
2265
- const f = await p.async("string"), u = JSON.parse(f), l = r.file("header.json");
2266
- let a;
2267
- l && (a = JSON.parse(await l.async("string")));
2268
- const h = r.file("operations.json");
2269
- if (!h)
2270
- throw new Error("Operations history not found");
2271
- const w = JSON.parse(
2272
- await h.async("string")
2273
- ), g = Hr(w);
2274
- if (g.length) {
2275
- const _ = g.map((F) => F.message);
2276
- throw new Error(_.join(`
2277
- `));
2278
- }
2279
- let A = Fe(
2280
- u,
2281
- w,
2282
- i,
2283
- void 0,
2284
- a,
2285
- {},
2286
- s
2287
- );
2288
- return a && (A = {
2289
- ...A,
2290
- ...a
2291
- }), A;
2292
- }
2293
- function Ue(r) {
2294
- const i = r.replace(/^.*\./, "") || void 0, s = r.replace(/^.*[/\\]/, "") || void 0;
2295
- return { extension: i, fileName: s };
2296
- }
2297
- async function si(r) {
2298
- const { buffer: i, mimeType: s = "application/octet-stream" } = await Dr(), p = Ue(r), f = i.toString("base64");
2299
- return {
2300
- data: f,
2301
- hash: Ot(f),
2302
- mimeType: s,
2303
- ...p
2304
- };
2305
- }
2306
- async function pi(r) {
2307
- const i = await Cr(), s = Vr.getType(r) || "application/octet-stream", p = Ue(r), f = i.toString("base64");
2308
- return { data: f, hash: Ot(f), mimeType: s, ...p };
2309
- }
2310
- class ci {
2311
- /**
2312
- * Constructs a BaseDocument instance with an initial state.
2313
- * @param reducer - The reducer function that updates the state.
2314
- * @param document - The initial state of the document.
2315
- */
2316
- constructor(i, s, p) {
2317
- At(this, "_document");
2318
- At(this, "_reducer");
2319
- At(this, "_signalDispatch");
2320
- this._reducer = i, this._document = s, this._signalDispatch = p;
2321
- }
2322
- /**
2323
- * Dispatches an action to update the state of the document.
2324
- * @param action - The action to dispatch.
2325
- * @returns The Document instance.
2326
- */
2327
- dispatch(i, s) {
2328
- return this._document = this._reducer(
2329
- this._document,
2330
- i,
2331
- this._signalDispatch,
2332
- s
2333
- ), this;
2334
- }
2335
- /**
2336
- * Saves the state of the document to a file.
2337
- * @param path - The file path where the state should be saved.
2338
- * @param extension - The file extension to use when saving the state.
2339
- * @returns The file path where the state was saved.
2340
- */
2341
- saveToFile(i, s, p) {
2342
- return Kr(this._document, i, s, p);
2343
- }
2344
- /**
2345
- * Loads the state of the document from a file.
2346
- * @param path - The file path where the state is stored.
2347
- */
2348
- async loadFromFile(i) {
2349
- this._document = await te(i, this._reducer);
2350
- }
2351
- /**
2352
- * Loads the state of the document from a file and returns it.
2353
- * @param path - The file path where the state is stored.
2354
- * @param reducer - The reducer function that updates the state.
2355
- * @returns The state of the document.
2356
- */
2357
- static async stateFromFile(i, s) {
2358
- return await te(i, s);
2359
- }
2360
- /**
2361
- * Gets the current state of the document.
2362
- */
2363
- get state() {
2364
- return _t(this._document.state);
2365
- }
2366
- /**
2367
- * Gets the list of operations performed on the document.
2368
- */
2369
- get operations() {
2370
- return _t(this._document.operations);
2371
- }
2372
- /**
2373
- * Gets the name of the document.
2374
- */
2375
- get name() {
2376
- return this._document.name;
2377
- }
2378
- /**
2379
- * Gets the type of document.
2380
- */
2381
- get documentType() {
2382
- return this._document.documentType;
2383
- }
2384
- /**
2385
- * Gets the timestamp of the date the document was created.
2386
- */
2387
- get created() {
2388
- return this._document.created;
2389
- }
2390
- /**
2391
- * Gets the timestamp of the date the document was last modified.
2392
- */
2393
- get lastModified() {
2394
- return this._document.lastModified;
2395
- }
2396
- /**
2397
- * Gets the global revision number of the document.
2398
- */
2399
- get revision() {
2400
- return this._document.revision.global;
2401
- }
2402
- getRevision(i) {
2403
- return this._document.revision[i];
2404
- }
2405
- /**
2406
- * Gets the initial state of the document.
2407
- */
2408
- get initialState() {
2409
- return _t(this._document.initialState);
2410
- }
2411
- /**
2412
- * Returns the current document as an object
2413
- */
2414
- toDocument() {
2415
- return _t(this._document);
2416
- }
2417
- /**
2418
- * Gets the attachment associated with the given key.
2419
- * @param attachment - The key of the attachment to retrieve.
2420
- */
2421
- getAttachment(i) {
2422
- return this._document.attachments[i];
2423
- }
2424
- /**
2425
- * Sets the name of the document.
2426
- * @param name - The new name of the document.
2427
- */
2428
- setName(i) {
2429
- return this.dispatch(Be(i)), this;
2430
- }
2431
- /**
2432
- * Reverts a number of actions from the document.
2433
- * @param count - The number of actions to revert.
2434
- */
2435
- undo(i) {
2436
- return this.dispatch(je(i)), this;
2437
- }
2438
- /**
2439
- * Reapplies a number of actions to the document.
2440
- * @param count - The number of actions to reapply.
2441
- */
2442
- redo(i) {
2443
- return this.dispatch(Oe(i)), this;
2444
- }
2445
- /**
2446
- * Removes a range of operations from the document.
2447
- * @param start - The starting index of the range to remove.
2448
- * @param end - The ending index of the range to remove.
2449
- */
2450
- prune(i, s) {
2451
- return this.dispatch(Ie(i, s)), this;
2452
- }
2453
- /**
2454
- * Loads a document state and a set of operations.
2455
- * @param state - The state to load.
2456
- * @param operations - The operations to apply to the document.
2457
- */
2458
- loadState(i, s) {
2459
- return this.dispatch(Kt(i, s)), this;
2460
- }
2461
- }
2462
- function li(r, i) {
2463
- i.forEach((s) => {
2464
- Object.getOwnPropertyNames(s.prototype).forEach((p) => {
2465
- Object.defineProperty(
2466
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2467
- r.prototype,
2468
- p,
2469
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
2470
- Object.getOwnPropertyDescriptor(s.prototype, p) || /* @__PURE__ */ Object.create(null)
2471
- );
2472
- });
2473
- });
2474
- }
2475
- export {
2476
- Hr as A,
2477
- ci as B,
2478
- ge as C,
2479
- ir as D,
2480
- ei as E,
2481
- Lr as a,
2482
- zr as b,
2483
- Rr as c,
2484
- ai as d,
2485
- Zr as e,
2486
- ht as f,
2487
- li as g,
2488
- oi as h,
2489
- Qt as i,
2490
- qr as j,
2491
- ke as k,
2492
- te as l,
2493
- pi as m,
2494
- si as n,
2495
- Ht as o,
2496
- ri as p,
2497
- Mr as q,
2498
- ni as r,
2499
- Kr as s,
2500
- Xt as t,
2501
- Pr as u,
2502
- _t as v,
2503
- Fe as w,
2504
- Nt as x,
2505
- Jr as y,
2506
- ii as z
2507
- };