@orangelogic/design-system 2.0.0-29DUO2-beta-3 → 2.0.0-29IORR-beta-2

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 (307) hide show
  1. package/library/chunks/{AxisLabelRadial.CgPb7ghO.js → AxisLabelRadial.Bs1P_q_F.js} +1 -1
  2. package/library/chunks/{BaseColumnSeries.B6rG-Ylz.js → BaseColumnSeries.C7jwOxIJ.js} +1 -1
  3. package/library/chunks/{CandlestickSeries.C-YfO-57.js → CandlestickSeries.CkXGtRWE.js} +2 -2
  4. package/library/chunks/{Circle.DhoXSsjo.js → Circle.DBa5Ok8V.js} +1 -1
  5. package/library/chunks/{ColumnSeries.CZi2LBZ2.js → ColumnSeries.DGazbfza.js} +2 -2
  6. package/library/chunks/{EditableAxisLabel.CykTMTsG.js → EditableAxisLabel.wN0t_G2B.js} +2 -2
  7. package/library/chunks/{EditableLabel.BlQ7B4D0.js → EditableLabel.BWeq6fgX.js} +1 -1
  8. package/library/chunks/{Gradient.BQ0JzFEe.js → Gradient.CdcsPIru.js} +1 -1
  9. package/library/chunks/{LinearGradient.DuVS2EHe.js → LinearGradient.B1z9AGUt.js} +2 -2
  10. package/library/chunks/{Picture.DRO0jnR6.js → Picture.YSPC0l0Q.js} +1 -1
  11. package/library/chunks/{Polygon.DEO3f_qs.js → Polygon.BwMvXN2H.js} +1 -1
  12. package/library/chunks/{ProgressPie.Bryx2w1J.js → ProgressPie.DlCwXN17.js} +5 -5
  13. package/library/chunks/{RadialLabel.TyXECvYG.js → RadialLabel.DyVOf2K8.js} +1 -1
  14. package/library/chunks/{Scrollbar.DK48nKk4.js → Scrollbar.BdZVb_Z-.js} +1 -1
  15. package/library/chunks/{Slice.DbXRplXx.js → Slice.DiEswWa6.js} +1 -1
  16. package/library/chunks/{Slider.B27osQYu.js → Slider.C20No2z5.js} +1 -1
  17. package/library/chunks/{SpriteResizer.C4wFzD_x.js → SpriteResizer.DFnmcy0h.js} +1 -1
  18. package/library/chunks/{Triangle.BEmFiHyd.js → Triangle.BaOef7HV.js} +1 -1
  19. package/library/chunks/{ZoomTools.CBqjLDqb.js → ZoomTools.D5JPehoL.js} +1 -1
  20. package/library/chunks/{_baseUniq.Df-fLIBx.js → _baseUniq.BUihBa8c.js} +56 -53
  21. package/library/chunks/{am-chart.B_OdX4Q-.js → am-chart.H2jnOzFc.js} +254 -262
  22. package/library/chunks/{animation.DfUHRQry.js → animation.7ifl4x2S.js} +4 -8
  23. package/library/chunks/array.DCtvHiLS.js +81 -0
  24. package/library/chunks/asset.D7E0-cUV.js +460 -0
  25. package/library/chunks/{button.KnE3mcyM.js → button.CauAHfdl.js} +10 -45
  26. package/library/chunks/button.styles.CKqn956w.js +5 -0
  27. package/library/chunks/{capitalize.WSkCXkNE.js → capitalize.CNStXZBq.js} +1 -1
  28. package/library/chunks/{color-swatch-group.p3Sdqlat.js → color-swatch-group.D5BP2W3P.js} +50 -220
  29. package/library/chunks/{color-swatch.C0oPHfOu.js → color-swatch.2HS4bc3N.js} +20 -204
  30. package/library/chunks/{colorPicker.CJwbdhtn.js → colorPicker.06n6P3aK.js} +5 -5
  31. package/library/chunks/component.styles.CRO4Odto.js +5 -0
  32. package/library/chunks/confirm-popover.DmGAMS8X.js +121 -0
  33. package/library/chunks/{cropper.tSDgXKqJ.js → cropper.ZU2Dy-MM.js} +8182 -8540
  34. package/library/chunks/{dialog.DpZBbTCn.js → dialog.2UW1LNm1.js} +117 -314
  35. package/library/chunks/{dom.BQVKDNd8.js → dom.BslZF2Y_.js} +1 -1
  36. package/library/chunks/dot-pagination.DsAfSNzr.js +204 -0
  37. package/library/chunks/{endpoints.B7lcoc1N.js → endpoints.Fpyb8xvv.js} +214 -203
  38. package/library/chunks/{exporting.DCqJtW6l.js → exporting.Chnl3UWi.js} +2 -2
  39. package/library/chunks/file-on-demand.Dig_iVvx.js +1956 -0
  40. package/library/chunks/{flow.Ch1rU01m.js → flow.D2CqFQa7.js} +5 -5
  41. package/library/chunks/folder-select.BT1drT8C.js +775 -0
  42. package/library/chunks/form-control.styles.CaGWmeAS.js +5 -0
  43. package/library/chunks/{form.DgwYWi0O.js → form.CFc09rKh.js} +1 -1
  44. package/library/chunks/{gantt.rWdF_jmG.js → gantt.DSHD2gjO.js} +8 -8
  45. package/library/chunks/header.BePZwMCQ.js +170 -0
  46. package/library/chunks/{hierarchy.HoRJAu6S.js → hierarchy.DwVsMmsP.js} +5 -5
  47. package/library/chunks/{hub-connection.CfARlehM.js → hub-connection.Ot2odiCz.js} +1 -1
  48. package/library/chunks/{i18n.C0iakJkV.js → i18n.BFqTRDCA.js} +19 -12
  49. package/library/chunks/icon-button.rKe0N4VB.js +149 -0
  50. package/library/chunks/iframe.DznmlYpV.js +73 -0
  51. package/library/chunks/{image.C9avagDq.js → image.CEtCGsNL.js} +275 -488
  52. package/library/chunks/{index.D2JPKXqq.js → index.C9khsiad.js} +17 -17
  53. package/library/chunks/isObjectLike.z36Fu426.js +34 -0
  54. package/library/chunks/{isSymbol.huJ_Cvxt.js → isSymbol.L0C2ND_U.js} +1 -1
  55. package/library/chunks/{json.DHNMAC-m.js → json.zyETMOw-.js} +3 -3
  56. package/library/chunks/{list-editor.B2mFE9f7.js → list-editor.CJ96S1Np.js} +58 -372
  57. package/library/chunks/{map.BHmZ4Crx.js → map.CqM2O6LB.js} +2 -2
  58. package/library/chunks/option.COnEtd3X.js +123 -0
  59. package/library/chunks/{overlayscrollbars.XhGWx9Zk.js → overlayscrollbars.BMav4RQ4.js} +252 -958
  60. package/library/chunks/pagination.DaD9Yul6.js +334 -0
  61. package/library/chunks/{percent.CM9cr1H3.js → percent.DuQwbCCg.js} +3 -3
  62. package/library/chunks/{radar.CQUnnhGk.js → radar.FpYl3UH5.js} +4 -4
  63. package/library/chunks/{responsive.CrX-HUow.js → responsive.BndCeSg0.js} +1 -1
  64. package/library/chunks/{sliceGrouper.iv1p8MAK.js → sliceGrouper.BsE7fGMt.js} +1 -1
  65. package/library/chunks/{stock.CU0y6a5P.js → stock.BR-ag4Pt.js} +9 -9
  66. package/library/chunks/string.BigZhczf.js +185 -0
  67. package/library/chunks/{tab-group.05PY0smt.js → tab-group.0Po0eoxR.js} +33 -584
  68. package/library/chunks/{table.DNTm_GMS.js → table.WNd284in.js} +3535 -4852
  69. package/library/chunks/{timeline.yzdwtGKM.js → timeline.DkzkmgEM.js} +5 -5
  70. package/library/chunks/{toString.CRT5zqEU.js → toString.CL_lYXbK.js} +3 -3
  71. package/library/chunks/toast.B2cJgW5u.js +71 -0
  72. package/library/chunks/transformation.CzBptarI.js +140 -0
  73. package/library/chunks/{tree.CeMLCbs-.js → tree.QCQd_cuc.js} +32 -400
  74. package/library/chunks/typography.DJC_UXgs.js +52 -0
  75. package/library/chunks/url.Cj9cIQXJ.js +27 -0
  76. package/library/chunks/{venn.BOEi13la.js → venn.D739bOV3.js} +1 -1
  77. package/library/chunks/watch.BCJD77bD.js +547 -0
  78. package/library/chunks/{wc.V-lq02JF.js → wc.DzW311D-.js} +1 -1
  79. package/library/chunks/{xy.Df1hy9ac.js → xy.DCRDfTsa.js} +10 -10
  80. package/library/components/alert.js +11 -179
  81. package/library/components/am-chart.js +3 -3
  82. package/library/components/animated-image.js +13 -101
  83. package/library/components/animation.js +3 -3
  84. package/library/components/array-line-clamp.js +8 -89
  85. package/library/components/asset-link-format.js +718 -1380
  86. package/library/components/atoms.js +18 -18
  87. package/library/components/avatar.js +6 -95
  88. package/library/components/badge.js +11 -139
  89. package/library/components/bicolor-picker.js +4 -23
  90. package/library/components/border-input-group.js +5 -26
  91. package/library/components/breadcrumb-item.js +25 -156
  92. package/library/components/breadcrumb.js +4 -22
  93. package/library/components/button-group.js +3 -28
  94. package/library/components/button.js +6 -6
  95. package/library/components/card.js +4 -126
  96. package/library/components/checkbox.js +13 -254
  97. package/library/components/color-picker.js +57 -728
  98. package/library/components/color-swatch-group.js +9 -9
  99. package/library/components/color-swatch.js +5 -5
  100. package/library/components/confirm-popover.js +6 -6
  101. package/library/components/copy-button.js +11 -256
  102. package/library/components/corner-position-input-group.js +5 -58
  103. package/library/components/cropper.js +2 -2
  104. package/library/components/details.js +6 -152
  105. package/library/components/dialog.js +6 -6
  106. package/library/components/divider.js +6 -68
  107. package/library/components/dot-pagination.js +4 -4
  108. package/library/components/dot-status.js +25 -95
  109. package/library/components/drawer.js +11 -242
  110. package/library/components/dropdown.js +49 -151
  111. package/library/components/dynamic-select.js +10 -75
  112. package/library/components/e-chart.js +8 -51
  113. package/library/components/element-clamp.js +7 -80
  114. package/library/components/file-on-demand.js +13 -13
  115. package/library/components/folder-select.js +9 -7
  116. package/library/components/format-bytes.js +1 -1
  117. package/library/components/format-date.js +3 -7
  118. package/library/components/format-number.js +1 -1
  119. package/library/components/format-time.js +4 -14
  120. package/library/components/grid-item.js +5 -172
  121. package/library/components/grid.js +5 -41
  122. package/library/components/header.js +4 -4
  123. package/library/components/hub-connection.js +2 -2
  124. package/library/components/icon-button.js +14 -679
  125. package/library/components/icon.js +9 -2449
  126. package/library/components/iframe.js +4 -4
  127. package/library/components/image-comparer.js +9 -129
  128. package/library/components/image.js +4 -4
  129. package/library/components/include.js +3 -7
  130. package/library/components/input-group.js +4 -29
  131. package/library/components/input.js +358 -966
  132. package/library/components/line-clamp.js +7 -83
  133. package/library/components/list-editor.js +9 -9
  134. package/library/components/markdown.js +2 -4
  135. package/library/components/masonry.js +24 -223
  136. package/library/components/menu-item.js +155 -445
  137. package/library/components/menu-label.js +3 -20
  138. package/library/components/menu-section.js +3 -17
  139. package/library/components/menu.js +5 -113
  140. package/library/components/molecules.js +5 -5
  141. package/library/components/mutation-observer.js +3 -7
  142. package/library/components/option.js +4 -4
  143. package/library/components/organisms.js +2 -2
  144. package/library/components/padding-input-group.js +5 -16
  145. package/library/components/pagination.js +10 -8
  146. package/library/components/popup.js +385 -682
  147. package/library/components/position-picker.js +4 -94
  148. package/library/components/progress-bar.js +19 -136
  149. package/library/components/progress-ring.js +4 -95
  150. package/library/components/qr-code.js +5 -17
  151. package/library/components/radio-button.js +5 -25
  152. package/library/components/radio-card.js +8 -176
  153. package/library/components/radio-group.js +22 -153
  154. package/library/components/radio.js +14 -171
  155. package/library/components/range.js +123 -660
  156. package/library/components/rating.js +58 -238
  157. package/library/components/relative-time.js +3 -13
  158. package/library/components/resize-observer.js +4 -8
  159. package/library/components/select.js +305 -1012
  160. package/library/components/shadow-input-group.js +5 -24
  161. package/library/components/share-option-list.js +21 -313
  162. package/library/components/sidebar.js +15 -221
  163. package/library/components/size-input-group.js +12 -77
  164. package/library/components/skeleton.js +7 -80
  165. package/library/components/space.js +6 -143
  166. package/library/components/spinner.js +7 -76
  167. package/library/components/split-panel.js +18 -125
  168. package/library/components/step.js +21 -272
  169. package/library/components/stepper-wizard.js +9 -43
  170. package/library/components/stepper.js +17 -34
  171. package/library/components/switch.js +13 -276
  172. package/library/components/tab-group.js +7 -7
  173. package/library/components/tab-panel.js +5 -32
  174. package/library/components/tab.js +11 -257
  175. package/library/components/table.js +8 -8
  176. package/library/components/tag.js +15 -166
  177. package/library/components/textarea.js +183 -504
  178. package/library/components/timecode.js +6 -25
  179. package/library/components/tooltip.js +10 -94
  180. package/library/components/tree-item.js +4 -4
  181. package/library/components/tree.js +4 -4
  182. package/library/components/typeface.js +24 -123
  183. package/library/components/types.js +37225 -47339
  184. package/library/components/typography.js +2 -2
  185. package/library/components/video.js +3875 -6263
  186. package/library/components/visually-hidden.js +3 -15
  187. package/library/package.json +4 -1
  188. package/library/packages/atoms/src/components/dialog/dialog.d.ts +10 -0
  189. package/library/packages/atoms/src/components/icon-button/icon-button.d.ts +2 -1
  190. package/library/packages/atoms/src/components/image/image.d.ts +15 -1
  191. package/library/packages/atoms/src/components/input/auto-grow-controller.d.ts +23 -0
  192. package/library/packages/atoms/src/components/input/input.d.ts +10 -2
  193. package/library/packages/atoms/src/components/menu-item/menu-item.d.ts +4 -0
  194. package/library/packages/atoms/src/components/pagination/pagination.d.ts +32 -2
  195. package/library/packages/atoms/src/components/popup/overlay/Overlay.d.ts +10 -0
  196. package/library/packages/atoms/src/components/popup/popup.d.ts +1 -1
  197. package/library/packages/atoms/src/components/select/select.d.ts +11 -0
  198. package/library/packages/atoms/src/components/table/table.d.ts +49 -8
  199. package/library/packages/atoms/src/components/table/tabulator-tables/core/Tabulator.d.ts +1 -0
  200. package/library/packages/atoms/src/components/table/tabulator-tables/core/TabulatorFull.d.ts +1 -0
  201. package/library/packages/atoms/src/components/table/tabulator-tables/core/tools/DataLoader.d.ts +3 -1
  202. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Ajax/Ajax.d.ts +1 -1
  203. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Edit/Edit.d.ts +1 -0
  204. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Edit/List.d.ts +40 -1
  205. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Filter/Filter.d.ts +10 -3
  206. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Filter/formatter-display-resolvers.d.ts +93 -0
  207. package/library/packages/atoms/src/components/table/tabulator-tables/modules/GroupRows/Group.d.ts +8 -0
  208. package/library/packages/atoms/src/components/table/tabulator-tables/modules/GroupRows/GroupComponent.d.ts +3 -1
  209. package/library/packages/atoms/src/components/table/tabulator-tables/modules/GroupRows/GroupLoadMore.d.ts +7 -0
  210. package/library/packages/atoms/src/components/table/tabulator-tables/modules/GroupRows/GroupRows.d.ts +2 -0
  211. package/library/packages/atoms/src/components/table/tabulator-tables/modules/Page/Page.d.ts +2 -2
  212. package/library/packages/atoms/src/components/textarea/textarea.d.ts +19 -4
  213. package/library/packages/atoms/src/components/video/video.d.ts +3 -1
  214. package/library/packages/events/src/cx-asset-transformation-dialog-cancel.d.ts +6 -0
  215. package/library/packages/events/src/cx-asset-transformation-dialog-confirm.d.ts +11 -0
  216. package/library/packages/events/src/cx-asset-transformation-dialog-delete.d.ts +6 -0
  217. package/library/packages/events/src/cx-bento-range-change.d.ts +9 -0
  218. package/library/packages/events/src/cx-content-builder-gallery-fetched.d.ts +10 -0
  219. package/library/packages/events/src/cx-lightbox-close.d.ts +6 -0
  220. package/library/packages/events/src/cx-lightbox-download.d.ts +11 -0
  221. package/library/packages/events/src/cx-unauthorized.d.ts +10 -0
  222. package/library/packages/events/src/cx-video-format-picker-delete.d.ts +6 -0
  223. package/library/packages/events/src/cx-video-format-picker-select.d.ts +8 -0
  224. package/library/packages/events/src/events.d.ts +11 -1
  225. package/library/packages/molecules/src/cropper/cropper.d.ts +2 -0
  226. package/library/packages/molecules/src/cropper/react/Cropper.d.ts +2 -0
  227. package/library/packages/molecules/src/estimated-reading-time/estimated-reading-time.d.ts +3 -2
  228. package/library/packages/molecules/src/folder-select/components/folder-select-tree/folder-select-tree.d.ts +26 -0
  229. package/library/packages/molecules/src/folder-select/components/folder-select-tree-item/folder-select-tree-item.d.ts +46 -0
  230. package/library/packages/molecules/src/folder-select/folder-select.d.ts +25 -0
  231. package/library/packages/molecules/src/index.d.ts +1 -0
  232. package/library/packages/molecules/src/storybook/storybook.d.ts +60 -23
  233. package/library/packages/molecules/src/timeline/timeline.d.ts +14 -0
  234. package/library/packages/molecules/src/video-format-picker/video-format-picker.d.ts +55 -0
  235. package/library/packages/molecules/src/video-format-picker/video-format-picker.styles.d.ts +2 -0
  236. package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +9 -1
  237. package/library/packages/organisms/src/asset-link-format/components/asset-link-format-rotation/asset-link-format-rotation.d.ts +7 -7
  238. package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.d.ts +95 -0
  239. package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.styles.d.ts +2 -0
  240. package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +57 -26
  241. package/library/packages/organisms/src/bento-grid/bento-layout.d.ts +44 -0
  242. package/library/packages/organisms/src/carousel/carousel.d.ts +5 -1
  243. package/library/packages/organisms/src/comment/comment.d.ts +1 -0
  244. package/library/packages/organisms/src/content-builder/components/block-picker/block-picker.d.ts +7 -0
  245. package/library/packages/organisms/src/content-builder/components/config-form/config-form.d.ts +11 -0
  246. package/library/packages/organisms/src/content-builder/components/config-manager/config-manager.d.ts +10 -0
  247. package/library/packages/organisms/src/content-builder/components/folder-picker/folder-picker.d.ts +6 -0
  248. package/library/packages/organisms/src/content-builder/configs/carousel.d.ts +6 -2
  249. package/library/packages/organisms/src/content-builder/configs/gallery.d.ts +6 -2
  250. package/library/packages/organisms/src/content-builder/configs/image.d.ts +7 -4
  251. package/library/packages/organisms/src/content-builder/configs/timeline.d.ts +5 -2
  252. package/library/packages/organisms/src/content-builder/configs/video.d.ts +11 -2
  253. package/library/packages/organisms/src/content-builder/configs-controller.d.ts +45 -4
  254. package/library/packages/organisms/src/content-builder/content-builder.d.ts +13 -0
  255. package/library/packages/organisms/src/content-builder/plugins/gallery.d.ts +45 -1
  256. package/library/packages/organisms/src/content-builder/styleController.d.ts +20 -2
  257. package/library/packages/organisms/src/index.d.ts +2 -0
  258. package/library/packages/organisms/src/lightbox/lightbox.d.ts +79 -0
  259. package/library/packages/organisms/src/lightbox/lightbox.styles.d.ts +2 -0
  260. package/library/packages/services/src/api/asset/asset.d.ts +3 -2
  261. package/library/packages/services/src/api/asset/asset.types.d.ts +84 -0
  262. package/library/packages/services/src/api/asset/asset.utils.d.ts +9 -0
  263. package/library/packages/services/src/api/endpoints.d.ts +1 -1
  264. package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +2 -1
  265. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +17 -5
  266. package/library/packages/types/src/asset-click-action.d.ts +3 -1
  267. package/library/packages/types/src/bento-grid.d.ts +37 -0
  268. package/library/packages/types/src/content-builder.d.ts +27 -1
  269. package/library/packages/types/src/gallery.d.ts +0 -6
  270. package/library/packages/types/src/icon-button.d.ts +7 -0
  271. package/library/packages/types/src/menu-item.d.ts +33 -0
  272. package/library/packages/types/src/storybook.d.ts +19 -0
  273. package/library/packages/types/src/table.d.ts +37 -1
  274. package/library/packages/types/src/textarea.d.ts +4 -0
  275. package/library/packages/types/src/video-format-picker.d.ts +11 -0
  276. package/library/packages/utils/src/actions/asset-click.d.ts +1 -3
  277. package/library/packages/utils/src/custom-element/i18n.d.ts +10 -3
  278. package/library/packages/utils/src/index.d.ts +1 -0
  279. package/library/packages/utils/src/string/string.d.ts +33 -0
  280. package/library/packages/utils/src/transformation/index.d.ts +1 -0
  281. package/library/packages/utils/src/url/url.d.ts +9 -0
  282. package/library/react-web-component.d.ts +293 -29
  283. package/library/utils.js +483 -178
  284. package/package.json +4 -1
  285. package/library/chunks/_baseRest.ClTMQtN1.js +0 -67
  286. package/library/chunks/asset.CG_yXtWK.js +0 -288
  287. package/library/chunks/button.styles.Dl5IQLHU.js +0 -718
  288. package/library/chunks/component.styles.DMSLciL5.js +0 -71
  289. package/library/chunks/confirm-popover.zmOFI4e-.js +0 -288
  290. package/library/chunks/content-builder.D_phDrlo.js +0 -127
  291. package/library/chunks/dot-pagination.COBkyhoJ.js +0 -325
  292. package/library/chunks/file-on-demand.CbE-qsiP.js +0 -3740
  293. package/library/chunks/folder-select.Bl_WkhVE.js +0 -844
  294. package/library/chunks/form-control.styles.CUGhvlfT.js +0 -67
  295. package/library/chunks/header.BduX6KJP.js +0 -777
  296. package/library/chunks/identity.ByMq8VxU.js +0 -6
  297. package/library/chunks/iframe.BPKV2K7z.js +0 -160
  298. package/library/chunks/index.B3wJT3XS.js +0 -373
  299. package/library/chunks/isObjectLike.D3cpZO39.js +0 -81
  300. package/library/chunks/option.DnpkE8Xi.js +0 -296
  301. package/library/chunks/pagination.C30LoTya.js +0 -341
  302. package/library/chunks/string.B_rEG27K.js +0 -160
  303. package/library/chunks/toast.BXNbwZV8.js +0 -25
  304. package/library/chunks/typography.oDzoLbZS.js +0 -149
  305. package/library/chunks/url.LjsR2sB5.js +0 -15
  306. package/library/chunks/watch.q1sEjPWL.js +0 -501
  307. /package/library/packages/{organisms/src/asset-link-format/asset-link-format.utils.d.ts → utils/src/transformation/transformation.d.ts} +0 -0
@@ -1,3740 +0,0 @@
1
- import J from "../components/icon.js";
2
- import Q from "../components/line-clamp.js";
3
- import { C as ft, s as vt, a as yt, b as lt } from "./tree.CeMLCbs-.js";
4
- import { n as d, C as H } from "./lib-cortex-element.CVMmyPMC.js";
5
- import { c as tt } from "./component.styles.DMSLciL5.js";
6
- import { c as W } from "./custom-element.L4WJXn1j.js";
7
- import { L as q } from "./i18n.C0iakJkV.js";
8
- import { k as Dt, a as bt, i as $t, w as P, S as Tt, b as Pt, c as zt, d as Et, e as Lt, f as Ft } from "./watch.q1sEjPWL.js";
9
- import { p as R } from "./string.B_rEG27K.js";
10
- import { x as o, i as at, E as Ut } from "./lit-element.jLBm65_O.js";
11
- import { r as u } from "./state.CSDxrqLd.js";
12
- import { e as z } from "./query.BBf1UFkC.js";
13
- import { e as C } from "./class-map.BiVq-cVR.js";
14
- import { c as U } from "./repeat.DbF2p5ae.js";
15
- import { n as p } from "./when.Dr1es41R.js";
16
- import { a as Rt, c as kt, b as dt } from "./_baseUniq.Df-fLIBx.js";
17
- import Ot from "../components/avatar.js";
18
- import { C as Nt } from "./button.KnE3mcyM.js";
19
- import { C as jt } from "./dialog.DpZBbTCn.js";
20
- import Bt from "../components/divider.js";
21
- import ot from "../components/format-bytes.js";
22
- import It from "../components/icon-button.js";
23
- import Mt from "../components/input.js";
24
- import { C as Vt } from "./option.DnpkE8Xi.js";
25
- import St from "../components/relative-time.js";
26
- import Ht from "../components/select.js";
27
- import Wt from "../components/space.js";
28
- import qt from "../components/tab.js";
29
- import { C as Gt } from "./tab-group.05PY0smt.js";
30
- import Yt from "../components/tab-panel.js";
31
- import wt from "../components/tooltip.js";
32
- import { C as nt } from "./typography.oDzoLbZS.js";
33
- import { C as Kt } from "./confirm-popover.zmOFI4e-.js";
34
- import { d as Xt } from "./debounce.DaHuiSGU.js";
35
- import { a as et } from "./number.CjNxU7Xs.js";
36
- import { i as K, a as ht } from "./url.LjsR2sB5.js";
37
- import { b as Zt } from "./_baseRest.ClTMQtN1.js";
38
- import { a as Jt } from "./toString.CRT5zqEU.js";
39
- import { S as pt, i as Qt } from "./isObjectLike.D3cpZO39.js";
40
- import te from "../components/progress-bar.js";
41
- import ee from "../components/spinner.js";
42
- import { o as se } from "./style-map.llVFPd__.js";
43
- import { r as ie } from "./choose.BTbF6BAn.js";
44
- function ae(t, e, i, a) {
45
- for (var s = -1, n = t == null ? 0 : t.length; ++s < n; ) {
46
- var l = t[s];
47
- e(a, l, i(l), t);
48
- }
49
- return a;
50
- }
51
- function oe(t) {
52
- return function(e, i, a) {
53
- for (var s = -1, n = Object(e), l = a(e), h = l.length; h--; ) {
54
- var _ = l[++s];
55
- if (i(n[_], _, n) === !1)
56
- break;
57
- }
58
- return e;
59
- };
60
- }
61
- var ne = oe();
62
- function re(t, e) {
63
- return t && ne(t, e, Dt);
64
- }
65
- function ce(t, e) {
66
- return function(i, a) {
67
- if (i == null)
68
- return i;
69
- if (!bt(i))
70
- return t(i, a);
71
- for (var s = i.length, n = -1, l = Object(i); ++n < s && a(l[n], n, l) !== !1; )
72
- ;
73
- return i;
74
- };
75
- }
76
- var le = ce(re);
77
- function de(t, e, i, a) {
78
- return le(t, function(s, n, l) {
79
- e(a, s, i(s), l);
80
- }), a;
81
- }
82
- function he(t, e) {
83
- return function(i, a) {
84
- var s = $t(i) ? ae : de, n = e ? e() : {};
85
- return s(i, t, Rt(a), n);
86
- };
87
- }
88
- var pe = he(function(t, e, i) {
89
- t[i ? 0 : 1].push(e);
90
- }, function() {
91
- return [[], []];
92
- });
93
- const ue = {
94
- error: "Upload error",
95
- loaded: "Up-to-date",
96
- loading: "Syncing"
97
- }, x = {
98
- FAVORITES: "favorites",
99
- PINNED: "pinned",
100
- RECENT: "recent",
101
- UPLOADS: "uploads"
102
- }, X = 20, ge = {
103
- GET_CONTENT: "/webapi/extensibility/integrations/contentBrowserSDK/getcontent_4bw_v1"
104
- }, A = {
105
- ASSET_PATH: "Document.AssetPath",
106
- CHILD_COUNT: "Document.ChildCount",
107
- CORTEX_PATH: "Document.CortexPath",
108
- DOC_TYPE: "CoreField.DocType",
109
- HAS_BROWSER_CHILDREN: "Document.HasBrowserChildren",
110
- PARENT_FOLDER_IDENTIFIER: "Document.ParentRecordID",
111
- TITLE_WITH_FALLBACK: "CoreField.TitleWithFallback"
112
- }, Z = "GB", O = 6e4, xe = ["album", "story", "project", "merchandise"], ut = (t) => {
113
- const e = /* @__PURE__ */ new Date(), i = new Date(
114
- e.getFullYear(),
115
- e.getMonth(),
116
- e.getDate()
117
- ).getTime(), a = new Date(
118
- e.getFullYear(),
119
- e.getMonth(),
120
- e.getDate() + 1
121
- ).getTime();
122
- return pe(
123
- t.toSorted((s, n) => n.uploadTimestamp - s.uploadTimestamp),
124
- (s) => s.uploadTimestamp >= i && s.uploadTimestamp < a
125
- );
126
- }, me = ({
127
- excludesRecordIDs: t,
128
- searchText: e
129
- }) => {
130
- let i = "";
131
- e?.trim() && (i = `Story_Title:${e}`);
132
- let a = "";
133
- t?.length && (a = t.map((n) => `RecordID:NOT ${n}`).join(" AND "));
134
- let s = i ? ` AND (${[i].filter(Boolean).join(" OR ")})` : "";
135
- return a && (s = `${s} AND (${a})`), `(MediaType:Story OR MediaType:Album)${s}`;
136
- }, _e = 10, Ct = async ({
137
- excludes: t = [],
138
- folderId: e,
139
- folderPath: i = [],
140
- folderPathsSet: a,
141
- limit: s = _e,
142
- searchText: n,
143
- seeThru: l,
144
- siteUrl: h,
145
- start: _ = 0,
146
- token: m
147
- }) => {
148
- if (!h)
149
- return { data: [], totalCount: 0 };
150
- let g = h;
151
- g.endsWith("/") && (g = g.slice(0, -1));
152
- const $ = ge.GET_CONTENT, f = [
153
- ["Token", m],
154
- [
155
- "extraFilters",
156
- me({
157
- excludesRecordIDs: t,
158
- searchText: n
159
- })
160
- ],
161
- ["fields", A.ASSET_PATH],
162
- ["fields", A.CORTEX_PATH],
163
- ["fields", A.DOC_TYPE],
164
- ["fields", A.TITLE_WITH_FALLBACK],
165
- ["fields", A.HAS_BROWSER_CHILDREN],
166
- ["fields", A.PARENT_FOLDER_IDENTIFIER],
167
- ["fields", A.CHILD_COUNT],
168
- ["objectRecordID", e],
169
- ["seeThru", n?.trim() || l ? "true" : "false"],
170
- ["limit", s.toString()],
171
- ["start", _.toString()]
172
- ], F = new URL(`${g}${$}`);
173
- f.forEach(([w, E]) => {
174
- F.searchParams.append(w, E);
175
- });
176
- const k = await fetch(F.toString(), {
177
- headers: {
178
- Authorization: `Bearer ${m}`
179
- },
180
- method: "GET"
181
- });
182
- if (!k.ok) {
183
- const w = new Error();
184
- throw w.message = "Failed to fetch", w;
185
- }
186
- const G = await k.json();
187
- let Y = /* @__PURE__ */ new Set();
188
- a && (Y = ye(a));
189
- const rt = G.contentItems?.map((w) => {
190
- let E = M(
191
- w.fields,
192
- A.TITLE_WITH_FALLBACK
193
- ) ?? "", B = ve(
194
- (M(
195
- w.fields,
196
- A.ASSET_PATH
197
- ) ?? "").replace(/^Root\//i, "")
198
- ) || E;
199
- if (a) {
200
- if (a.has(B)) {
201
- const ct = B.split("/"), At = ct.pop();
202
- B = `${ct.join("/")}/${w.recordID}-${At}`, E = `${w.recordID}-${E}`;
203
- }
204
- n?.trim() && Y.has(E) && (E = B), a.add(B), Y.add(E);
205
- }
206
- return {
207
- childCount: Number(
208
- M(
209
- w.fields,
210
- A.CHILD_COUNT
211
- ) ?? 0
212
- ),
213
- children: [],
214
- docType: M(
215
- w.fields,
216
- A.DOC_TYPE
217
- ) ?? "",
218
- fullPath: B,
219
- hasChildren: M(
220
- w.fields,
221
- A.HAS_BROWSER_CHILDREN
222
- ) === "1",
223
- id: w.recordID,
224
- parentFolderIdentifier: M(
225
- w.fields,
226
- A.PARENT_FOLDER_IDENTIFIER
227
- ) ?? "",
228
- parents: [],
229
- path: [...i, E],
230
- title: E
231
- };
232
- }) ?? [];
233
- return { data: rt, totalCount: G.totalCount ?? rt.length };
234
- };
235
- function M(t, e) {
236
- const i = e.toLowerCase(), a = Object.keys(t).find(
237
- (s) => s.toLowerCase() === i
238
- );
239
- return a ? t[a] : void 0;
240
- }
241
- const it = "-", I = (t) => {
242
- const e = t.split(it), i = e.pop() ?? "", a = e.join(it);
243
- return { id: i, path: a };
244
- }, N = ({ id: t, path: e }) => [e, t].join(it), fe = (t) => {
245
- const e = t.split(".");
246
- return e.length > 1 ? e.pop() ?? "" : "";
247
- }, gt = (t) => {
248
- const e = t.match(/(?:V\.?)?(\d+(?:\.\d+)*)/);
249
- return e ? e[1] : "";
250
- }, xt = (t, e) => {
251
- let i = e?.trim();
252
- const a = e ? e.split("/").length : 0;
253
- return (t ? t.length : 0) >= a && (i = t.join("/") ?? ""), i;
254
- }, ve = (t) => t.split("/").map((e) => e.trim()).join("/"), ye = (t) => {
255
- const e = /* @__PURE__ */ new Set();
256
- for (const i of t) {
257
- const a = i.split("/"), s = a[a.length - 1];
258
- s && e.add(s);
259
- }
260
- return e;
261
- }, be = (t, e) => {
262
- const i = t.split("/"), a = e.split("/");
263
- return i.slice(0, a.length + 1).join("/");
264
- };
265
- function mt(t) {
266
- return t.toSorted((e, i) => i.uploadTimestamp - e.uploadTimestamp);
267
- }
268
- var $e = Object.defineProperty, Ie = Object.getOwnPropertyDescriptor, D = (t, e, i, a) => {
269
- for (var s = a > 1 ? void 0 : a ? Ie(e, i) : e, n = t.length - 1, l; n >= 0; n--)
270
- (l = t[n]) && (s = (a ? l(e, i, s) : l(s)) || s);
271
- return a && s && $e(e, i, s), s;
272
- };
273
- let y = class extends H {
274
- constructor() {
275
- super(...arguments), this.localize = new q(this), this.role = "treeitem", this.siteUrl = "", this.token = "", this.searchText = "", this.folder = null, this.currentRootIDsSet = /* @__PURE__ */ new Set(), this.folderPathsSet = /* @__PURE__ */ new Set(), this.removedIDs = [], this.data = null, this.totalCount = 0, this.isLoading = !1, this.fetchFolders = async ({
276
- folderId: t,
277
- start: e = 0
278
- }) => await Ct({
279
- folderId: t,
280
- folderPath: this.folder?.path ?? [],
281
- folderPathsSet: this.folderPathsSet,
282
- siteUrl: this.siteUrl,
283
- start: e,
284
- token: this.token
285
- }), this.loadMore = async (t) => {
286
- t?.stopPropagation();
287
- const e = this.data?.length ?? 0;
288
- if (e >= this.totalCount)
289
- return;
290
- this.isLoading = !0;
291
- const { data: i, totalCount: a } = await this.fetchFolders({
292
- folderId: this.folder?.id ?? "",
293
- start: e
294
- });
295
- this.data = [...this.data ?? [], ...i], this.totalCount = a, this.isLoading = !1;
296
- }, this.onLazyLoad = async (t) => {
297
- if (t.target !== this.treeItem)
298
- return;
299
- const { data: e, totalCount: i } = await this.fetchFolders({
300
- folderId: this.folder?.id ?? ""
301
- });
302
- if (this.data = e, this.totalCount = i, await this.updateComplete, !this.treeItem.selected && !this.treeItem.indeterminate) {
303
- let a = !0, s = !0;
304
- for (const n of this.treeItem.getChildrenItems())
305
- n.selected ? (vt(n, !0, "multiple"), s = !1) : a = !1;
306
- this.treeItem.indeterminate = !a && !s;
307
- }
308
- };
309
- }
310
- get selected() {
311
- return this.treeItem.selected;
312
- }
313
- set selected(t) {
314
- this.treeItem.selected = t;
315
- }
316
- get expanded() {
317
- return this.treeItem.expanded;
318
- }
319
- set expanded(t) {
320
- this.treeItem.expanded = t;
321
- }
322
- get indeterminate() {
323
- return this.treeItem.indeterminate;
324
- }
325
- set indeterminate(t) {
326
- this.treeItem.indeterminate = t;
327
- }
328
- // this is so that external cx-tree can query select the cx-tree-item inside
329
- createRenderRoot() {
330
- return this;
331
- }
332
- getChildrenItems() {
333
- return this.treeItem.getChildrenItems();
334
- }
335
- async syncBoxes() {
336
- if (await this.updateComplete, !this.treeItem)
337
- return;
338
- let t = !1;
339
- const e = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = xt(this.folder?.path ?? [], this.folder?.fullPath ?? ""), s = [...this.currentRootIDsSet], n = (m, g) => {
340
- m.forEach(($) => {
341
- const f = I($);
342
- if (!f.path.trim() || !f.id.trim())
343
- return !1;
344
- const F = R(f.path), k = R(a);
345
- a && F.startsWith(k) && F !== k && g.add(be(f.path, a));
346
- });
347
- };
348
- n(this.removedIDs, i), n(s, e);
349
- let l = !!s.some((m) => {
350
- const g = I(m);
351
- if (!g.path.trim() || !g.id.trim())
352
- return !1;
353
- const $ = N({
354
- id: this.folder?.id ?? "",
355
- path: a
356
- }), f = R(g.path), F = R(a), k = g.id === this.folder?.id, G = !this.removedIDs.includes($) && F.startsWith(f);
357
- return k || G;
358
- });
359
- const h = this.folder?.childCount && e.size === this.folder?.childCount;
360
- if (this.folder?.childCount && i.size === this.folder?.childCount) {
361
- this.currentRootIDsSet.delete(
362
- N({
363
- id: this.folder?.id ?? "",
364
- path: a
365
- })
366
- );
367
- const m = this.parentElement?.parentElement;
368
- m && m instanceof y && m.syncBoxes(), l = !1;
369
- } else if (!l)
370
- if (h) {
371
- this.currentRootIDsSet.add(
372
- N({
373
- id: this.folder?.id ?? "",
374
- path: a
375
- })
376
- );
377
- const m = this.parentElement?.parentElement;
378
- m && m instanceof y && m.syncBoxes(), l = !0;
379
- } else e.size > 0 && (t = !0);
380
- l ? (t = i.size > 0, this.treeItem.selected = !0) : (t = e.size > 0, this.treeItem.selected = !1, await this.treeItem.updateComplete), t ? (this.treeItem.selected = !1, await this.treeItem.updateComplete, this.treeItem.indeterminate = !0) : this.treeItem.indeterminate = !1;
381
- }
382
- render() {
383
- const t = xt(this.folder?.path ?? [], this.folder?.fullPath ?? "");
384
- return o`
385
- <cx-tree-item
386
- aria-label=${this.folder?.title ?? ""}
387
- class=${C({
388
- "folder-tree__item": !0,
389
- selectable: !0
390
- })}
391
- data-id=${this.folder?.id}
392
- data-path=${t}
393
- ?lazy=${this.folder?.hasChildren && this.data === null}
394
- @cx-lazy-load=${this.onLazyLoad}
395
- >
396
- <div class="folder-tree__label">
397
- <cx-icon class="folder-tree__icon" name="folder"></cx-icon>
398
- <cx-line-clamp lines="1" class="folder-tree__label__value">
399
- ${this.folder?.title}
400
- </cx-line-clamp>
401
- </div>
402
- ${U(
403
- this.data ?? [],
404
- (e) => e.id,
405
- (e) => o`<cx-folder-item
406
- slot="children"
407
- .folder=${e}
408
- .siteUrl=${this.siteUrl}
409
- .token=${this.token}
410
- .removedIDs=${this.removedIDs}
411
- .currentRootIDsSet=${this.currentRootIDsSet}
412
- .folderPathsSet=${this.folderPathsSet}
413
- ></cx-folder-item>`
414
- )}
415
- ${p(
416
- this.data && this.data.length < this.totalCount,
417
- () => o`
418
- <div slot="children" class="load-more-button">
419
- <cx-button
420
- data-testid="load-more-button"
421
- variant="text"
422
- @click=${this.loadMore}
423
- ?loading=${this.isLoading}
424
- >
425
- ${this.localize.term("more")}
426
- </cx-button>
427
- </div>
428
- `
429
- )}
430
- </cx-tree-item>
431
- `;
432
- }
433
- };
434
- y.styles = [tt];
435
- y.dependencies = {
436
- "cx-icon": J,
437
- "cx-line-clamp": Q,
438
- "cx-tree-item": ft
439
- };
440
- D([
441
- z("cx-tree-item")
442
- ], y.prototype, "treeItem", 2);
443
- D([
444
- d({
445
- attribute: "site-url",
446
- reflect: !0,
447
- type: String
448
- })
449
- ], y.prototype, "siteUrl", 2);
450
- D([
451
- d({ reflect: !0, type: String })
452
- ], y.prototype, "token", 2);
453
- D([
454
- d({ attribute: "search-text", reflect: !0, type: String })
455
- ], y.prototype, "searchText", 2);
456
- D([
457
- d({ type: Object })
458
- ], y.prototype, "folder", 2);
459
- D([
460
- d({
461
- attribute: "current-root-ids-set",
462
- type: Object
463
- })
464
- ], y.prototype, "currentRootIDsSet", 2);
465
- D([
466
- d({ attribute: "folder-paths-set", type: Object })
467
- ], y.prototype, "folderPathsSet", 2);
468
- D([
469
- d({
470
- attribute: "removed-ids",
471
- converter: {
472
- fromAttribute: (t) => t.split(" "),
473
- toAttribute: (t) => t.join(" ")
474
- },
475
- type: String
476
- })
477
- ], y.prototype, "removedIDs", 2);
478
- D([
479
- u()
480
- ], y.prototype, "data", 2);
481
- D([
482
- u()
483
- ], y.prototype, "totalCount", 2);
484
- D([
485
- u()
486
- ], y.prototype, "isLoading", 2);
487
- D([
488
- P(["currentRootIDsSet", "removedIDs"])
489
- ], y.prototype, "syncBoxes", 1);
490
- y = D([
491
- W("cx-folder-item")
492
- ], y);
493
- const Se = at`
494
- .folder-tree {
495
- overflow: auto;
496
- flex: 1;
497
- }
498
-
499
- .folder-tree:not(.selectable) {
500
- max-height: 200px;
501
- }
502
-
503
- .folder-tree__item::part(label) {
504
- width: 100%;
505
- overflow: hidden;
506
- }
507
-
508
- .folder-tree__icon {
509
- font-size: var(--cx-font-size-large);
510
- color: var(--cx-color-neutral-600);
511
- }
512
-
513
- .folder-tree__label {
514
- display: flex;
515
- width: 100%;
516
- overflow: hidden;
517
- gap: var(--cx-spacing-x-small);
518
- line-height: var(--cx-line-height-medium);
519
- }
520
-
521
- .folder-tree__label__value {
522
- flex-grow: 1;
523
- flex-shrink: 1;
524
- overflow: hidden;
525
- --tooltip-max-width: min(80vw, 640px);
526
- }
527
-
528
- /**
529
- * align load more button with the folder tree item
530
- * 1em = .tree-item__indentation's width
531
- * var(--cx-spacing-x-small) = .tree-item__item's padding-left
532
- * 1rem = .tree-item__expand-button's width
533
- * var(--cx-spacing-x-small) * 2 = .tree-item__expand-button's padding-left and padding-right
534
- */
535
- .load-more-button {
536
- margin-left: calc(
537
- 1em + var(--cx-spacing-x-small) + 1rem + var(--cx-spacing-x-small) * 2
538
- );
539
- }
540
-
541
- /**
542
- * reset line-height so as not to be affected by nested "em" units inside folder-tree
543
- */
544
- .load-more-button cx-button {
545
- line-height: var(--cx-line-height-small);
546
- }
547
- `;
548
- var we = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, S = (t, e, i, a) => {
549
- for (var s = a > 1 ? void 0 : a ? Ce(e, i) : e, n = t.length - 1, l; n >= 0; n--)
550
- (l = t[n]) && (s = (a ? l(e, i, s) : l(s)) || s);
551
- return a && s && we(e, i, s), s;
552
- };
553
- let b = class extends H {
554
- constructor() {
555
- super(...arguments), this.localize = new q(this), this.role = "tree", this.siteUrl = "", this.bearerToken = "", this.token = "", this.searchText = "", this.folders = [], this.rootIDs = [], this.totalCount = 0, this.loadMore = () => {
556
- }, this.isLoading = !1, this.folderPathsSet = /* @__PURE__ */ new Set(), this.removedIDs = [], this.currentRootIDsSet = /* @__PURE__ */ new Set(), this.renderFolder = (t) => o`<cx-folder-item
557
- .currentRootIDsSet=${this.currentRootIDsSet}
558
- .folder=${t}
559
- .folderPathsSet=${this.folderPathsSet}
560
- .removedIDs=${this.removedIDs}
561
- bearer-token=${this.bearerToken}
562
- search-text=${this.searchText}
563
- site-url=${this.siteUrl}
564
- token=${this.token}
565
- ></cx-folder-item>`;
566
- }
567
- get currentRootIDs() {
568
- return Array.from(this.currentRootIDsSet);
569
- }
570
- handleRootIDsChange() {
571
- this.currentRootIDsSet = new Set(this.rootIDs);
572
- }
573
- resetTree() {
574
- this.currentRootIDsSet = new Set(this.rootIDs), this.tree.querySelectorAll("cx-folder-item").forEach((t) => {
575
- t.selected = this.currentRootIDsSet.has(
576
- N({
577
- id: t.id,
578
- path: t.dataset.path ?? ""
579
- })
580
- ), t.expanded = !1, t.indeterminate = !1;
581
- });
582
- }
583
- async handleSelectedChange(t) {
584
- const e = t.target, i = e.dataset.id ?? "", a = e.dataset.path ?? "";
585
- if (await e.updateComplete, !i.trim() || !a.trim())
586
- return;
587
- const s = N({
588
- id: i,
589
- path: a
590
- });
591
- if (!(e.indeterminate && !e.selected)) {
592
- if (e.selected) {
593
- if (!this.currentRootIDsSet.has(s)) {
594
- lt(e, "multiple"), this.currentRootIDsSet.add(s);
595
- for (const n of e.getChildrenItems())
596
- !n.id.trim() || !n.dataset.path?.trim() || this.currentRootIDsSet.add(
597
- N({
598
- id: n.id,
599
- path: n.dataset.path ?? ""
600
- })
601
- );
602
- }
603
- this.removedIDs = this.removedIDs.filter(
604
- (n) => n !== s && !I(n).path.startsWith(a + "/")
605
- );
606
- } else
607
- this.removedIDs.push(s), this.currentRootIDsSet.has(s) && (this.currentRootIDsSet.delete(s), lt(e, "multiple"));
608
- [...this.currentRootIDsSet].forEach((n) => {
609
- const l = R(a), h = I(n).path, _ = R(h);
610
- _.startsWith(l) && _ !== l && (e.selected || this.currentRootIDsSet.delete(n));
611
- }), this.currentRootIDsSet = new Set(this.currentRootIDsSet);
612
- }
613
- }
614
- render() {
615
- return o`
616
- <div class="folder-tree selectable">
617
- <cx-tree
618
- class=${C({
619
- selectable: !0
620
- })}
621
- @cx-selected-change=${this.handleSelectedChange}
622
- selection="multiple"
623
- disabled-auto-expand
624
- disabled-sync-checkboxes
625
- >
626
- ${U(
627
- this.folders,
628
- (t) => t.id,
629
- (t) => this.renderFolder(t)
630
- )}
631
- ${p(
632
- this.folders && this.folders.length < this.totalCount,
633
- () => o`
634
- <div class="load-more-button">
635
- <cx-button
636
- variant="text"
637
- @click=${this.loadMore}
638
- ?loading=${this.isLoading}
639
- >
640
- ${this.localize.term("more")}
641
- </cx-button>
642
- </div>
643
- `
644
- )}
645
- </cx-tree>
646
- </div>
647
- `;
648
- }
649
- };
650
- b.styles = [tt, Se];
651
- b.dependencies = {
652
- "cx-folder-item": y,
653
- "cx-tree": yt
654
- };
655
- S([
656
- z("cx-tree")
657
- ], b.prototype, "tree", 2);
658
- S([
659
- d({ attribute: "site-url", reflect: !0, type: String })
660
- ], b.prototype, "siteUrl", 2);
661
- S([
662
- d({ attribute: "bearer-token", reflect: !0, type: String })
663
- ], b.prototype, "bearerToken", 2);
664
- S([
665
- d({ attribute: "token", reflect: !0, type: String })
666
- ], b.prototype, "token", 2);
667
- S([
668
- d({ attribute: "search-text", reflect: !0, type: String })
669
- ], b.prototype, "searchText", 2);
670
- S([
671
- d({ type: Array })
672
- ], b.prototype, "folders", 2);
673
- S([
674
- d({ attribute: "root-ids", reflect: !0, type: Array })
675
- ], b.prototype, "rootIDs", 2);
676
- S([
677
- d({ attribute: "total-count", reflect: !0, type: Number })
678
- ], b.prototype, "totalCount", 2);
679
- S([
680
- d({ attribute: "load-more", type: Function })
681
- ], b.prototype, "loadMore", 2);
682
- S([
683
- d({ attribute: "is-loading", reflect: !0, type: Boolean })
684
- ], b.prototype, "isLoading", 2);
685
- S([
686
- d({ attribute: "folder-paths-set", type: Object })
687
- ], b.prototype, "folderPathsSet", 2);
688
- S([
689
- u()
690
- ], b.prototype, "removedIDs", 2);
691
- S([
692
- u()
693
- ], b.prototype, "currentRootIDsSet", 2);
694
- S([
695
- P("rootIDs")
696
- ], b.prototype, "handleRootIDsChange", 1);
697
- b = S([
698
- W("cx-folder-tree")
699
- ], b);
700
- var Ae = 200;
701
- function De(t, e, i, a) {
702
- var s = -1, n = kt, l = !0, h = t.length, _ = [], m = e.length;
703
- if (!h)
704
- return _;
705
- i && (e = Jt(e, Pt(i))), e.length >= Ae && (n = zt, l = !1, e = new Tt(e));
706
- t:
707
- for (; ++s < h; ) {
708
- var g = t[s], $ = i == null ? g : i(g);
709
- if (g = g !== 0 ? g : 0, l && $ === $) {
710
- for (var f = m; f--; )
711
- if (e[f] === $)
712
- continue t;
713
- _.push(g);
714
- } else n(e, $, a) || _.push(g);
715
- }
716
- return _;
717
- }
718
- var _t = pt ? pt.isConcatSpreadable : void 0;
719
- function Te(t) {
720
- return $t(t) || Et(t) || !!(_t && t && t[_t]);
721
- }
722
- function Pe(t, e, i, a, s) {
723
- var n = -1, l = t.length;
724
- for (i || (i = Te), s || (s = []); ++n < l; ) {
725
- var h = t[n];
726
- i(h) ? Lt(s, h) : a || (s[s.length] = h);
727
- }
728
- return s;
729
- }
730
- function ze(t, e, i) {
731
- var a = t.length;
732
- if (a < 2)
733
- return a ? dt(t[0]) : [];
734
- for (var s = -1, n = Array(a); ++s < a; )
735
- for (var l = t[s], h = -1; ++h < a; )
736
- h != s && (n[s] = De(n[s] || l, t[h], e, i));
737
- return dt(Pe(n), e, i);
738
- }
739
- function Ee(t) {
740
- return Qt(t) && bt(t);
741
- }
742
- var st = Zt(function(t) {
743
- return ze(Ft(t, Ee));
744
- }), v = /* @__PURE__ */ ((t) => (t.Canceled = "CANCELED", t.Failed = "FAILED", t.InProgress = "INPROGRESS", t.PendingComplete = "PENDINGCOMPLETE", t.Success = "SUCCESS", t))(v || {}), Le = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, j = (t, e, i, a) => {
745
- for (var s = a > 1 ? void 0 : a ? Fe(e, i) : e, n = t.length - 1, l; n >= 0; n--)
746
- (l = t[n]) && (s = (a ? l(e, i, s) : l(s)) || s);
747
- return a && s && Le(e, i, s), s;
748
- };
749
- let T = class extends H {
750
- constructor() {
751
- super(...arguments), this.localize = new q(this), this.size = 0, this.remainingSize = 0, this.childrenCount = 0, this.assetsCount = 0;
752
- }
753
- get cachedSize() {
754
- return Math.max(0, this.size - this.remainingSize);
755
- }
756
- get percentage() {
757
- return this.size ? Math.round(this.cachedSize / this.size * 100) : 0;
758
- }
759
- createRenderRoot() {
760
- return this;
761
- }
762
- renderFolderSuccessText() {
763
- return o`${this.childrenCount} ${this.localize.term("subfolders")},
764
- ${this.assetsCount} ${this.localize.term("assets")}`;
765
- }
766
- renderSuccess() {
767
- return o`<div class="file-on-demand-pinned-status__success progress">
768
- <cx-icon name="file_download" variant="filled"></cx-icon>
769
- <cx-typography variant="small">
770
- <cx-line-clamp lines="1">
771
- ${p(this.isFolder, this.renderFolderSuccessText.bind(this), () => o`${this.localize.term("cached")}`)}
772
- </cx-line-clamp>
773
- </cx-typography>
774
- </div>`;
775
- }
776
- renderFailed() {
777
- return o`<div class="file-on-demand-pinned-status__failed progress">
778
- <cx-icon name="file_download_off" variant="filled"></cx-icon>
779
- <cx-typography variant="small">
780
- <cx-line-clamp lines="1">
781
- ${this.localize.term("syncFailedCacheFull")}
782
- </cx-line-clamp>
783
- </cx-typography>
784
- </div>`;
785
- }
786
- renderCanceled() {
787
- return o`<div class="file-on-demand-pinned-status__canceled progress">
788
- <cx-icon name="file_download_off" variant="filled"></cx-icon>
789
- <cx-typography variant="small">
790
- <cx-line-clamp lines="1">
791
- ${this.localize.term("syncCanceled")}
792
- </cx-line-clamp>
793
- </cx-typography>
794
- </div>`;
795
- }
796
- renderInProgress() {
797
- return o`<div class="file-on-demand-pinned-status__in-progress progress">
798
- <cx-icon name="downloading" variant="filled"></cx-icon>
799
- <cx-typography variant="small">
800
- <cx-line-clamp lines="1">
801
- ${this.localize.term("caching")} ${this.percentage}% (<cx-format-bytes .value=${this.cachedSize}></cx-format-bytes>/
802
- <cx-format-bytes .value=${this.size}></cx-format-bytes>)
803
- </cx-line-clamp>
804
- </cx-typography>
805
- </div>`;
806
- }
807
- render() {
808
- return o`<div class="file-on-demand-pinned-status">
809
- ${ie(this.uploadStatus, [
810
- [v.Success, this.renderSuccess.bind(this)],
811
- [v.Failed, this.renderFailed.bind(this)],
812
- [v.InProgress, this.renderInProgress.bind(this)],
813
- [v.PendingComplete, this.renderInProgress.bind(this)],
814
- [v.Canceled, this.renderCanceled.bind(this)]
815
- ])}
816
- </div>`;
817
- }
818
- };
819
- T.styles = [tt];
820
- T.dependencies = {
821
- "cx-format-bytes": ot,
822
- "cx-icon": J,
823
- "cx-line-clamp": Q,
824
- "cx-typography": nt
825
- };
826
- j([
827
- d({
828
- attribute: "upload-status",
829
- type: String
830
- })
831
- ], T.prototype, "uploadStatus", 2);
832
- j([
833
- d({ type: Number })
834
- ], T.prototype, "size", 2);
835
- j([
836
- d({
837
- attribute: "remaining-size",
838
- type: Number
839
- })
840
- ], T.prototype, "remainingSize", 2);
841
- j([
842
- d({
843
- attribute: "is-folder",
844
- type: Boolean
845
- })
846
- ], T.prototype, "isFolder", 2);
847
- j([
848
- d({
849
- attribute: "children-count",
850
- type: Number
851
- })
852
- ], T.prototype, "childrenCount", 2);
853
- j([
854
- d({
855
- attribute: "assets-count",
856
- type: Number
857
- })
858
- ], T.prototype, "assetsCount", 2);
859
- T = j([
860
- W("cx-file-on-demand-pinned-status")
861
- ], T);
862
- const Ue = at`
863
- :host {
864
- padding: var(--cx-spacing-2x-small) var(--cx-spacing-small);
865
- display: block;
866
- }
867
-
868
- .asset {
869
- max-height: var(--asset-height);
870
- display: flex;
871
- gap: var(--cx-spacing-small);
872
- }
873
- :host(:hover) {
874
- background-color: var(--cx-input-filled-background-color-hover);
875
- }
876
-
877
- .asset__description {
878
- flex: 1;
879
- width: 0;
880
- display: flex;
881
- flex-direction: column;
882
- justify-content: center;
883
- }
884
- .asset__description__label {
885
- display: flex;
886
- }
887
- .asset__description__label__text {
888
- flex-grow: 1;
889
- flex-shrink: 1;
890
- overflow: hidden;
891
- }
892
- .asset__description__status {
893
- color: var(--cx-color-neutral-500);
894
- line-height: var(--cx-line-height-medium);
895
- }
896
-
897
- .asset__actions {
898
- display: flex;
899
- min-width: 64px;
900
- justify-content: flex-end;
901
- align-items: center;
902
- }
903
- .asset:hover .asset__actions {
904
- visibility: visible;
905
- opacity: 1;
906
- }
907
- .asset__actions {
908
- visibility: hidden;
909
- opacity: 0;
910
- }
911
-
912
- .asset__actions__spinner {
913
- min-height: var(--cx-input-height-medium);
914
- min-width: var(--cx-input-height-medium);
915
- display: flex;
916
- justify-content: center;
917
- align-items: center;
918
- }
919
- .asset__actions__spinner::part(base) {
920
- flex-grow: 0;
921
- }
922
-
923
- .asset__thumbnail {
924
- width: 56px;
925
- height: var(--asset-height);
926
- display: flex;
927
- justify-content: center;
928
- align-items: center;
929
- position: relative;
930
- border-radius: var(--cx-border-radius-medium);
931
- }
932
- .asset__thumbnail--placeholder {
933
- background-color: var(--cx-color-primary-50);
934
- }
935
- .asset__thumbnail--folder {
936
- background-color: var(--cx-color-neutral-100);
937
- }
938
-
939
- .asset__thumbnail__image {
940
- height: 100%;
941
- width: 100%;
942
- object-fit: cover;
943
- flex-shrink: 0;
944
- border-radius: var(--cx-border-radius-medium);
945
- }
946
- .asset__thumbnail__icon {
947
- --font-size: 38px;
948
- display: none;
949
- color: var(--cx-color-primary-400);
950
- }
951
-
952
- .asset__folder__icon {
953
- --font-size: var(--cx-font-size-x-large);
954
- color: var(--cx-color-neutral-600);
955
- }
956
-
957
- .asset__thumbnail__extension {
958
- display: none;
959
- position: absolute;
960
- bottom: var(--cx-spacing-3x-small);
961
- left: 50%;
962
- transform: translateX(-50%);
963
- width: 26px;
964
- color: var(--cx-color-primary-50);
965
- }
966
-
967
- .asset__thumbnail__extension__line-clamp {
968
- width: 100%;
969
- text-align: center;
970
- }
971
-
972
- .asset__thumbnail__extension__text {
973
- flex-grow: 1;
974
- flex-shrink: 1;
975
- overflow: hidden;
976
- text-transform: uppercase;
977
- display: contents;
978
- }
979
-
980
- .asset__thumbnail--placeholder .asset__thumbnail__image {
981
- display: none;
982
- }
983
-
984
- .asset__thumbnail--placeholder .asset__thumbnail__icon,
985
- .asset__thumbnail--placeholder .asset__thumbnail__extension {
986
- display: flex;
987
- }
988
-
989
- /** uploads assets */
990
- cx-progress-bar {
991
- --height: 4px;
992
- --indicator-color: var(--color);
993
- --track-color: var(--cx-color-neutral-300);
994
- z-index: 0;
995
- }
996
- .progress {
997
- display: flex;
998
- align-items: center;
999
- width: 100%;
1000
- gap: var(--cx-spacing-2x-small);
1001
- margin-top: var(--cx-spacing-3x-small);
1002
- }
1003
-
1004
- .syncing-progress,
1005
- .completed-progress,
1006
- .failed-progress,
1007
- .canceled-progress {
1008
- margin-top: var(--cx-spacing-2x-small);
1009
- }
1010
-
1011
- .progress * {
1012
- white-space: nowrap;
1013
- }
1014
-
1015
- .progress cx-icon {
1016
- --font-size: var(--cx-font-size-medium);
1017
- }
1018
-
1019
- .progress cx-typography::part(base) {
1020
- line-height: var(--cx-font-size-medium);
1021
- }
1022
-
1023
- .uploading-progress.in-progress cx-icon {
1024
- color: var(--cx-color-primary-500);
1025
- }
1026
-
1027
- .uploading-progress.paused cx-icon {
1028
- color: var(--cx-color-warning-500);
1029
- }
1030
-
1031
- .syncing-progress cx-icon {
1032
- color: var(--cx-color-warning);
1033
- }
1034
-
1035
- .completed-progress cx-icon {
1036
- color: var(--cx-color-success);
1037
- }
1038
-
1039
- .failed-progress cx-icon,
1040
- .failed-progress__text {
1041
- color: var(--cx-color-danger);
1042
- cursor: help;
1043
- }
1044
-
1045
- .canceled-progress cx-icon {
1046
- color: var(--cx-color-neutral-600);
1047
- }
1048
-
1049
- .file-on-demand-pinned-status__success cx-icon,
1050
- .file-on-demand-pinned-status__in-progress cx-icon {
1051
- color: var(--cx-color-success-500);
1052
- }
1053
-
1054
- .file-on-demand-pinned-status__failed cx-icon {
1055
- color: var(--cx-color-danger-500);
1056
- }
1057
-
1058
- .file-on-demand-pinned-status__canceled cx-icon {
1059
- color: var(--cx-color-neutral-500);
1060
- }
1061
- `;
1062
- var Re = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, V = (t, e, i, a) => {
1063
- for (var s = a > 1 ? void 0 : a ? ke(e, i) : e, n = t.length - 1, l; n >= 0; n--)
1064
- (l = t[n]) && (s = (a ? l(e, i, s) : l(s)) || s);
1065
- return a && s && Re(e, i, s), s;
1066
- };
1067
- let L = class extends H {
1068
- constructor() {
1069
- super(...arguments), this.localize = new q(this), this.favoriteInProgressAssets = [], this.pinInProgressAssets = [], this.thumbnailLoadError = !1;
1070
- }
1071
- /** Failed or canceled uploads: show open-in-drive and retry. */
1072
- get showRetryableUploadActions() {
1073
- return this.listType === x.PINNED ? !1 : this.asset.uploadStatus === v.Failed || this.asset.uploadStatus === v.Canceled;
1074
- }
1075
- get showInProgressActions() {
1076
- return this.listType === x.PINNED ? !1 : this.asset.uploadStatus === v.InProgress;
1077
- }
1078
- get showNormalActions() {
1079
- return this.listType === x.PINNED ? !1 : [v.Success, v.PendingComplete].includes(
1080
- this.asset.uploadStatus
1081
- ) || !this.asset.uploadStatus?.trim();
1082
- }
1083
- get showPinnedActions() {
1084
- return this.listType === x.PINNED;
1085
- }
1086
- get isFolder() {
1087
- return xe.includes((this.asset.docType ?? "").toLowerCase());
1088
- }
1089
- get thumbnailUrl() {
1090
- return this.asset.thumbnail?.trim() ?? "";
1091
- }
1092
- get showThumbnailPlaceholder() {
1093
- return !this.thumbnailUrl || this.thumbnailLoadError;
1094
- }
1095
- willUpdate(t) {
1096
- if (super.willUpdate(t), !t.has("asset"))
1097
- return;
1098
- (t.get("asset")?.thumbnail?.trim() ?? "") !== this.thumbnailUrl && (this.thumbnailLoadError = !1);
1099
- }
1100
- handleImgError() {
1101
- this.thumbnailLoadError = !0;
1102
- }
1103
- handleImgLoad() {
1104
- this.thumbnailLoadError = !1;
1105
- }
1106
- handleOpenDriveClick() {
1107
- this.openDrive(this.asset);
1108
- }
1109
- openDrive(t) {
1110
- this.emit("cx-open-drive", {
1111
- detail: {
1112
- asset: t
1113
- }
1114
- });
1115
- }
1116
- unmarkFavorite(t) {
1117
- this.emit("cx-unmark-favorite", {
1118
- detail: {
1119
- assetId: t
1120
- }
1121
- });
1122
- }
1123
- markFavorite(t) {
1124
- this.emit("cx-mark-favorite", {
1125
- detail: {
1126
- assetId: t
1127
- }
1128
- });
1129
- }
1130
- pinAsset(t) {
1131
- this.emit("cx-file-on-demand-pin", {
1132
- detail: {
1133
- assetId: t
1134
- }
1135
- });
1136
- }
1137
- unpinAsset(t) {
1138
- this.emit("cx-file-on-demand-unpin", {
1139
- detail: {
1140
- assetId: t
1141
- }
1142
- });
1143
- }
1144
- handlePinClick() {
1145
- this.asset.isPinned ? this.unpinAsset(this.asset.recordId) : this.pinAsset(this.asset.recordId);
1146
- }
1147
- handleFavoriteClick() {
1148
- this.asset.isInFavorite ? this.unmarkFavorite(this.asset.recordId) : this.markFavorite(this.asset.recordId);
1149
- }
1150
- retryUpload(t) {
1151
- this.emit("cx-retry-upload", {
1152
- detail: {
1153
- assetId: t
1154
- }
1155
- });
1156
- }
1157
- handleRetryUploadClick() {
1158
- this.asset.uploadId && this.retryUpload(this.asset.uploadId);
1159
- }
1160
- resumeUpload(t) {
1161
- this.emit("cx-resume-upload", {
1162
- detail: {
1163
- assetId: t
1164
- }
1165
- });
1166
- }
1167
- pauseUpload(t) {
1168
- this.emit("cx-pause-upload", {
1169
- detail: {
1170
- assetId: t
1171
- }
1172
- });
1173
- }
1174
- cancelUpload(t) {
1175
- this.emit("cx-cancel-upload", {
1176
- detail: {
1177
- assetId: t
1178
- }
1179
- });
1180
- }
1181
- handlePauseUploadClick() {
1182
- this.asset.uploadId && (this.asset.isPaused ? this.resumeUpload(this.asset.uploadId) : this.pauseUpload(this.asset.uploadId));
1183
- }
1184
- handleCancelUploadClick() {
1185
- this.asset.uploadId && this.cancelUpload(this.asset.uploadId);
1186
- }
1187
- renderProgress({
1188
- isPaused: t = !1,
1189
- progress: e = 0,
1190
- remainingTime: i,
1191
- size: a = 0,
1192
- timestamp: s = Date.now(),
1193
- uploadErrorMessage: n,
1194
- uploadStatus: l = v.InProgress
1195
- }) {
1196
- const h = a > 0 ? e * 100 / a : 0, _ = l === v.InProgress ? h : 100, m = o`
1197
- <div class=${C({
1198
- "in-progress": l === v.InProgress,
1199
- paused: t,
1200
- progress: !0,
1201
- "uploading-progress": !0
1202
- })}>
1203
- ${p(t, () => o`<cx-icon name="pause" variant="filled"></cx-icon>`, () => o`<cx-icon name="arrow_upward"></cx-icon>`)}
1204
- <cx-typography variant="small">
1205
- <cx-line-clamp lines="1">
1206
- ${p(t, () => o`${this.localize.term("paused")} ‧`)}
1207
- <cx-format-bytes .value=${e}></cx-format-bytes>
1208
- ${this.localize.term("of")}
1209
- <cx-format-bytes .value=${a}></cx-format-bytes>
1210
- (${Math.round(h)}%)
1211
- ${p(
1212
- !!i && !t,
1213
- () => o`‧
1214
- <cx-relative-time
1215
- format="narrow"
1216
- numeric="always"
1217
- date=${new Date(Date.now() + (i ?? 0))}
1218
- sync
1219
- sync-interval=${O}
1220
- ></cx-relative-time>`
1221
- )}
1222
- </cx-line-clamp>
1223
- </cx-typography>
1224
- </div>
1225
- `, g = o`
1226
- <div class="progress syncing-progress">
1227
- <cx-icon name="cached"></cx-icon>
1228
- <cx-typography variant="small">
1229
- <cx-line-clamp lines="1">
1230
- ${this.localize.term("syncing")} ‧
1231
- <cx-relative-time
1232
- format="narrow"
1233
- numeric="always"
1234
- date=${new Date(s)}
1235
- sync
1236
- sync-interval=${O}
1237
- ></cx-relative-time>
1238
- </cx-line-clamp>
1239
- </cx-typography>
1240
- </div>
1241
- `, $ = o`
1242
- <div class="progress completed-progress">
1243
- <cx-icon name="check"></cx-icon>
1244
- <cx-typography variant="small">
1245
- <cx-line-clamp lines="1">
1246
- ${this.localize.term("readyToUse")} ‧
1247
- <cx-relative-time
1248
- format="narrow"
1249
- numeric="always"
1250
- date=${new Date(s)}
1251
- sync
1252
- sync-interval=${O}
1253
- ></cx-relative-time>
1254
- </cx-line-clamp>
1255
- </cx-typography>
1256
- </div>
1257
- `, f = o`
1258
- <div class="progress failed-progress">
1259
- <cx-typography variant="small">
1260
- <cx-line-clamp lines="1">
1261
- <cx-tooltip
1262
- content=${n || this.localize.term("uploadFailed")}
1263
- >
1264
- <span class="failed-progress__text">
1265
- ${this.localize.term("uploadFailed")} ‧
1266
- </span>
1267
- </cx-tooltip>
1268
- <cx-relative-time
1269
- format="narrow"
1270
- numeric="always"
1271
- date=${new Date(s)}
1272
- sync
1273
- sync-interval=${O}
1274
- ></cx-relative-time>
1275
- </cx-line-clamp>
1276
- </cx-typography>
1277
- </div>
1278
- `, F = o`
1279
- <div class="progress canceled-progress">
1280
- <cx-icon name="cancel"></cx-icon>
1281
- <cx-typography variant="small">
1282
- <cx-line-clamp lines="1">
1283
- ${this.localize.term("canceled")} ‧
1284
- <cx-relative-time
1285
- format="narrow"
1286
- numeric="always"
1287
- date=${new Date(s)}
1288
- sync
1289
- sync-interval=${O}
1290
- ></cx-relative-time>
1291
- </cx-line-clamp>
1292
- </cx-typography>
1293
- </div>
1294
- `;
1295
- return o`
1296
- ${p(
1297
- l === v.InProgress,
1298
- () => o`<cx-progress-bar
1299
- style=${se({
1300
- "--color": t ? "var(--cx-color-warning-500)" : "var(--cx-color-primary-500)"
1301
- })}
1302
- .value=${_.toFixed(0)}
1303
- class="progress-bar"
1304
- ></cx-progress-bar
1305
- >${m}`
1306
- )}
1307
- ${p(
1308
- l === v.PendingComplete,
1309
- () => g
1310
- )}
1311
- ${p(l === v.Success, () => $)}
1312
- ${p(l === v.Failed, () => f)}
1313
- ${p(l === v.Canceled, () => F)}
1314
- `;
1315
- }
1316
- renderUploadingStatus() {
1317
- return o`
1318
- ${this.renderProgress({
1319
- isPaused: this.asset.isPaused,
1320
- progress: (this.asset.size ?? 0) - (this.asset.remainingSize ?? 0),
1321
- remainingTime: this.asset.remainingTime,
1322
- size: this.asset.size ?? 0,
1323
- timestamp: this.asset.uploadTimestamp,
1324
- uploadErrorMessage: this.asset.uploadErrorMessage,
1325
- uploadStatus: this.asset.uploadStatus
1326
- })}
1327
- `;
1328
- }
1329
- renderPinnedStatus() {
1330
- return o`<cx-file-on-demand-pinned-status
1331
- size=${this.asset.size ?? 0}
1332
- remaining-size=${this.asset.remainingSize ?? 0}
1333
- upload-status=${this.asset.uploadStatus}
1334
- ?is-folder=${this.isFolder}
1335
- children-count=${this.asset.childrenCount ?? 0}
1336
- assets-count=${this.asset.assetsCount ?? 0}
1337
- ></cx-file-on-demand-pinned-status>`;
1338
- }
1339
- renderThumbnailContent() {
1340
- return this.isFolder ? this.listType === x.FAVORITES ? o`<cx-icon
1341
- class="asset__folder__icon"
1342
- name="folder_special"
1343
- ></cx-icon>` : o`<cx-icon class="asset__folder__icon" name="topic"></cx-icon>` : o`${p(
1344
- !!this.thumbnailUrl,
1345
- () => o`<img
1346
- alt=${this.asset.fileName}
1347
- class="asset__thumbnail__image"
1348
- src=${this.thumbnailUrl}
1349
- @error=${this.handleImgError}
1350
- @load=${this.handleImgLoad}
1351
- />`
1352
- )}
1353
- <cx-icon
1354
- class="asset__thumbnail__icon"
1355
- name="insert_drive_file"
1356
- variant="filled"
1357
- ></cx-icon>
1358
- <div class="asset__thumbnail__extension">
1359
- <cx-line-clamp
1360
- class="asset__thumbnail__extension__line-clamp"
1361
- lines="1"
1362
- >
1363
- <cx-typography
1364
- class="asset__thumbnail__extension__text"
1365
- variant="small"
1366
- >
1367
- ${fe(this.asset.fileName)}
1368
- </cx-typography>
1369
- </cx-line-clamp>
1370
- </div>`;
1371
- }
1372
- renderThumbnail() {
1373
- return o`<div
1374
- class=${C({
1375
- asset__thumbnail: !0,
1376
- "asset__thumbnail--folder": this.isFolder,
1377
- "asset__thumbnail--placeholder": this.showThumbnailPlaceholder
1378
- })}
1379
- >
1380
- ${this.renderThumbnailContent()}
1381
- </div>`;
1382
- }
1383
- renderOpenDriveButton() {
1384
- return o`<cx-tooltip content=${this.localize.term("openInDrive")} hoist>
1385
- <cx-icon-button
1386
- data-testid="asset__drive-button"
1387
- name="folder_open"
1388
- @click=${this.handleOpenDriveClick}
1389
- ></cx-icon-button>
1390
- </cx-tooltip>`;
1391
- }
1392
- renderNormalActions() {
1393
- return o`${this.renderOpenDriveButton()}
1394
- ${p(
1395
- this.favoriteInProgressAssets.includes(this.asset.recordId),
1396
- () => o`<cx-spinner class="asset__actions__spinner"></cx-spinner>`,
1397
- () => o`<cx-tooltip
1398
- content=${this.asset.isInFavorite ? this.localize.term("unfavorite") : this.localize.term("favorite")}
1399
- hoist
1400
- >
1401
- <cx-icon-button
1402
- data-testid="asset__favorite-button"
1403
- name="star"
1404
- variant=${this.asset.isInFavorite ? "filled" : "outlined"}
1405
- @click=${this.handleFavoriteClick}
1406
- ></cx-icon-button>
1407
- </cx-tooltip>`
1408
- )} `;
1409
- }
1410
- renderRetryableUploadActions() {
1411
- return o`${this.renderOpenDriveButton()}
1412
- <cx-tooltip content=${this.localize.term("retry")} hoist>
1413
- <cx-icon-button
1414
- data-testid="asset__retry-button"
1415
- name="refresh"
1416
- @click=${this.handleRetryUploadClick}
1417
- ></cx-icon-button>
1418
- </cx-tooltip>`;
1419
- }
1420
- renderInProgressActions() {
1421
- return o`
1422
- <cx-tooltip
1423
- content=${this.asset.isPaused ? this.localize.term("resume") : this.localize.term("pause")}
1424
- hoist
1425
- >
1426
- <cx-icon-button
1427
- data-testid=${this.asset.isPaused ? "asset__resume-button" : "asset__pause-button"}
1428
- name=${this.asset.isPaused ? "play_arrow" : "pause"}
1429
- variant="filled"
1430
- @click=${this.handlePauseUploadClick}
1431
- ></cx-icon-button>
1432
- </cx-tooltip>
1433
- <cx-tooltip content=${this.localize.term("cancel")} hoist>
1434
- <cx-icon-button
1435
- data-testid="asset__cancel-button"
1436
- name="close"
1437
- @click=${this.handleCancelUploadClick}
1438
- ></cx-icon-button>
1439
- </cx-tooltip>
1440
- `;
1441
- }
1442
- renderPinnedActions() {
1443
- return o`${p(
1444
- this.pinInProgressAssets.includes(this.asset.recordId),
1445
- () => o`<cx-spinner class="asset__actions__spinner"></cx-spinner>`,
1446
- () => o`<cx-tooltip
1447
- content=${this.asset.isPinned ? this.localize.term("unpin") : this.localize.term("pin")}
1448
- hoist
1449
- >
1450
- <cx-icon-button
1451
- data-testid="asset__pin-button"
1452
- name="keep"
1453
- variant=${this.asset.isPinned ? "filled" : "outlined"}
1454
- @click=${this.handlePinClick}
1455
- ></cx-icon-button>
1456
- </cx-tooltip>`
1457
- )} `;
1458
- }
1459
- render() {
1460
- return o`
1461
- <div
1462
- data-id=${this.asset.recordId}
1463
- data-testid=${`asset-${this.asset.uploadStatus}`}
1464
- class="asset"
1465
- >
1466
- ${this.renderThumbnail()}
1467
- <div class="asset__description">
1468
- <div class="asset__description__label">
1469
- <cx-line-clamp class="asset__description__label__text" lines="1">
1470
- <cx-typography variant="body3"
1471
- >${this.asset.fileName}</cx-typography
1472
- >
1473
- </cx-line-clamp>
1474
- </div>
1475
- <div class="asset__description__status">
1476
- ${p(
1477
- this.listType === x.RECENT,
1478
- () => o`
1479
- <cx-typography
1480
- variant="small"
1481
- class="asset__description__status__time"
1482
- >
1483
- <cx-relative-time
1484
- format="narrow"
1485
- numeric="always"
1486
- date=${new Date(this.asset.uploadTimestamp)}
1487
- sync
1488
- sync-interval=${O}
1489
- ></cx-relative-time>
1490
- </cx-typography>
1491
- `
1492
- )}
1493
- ${p(
1494
- this.listType === x.UPLOADS,
1495
- () => this.renderUploadingStatus()
1496
- )}
1497
- ${p(
1498
- this.listType === x.PINNED,
1499
- () => this.renderPinnedStatus()
1500
- )}
1501
- </div>
1502
- </div>
1503
- <div class="asset__actions">
1504
- ${p(this.showNormalActions, () => this.renderNormalActions())}
1505
- ${p(
1506
- this.showInProgressActions,
1507
- () => this.renderInProgressActions()
1508
- )}
1509
- ${p(
1510
- this.showRetryableUploadActions,
1511
- () => this.renderRetryableUploadActions()
1512
- )}
1513
- ${p(this.showPinnedActions, () => this.renderPinnedActions())}
1514
- </div>
1515
- </div>
1516
- `;
1517
- }
1518
- };
1519
- L.styles = [tt, Ue];
1520
- L.dependencies = {
1521
- "cx-file-on-demand-pinned-status": T,
1522
- "cx-format-bytes": ot,
1523
- "cx-icon": J,
1524
- "cx-icon-button": It,
1525
- "cx-line-clamp": Q,
1526
- "cx-progress-bar": te,
1527
- "cx-relative-time": St,
1528
- "cx-spinner": ee,
1529
- "cx-tooltip": wt,
1530
- "cx-typography": nt
1531
- };
1532
- V([
1533
- d({ type: Object })
1534
- ], L.prototype, "asset", 2);
1535
- V([
1536
- d({
1537
- attribute: "list-type",
1538
- type: String
1539
- })
1540
- ], L.prototype, "listType", 2);
1541
- V([
1542
- d({
1543
- attribute: "favorite-in-progress-assets",
1544
- converter: {
1545
- fromAttribute: (t) => t.split(" ").filter(Boolean),
1546
- toAttribute: (t) => t.join(" ")
1547
- },
1548
- type: String
1549
- })
1550
- ], L.prototype, "favoriteInProgressAssets", 2);
1551
- V([
1552
- d({
1553
- attribute: "pin-in-progress-assets",
1554
- converter: {
1555
- fromAttribute: (t) => t.split(" ").filter(Boolean),
1556
- toAttribute: (t) => t.join(" ")
1557
- },
1558
- type: String
1559
- })
1560
- ], L.prototype, "pinInProgressAssets", 2);
1561
- V([
1562
- u()
1563
- ], L.prototype, "thumbnailLoadError", 2);
1564
- L = V([
1565
- W("cx-file-on-demand-asset")
1566
- ], L);
1567
- const Oe = at`
1568
- :host {
1569
- --asset-height: 40px;
1570
- display: block;
1571
- color: var(--cx-color-neutral-900);
1572
- height: 100%;
1573
- --cx-button-text-transform: none;
1574
- --tooltip-max-width: min(80vw, 640px);
1575
- }
1576
-
1577
- .container {
1578
- display: block;
1579
- height: 100%;
1580
- }
1581
-
1582
- .container--user-interaction-blocked {
1583
- pointer-events: none;
1584
- user-select: none;
1585
- }
1586
-
1587
- .loading-overlay {
1588
- position: absolute;
1589
- top: 0;
1590
- left: 0;
1591
- width: 100%;
1592
- height: 100%;
1593
- background-color: var(--cx-color-neutral-50);
1594
- opacity: 0.8;
1595
- display: flex;
1596
- justify-content: center;
1597
- align-items: center;
1598
- z-index: var(--cx-z-index-tooltip); /* Ensure it is above other content */
1599
- }
1600
-
1601
- .assets,
1602
- .welcome {
1603
- height: 100%;
1604
- display: flex;
1605
- flex-direction: column;
1606
- }
1607
-
1608
- /* #region Icons */
1609
- .assets-list__tab-group .empty-icon {
1610
- color: var(--cx-color-neutral-600);
1611
- font-size: var(--cx-font-size-3x-large);
1612
- }
1613
-
1614
- cx-tab {
1615
- line-height: var(--cx-line-height-large);
1616
- }
1617
-
1618
- .assets-list__tab-group cx-tab {
1619
- width: calc(100% / 4);
1620
- }
1621
-
1622
- .settings__tab-group cx-tab {
1623
- width: calc(100% / 2);
1624
- }
1625
-
1626
- cx-tab::part(base) {
1627
- display: flex;
1628
- justify-content: center;
1629
- }
1630
-
1631
- cx-tab::part(label) {
1632
- text-align: center;
1633
- }
1634
-
1635
- cx-tab-panel {
1636
- --padding: 0 0 var(--cx-spacing-x-small) 0;
1637
- }
1638
-
1639
- cx-icon[slot='prefix'] {
1640
- font-size: var(--cx-font-size-large);
1641
- }
1642
-
1643
- .error-message {
1644
- color: var(--cx-color-danger);
1645
- min-height: 1ch;
1646
- }
1647
-
1648
- /** welcome */
1649
- .welcome {
1650
- justify-content: center;
1651
- align-items: center;
1652
- padding: var(--cx-spacing-x-large) var(--cx-spacing-medium)
1653
- var(--cx-spacing-medium) var(--cx-spacing-medium);
1654
- gap: var(--cx-spacing-x-large);
1655
- }
1656
-
1657
- .welcome__message {
1658
- display: flex;
1659
- flex-direction: column;
1660
- justify-content: center;
1661
- align-items: center;
1662
- gap: var(--cx-spacing-x-small);
1663
- }
1664
-
1665
- .welcome__actions {
1666
- width: 100%;
1667
- display: flex;
1668
- flex-direction: column;
1669
- justify-content: center;
1670
- gap: var(--cx-spacing-x-small);
1671
- }
1672
-
1673
- .welcome__connect-button,
1674
- .welcome__cancel-connection-button,
1675
- .welcome__input {
1676
- width: 100%;
1677
- }
1678
-
1679
- .welcome__connect-button--disabled::part(base) {
1680
- cursor: help;
1681
- }
1682
-
1683
- .welcome .error-message {
1684
- text-align: center;
1685
- }
1686
-
1687
- /** header */
1688
- .header {
1689
- display: flex;
1690
- justify-content: space-between;
1691
- background-color: var(--cx-color-neutral-50);
1692
- padding: var(--cx-spacing-x-small) var(--cx-spacing-small);
1693
- line-height: 1;
1694
- }
1695
- .header__user {
1696
- display: flex;
1697
- align-items: center;
1698
- gap: var(--cx-spacing-x-small);
1699
- overflow: hidden;
1700
- }
1701
- .header__username {
1702
- display: flex;
1703
- overflow: hidden;
1704
- }
1705
- .header__username__text {
1706
- flex-grow: 1;
1707
- flex-shrink: 1;
1708
- overflow: hidden;
1709
- }
1710
- .header__avatar {
1711
- --size: 24px;
1712
- }
1713
- .header__actions {
1714
- min-width: fit-content;
1715
- }
1716
-
1717
- .settings__version__badge::part(base) {
1718
- width: var(--cx-spacing-x-small);
1719
- padding: 0;
1720
- }
1721
-
1722
- /** assets list */
1723
- .assets-list {
1724
- flex: 1;
1725
- height: 0;
1726
- }
1727
-
1728
- /** Make sure the overflown element is .recent__list
1729
- * to trigger scroll event for infinite scroll
1730
- */
1731
- .assets-list__tab-group,
1732
- .assets-list__tab-group::part(base),
1733
- .assets-list__tab-group::part(body),
1734
- .assets-list__tab-group cx-tab-panel,
1735
- .assets-list__tab-group cx-tab-panel::part(base) {
1736
- height: 100%;
1737
- overflow: hidden;
1738
- }
1739
- .assets-list__tab-group .assets-list__tab-group__empty-message {
1740
- display: flex;
1741
- flex-direction: column;
1742
- justify-content: center;
1743
- align-items: center;
1744
- gap: var(--cx-spacing-medium);
1745
- font-size: var(--cx-font-size-x-large);
1746
- padding: var(--cx-spacing-large) 0;
1747
- text-align: center;
1748
- }
1749
-
1750
- .assets-list__tab-group .assets-list__tab-group__empty-message:not(.favorites-empty) {
1751
- margin-top: 40px; /** to that they are aligned with favorite tab */
1752
- }
1753
-
1754
- .assets-list__tab-group .recent__list,
1755
- .assets-list__tab-group .favorites__list,
1756
- .assets-list__tab-group .uploads__list,
1757
- .assets-list__tab-group .pinned__list {
1758
- height: 100%;
1759
- display: flex;
1760
- flex-direction: column;
1761
- overflow-y: auto;
1762
- overflow-x: hidden;
1763
- padding: 0 0 var(--cx-spacing-x-small) 0;
1764
- }
1765
-
1766
- .favorites-tab-panel__content,
1767
- .pinned-tab-panel__content {
1768
- display: flex;
1769
- flex-direction: column;
1770
- height: 100%;
1771
- }
1772
-
1773
- .favorites__sync-time {
1774
- display: flex;
1775
- justify-content: center;
1776
- align-items: center;
1777
- }
1778
-
1779
- .assets-list__tab-group .favorites__list,
1780
- .assets-list__tab-group .pinned__list {
1781
- flex: 1;
1782
- height: 0;
1783
- }
1784
-
1785
- .recent__other.empty,
1786
- .uploads__other.empty,
1787
- .recent__today.empty,
1788
- .uploads__today.empty {
1789
- display: none;
1790
- }
1791
-
1792
- /** status footer */
1793
- .status-footer {
1794
- padding: 0 var(--cx-spacing-small) var(--cx-spacing-small)
1795
- var(--cx-spacing-small);
1796
- display: flex;
1797
- flex-direction: column;
1798
- gap: var(--cx-spacing-2x-small);
1799
- }
1800
- .status-footer cx-typography {
1801
- line-height: 1;
1802
- }
1803
- .status-footer cx-line-clamp {
1804
- line-height: 1;
1805
- }
1806
- .status-footer .label {
1807
- color: var(--cx-color-neutral-600);
1808
- }
1809
- .status-footer .cache-usage,
1810
- .status-footer .connected-url,
1811
- .status-footer .connection-status,
1812
- .status-footer .asset-index-sync-status {
1813
- display: flex;
1814
- justify-content: space-between;
1815
- align-items: center;
1816
- }
1817
-
1818
- .status-footer .label {
1819
- color: var(--cx-color-neutral-600);
1820
- }
1821
-
1822
- .status-footer__divider {
1823
- --spacing: 0;
1824
- margin-bottom: var(--cx-spacing-small);
1825
- }
1826
-
1827
- .connected-url .label {
1828
- white-space: nowrap;
1829
- }
1830
-
1831
- .connected-url .value-line-clamp {
1832
- padding: 0 var(--cx-spacing-2x-small);
1833
- }
1834
-
1835
- .connected-url .value::part(base) {
1836
- font-weight: var(--cx-font-weight-medium);
1837
- color: var(--cx-color-neutral-900);
1838
- }
1839
-
1840
- .cache-usage__warning-icon {
1841
- color: var(--cx-color-warning-500);
1842
- }
1843
-
1844
- .status-footer .cache-usage .label {
1845
- color: var(--cx-color-primary-600);
1846
- }
1847
-
1848
- .connection-status__value {
1849
- display: flex;
1850
- align-items: center;
1851
- justify-content: center;
1852
- gap: var(--cx-spacing-2x-small);
1853
- cursor: help;
1854
- }
1855
- .connection-status__value cx-typography {
1856
- display: inline-flex;
1857
- }
1858
- .connection-status__value cx-typography::part(base) {
1859
- text-transform: capitalize;
1860
- font-weight: var(--cx-font-weight-medium);
1861
- }
1862
- .connection-status--excellent .connection-status__value {
1863
- color: var(--cx-color-success);
1864
- }
1865
- .connection-status--good .connection-status__value {
1866
- color: var(--cx-color-warning);
1867
- }
1868
- .connection-status--bad .connection-status__value {
1869
- color: var(--cx-color-danger);
1870
- }
1871
- .connection-status cx-icon {
1872
- font-size: var(--cx-font-size-medium);
1873
- }
1874
-
1875
- .asset-index-sync-status .value {
1876
- display: flex;
1877
- align-items: center;
1878
- justify-content: center;
1879
- gap: var(--cx-spacing-2x-small);
1880
- }
1881
- .asset-index-sync-status .value cx-typography {
1882
- display: inline-flex;
1883
- }
1884
- .asset-index-sync-status .value cx-typography::part(base) {
1885
- text-transform: capitalize;
1886
- font-weight: var(--cx-font-weight-medium);
1887
- }
1888
- .asset-index-sync-status--loaded .value {
1889
- color: var(--cx-color-success);
1890
- }
1891
- .asset-index-sync-status--loading .value {
1892
- color: var(--cx-color-warning);
1893
- }
1894
- .asset-index-sync-status--error .value {
1895
- color: var(--cx-color-danger);
1896
- }
1897
- .asset-index-sync-status cx-icon {
1898
- font-size: var(--cx-font-size-medium);
1899
- }
1900
-
1901
-
1902
- /** asset */
1903
- .uploads__list .asset-group__label {
1904
- display: flex;
1905
- justify-content: space-between;
1906
- align-items: center;
1907
- }
1908
-
1909
- .asset-group__clear-button::part(base) {
1910
- color: var(--cx-color-primary-500);
1911
- font-size: var(--cx-font-size-x-small);
1912
- }
1913
-
1914
- .asset-group__label {
1915
- padding: var(--cx-spacing-x-small) var(--cx-spacing-small);
1916
- color: var(--cx-color-neutral-400);
1917
- line-height: var(--cx-line-height-large);
1918
- }
1919
-
1920
- /** #region Settings */
1921
- .settings {
1922
- height: 100%;
1923
- }
1924
- .settings .error-message {
1925
- text-align: center;
1926
- }
1927
- .settings__form {
1928
- height: 100%;
1929
- display: flex;
1930
- flex-direction: column;
1931
- }
1932
- .settings__tab-group {
1933
- flex: 1;
1934
- height: 0;
1935
- }
1936
- .settings__tab-group::part(base),
1937
- .settings__tab-group::part(body) {
1938
- height: 100%;
1939
- overflow: hidden;
1940
- }
1941
- .settings__tab-group cx-tab-panel {
1942
- padding: var(--cx-spacing-medium) var(--cx-spacing-large)
1943
- var(--cx-spacing-large) var(--cx-spacing-large);
1944
- height: 100%;
1945
- overflow-y: auto;
1946
- }
1947
- .settings-group {
1948
- display: flex;
1949
- flex-direction: column;
1950
- gap: var(--cx-spacing-x-small);
1951
- }
1952
- .settings__general,
1953
- .settings__advanced {
1954
- display: flex;
1955
- flex-direction: column;
1956
- gap: calc(var(--cx-spacing-small) * 2);
1957
- }
1958
- .settings__footer {
1959
- border-top: 1px solid var(--cx-color-neutral-200);
1960
- padding: var(--cx-spacing-x-small) var(--cx-spacing-small);
1961
- display: flex;
1962
- justify-content: flex-end;
1963
- }
1964
-
1965
- .settings__footer__actions {
1966
- display: flex;
1967
- gap: var(--cx-spacing-x-small);
1968
- }
1969
-
1970
- .settings__connection-url {
1971
- display: flex;
1972
- justify-content: space-between;
1973
- }
1974
- .settings__connection-url__value {
1975
- padding: 0 var(--cx-spacing-small);
1976
- flex-grow: 1;
1977
- flex-shrink: 1;
1978
- overflow: hidden;
1979
- }
1980
-
1981
- .settings__software__version {
1982
- display: flex;
1983
- flex-direction: column;
1984
- gap: var(--cx-spacing-small);
1985
- }
1986
- .settings__software__version__value {
1987
- display: flex;
1988
- align-items: center;
1989
- justify-content: space-between;
1990
- gap: var(--cx-spacing-2x-small);
1991
- }
1992
- .settings__software__version__value__text {
1993
- flex-grow: 1;
1994
- flex-shrink: 1;
1995
- overflow: hidden;
1996
- }
1997
- .settings__software__version__install-button {
1998
- flex-shrink: 0;
1999
- }
2000
-
2001
- .settings__about {
2002
- text-align: center;
2003
- color: var(--cx-color-neutral-500);
2004
- }
2005
-
2006
- .settings__disconnect-button {
2007
- width: 100%;
2008
- }
2009
- .settings__disconnect-button::part(base),
2010
- .settings__disconnect-button cx-icon {
2011
- color: var(--cx-color-danger);
2012
- }
2013
-
2014
- .settings__cache__size {
2015
- display: flex;
2016
- gap: var(--cx-spacing-x-small);
2017
- justify-content: center;
2018
- flex-direction: column;
2019
- }
2020
- .settings__cache__size cx-input {
2021
- width: 150px;
2022
- }
2023
- .settings__cache__location {
2024
- display: flex;
2025
- flex-direction: column;
2026
- gap: var(--cx-spacing-small);
2027
- }
2028
- .settings__cache__location__label,
2029
- .settings__cache__size__label {
2030
- --color: var(--cx-color-neutral-600);
2031
- }
2032
- .settings__cache__location__value {
2033
- display: flex;
2034
- align-items: center;
2035
- justify-content: space-between;
2036
- }
2037
- .settings__cache__location__value__text {
2038
- padding: 0 var(--cx-spacing-small);
2039
- flex-grow: 1;
2040
- flex-shrink: 1;
2041
- overflow: hidden;
2042
- }
2043
- .settings__cache__location__actions {
2044
- flex-wrap: nowrap;
2045
- }
2046
- .settings__cache__location__change-button {
2047
- flex-shrink: 0;
2048
- }
2049
- /** #endregion */
2050
-
2051
- cx-tree-item:not(.selectable) {
2052
- --selected-color: var(--cx-color-neutral-700);
2053
- }
2054
-
2055
- cx-tree-item:not(:hover):not(.selectable)::part(item) {
2056
- background-color: unset;
2057
- color: var(--cx-color-neutral-700);
2058
- }
2059
-
2060
- .folder-tree {
2061
- overflow: auto;
2062
- flex: 1;
2063
- }
2064
-
2065
- .folder-tree:not(.selectable) {
2066
- max-height: 200px;
2067
- }
2068
-
2069
- .folder-tree__item::part(label) {
2070
- width: 100%;
2071
- overflow: hidden;
2072
- }
2073
-
2074
- .folder-tree__icon {
2075
- font-size: var(--cx-font-size-large);
2076
- color: var(--cx-color-neutral-600);
2077
- }
2078
-
2079
- .folder-tree__label {
2080
- display: flex;
2081
- width: 100%;
2082
- overflow: hidden;
2083
- gap: var(--cx-spacing-x-small);
2084
- line-height: var(--cx-line-height-medium);
2085
- }
2086
-
2087
- .folder-tree__label__value {
2088
- flex-grow: 1;
2089
- flex-shrink: 1;
2090
- overflow: hidden;
2091
- }
2092
-
2093
- .select-folders-popup::part(body) {
2094
- display: flex;
2095
- flex-direction: column;
2096
- gap: var(--cx-spacing-medium);
2097
- overflow: hidden;
2098
- }
2099
- .select-folders-popup .selectable-folder-tree {
2100
- flex: 1;
2101
- overflow: auto;
2102
- }
2103
- .select-folders-popup__actions {
2104
- display: flex;
2105
- justify-content: flex-end;
2106
- }
2107
- `;
2108
- var Ne = Object.defineProperty, je = Object.getOwnPropertyDescriptor, c = (t, e, i, a) => {
2109
- for (var s = a > 1 ? void 0 : a ? je(e, i) : e, n = t.length - 1, l; n >= 0; n--)
2110
- (l = t[n]) && (s = (a ? l(e, i, s) : l(s)) || s);
2111
- return a && s && Ne(e, i, s), s;
2112
- };
2113
- let r = class extends H {
2114
- constructor() {
2115
- super(...arguments), this.localize = new q(this), this.connectionEstablished = !1, this.connectionStatus = "excellent", this.connectionStatusTooltip = "", this.assetIndexSyncStatus = "loading", this.userAvatarUrl = "", this.username = "", this.recentAssets = { assets: [], hasMore: !1 }, this.favoriteAssets = { assets: [], hasMore: !1 }, this.favoritesLastSync = Date.now(), this.favoriteInProgressAssets = [], this.pinInProgressAssets = [], this.uploadingAssets = { assets: [], hasMore: !1 }, this.pinnedAssets = { assets: [], hasMore: !1 }, this.availableFolderIdentifiers = [], this.isLoading = !1, this.settings = {
2116
- cacheLocation: "Default",
2117
- cacheSize: 0,
2118
- cacheUsage: 0,
2119
- config: {
2120
- latestVersion: "",
2121
- monitoringActivated: !1,
2122
- mountPoint: "",
2123
- mountProxy: !1,
2124
- proxyTypes: [],
2125
- rootIDs: [],
2126
- siteUrl: "",
2127
- version: ""
2128
- // unlimitedDownloadRate: false,
2129
- // unlimitedUploadRate: false,
2130
- // maxDownloadRate: 0,
2131
- // maxUploadRate: 0,
2132
- }
2133
- }, this.pickCacheLocation = async () => "Default", this.hasNewVersion = !1, this.aboutContent = "", this.token = "", this.userInteractionBlocked = !1, this.isConnecting = !1, this.isCancellingConnection = !1, this.isDisconnecting = !1, this.isUpgrading = !1, this.isSettingsOpened = !1, this.rootIDs = this.settings.config.rootIDs, this._activeFoldersMode = this.rootIDs.length > 0, this.removedIds = [], this.cacheSize = et({
2134
- decimals: 2,
2135
- inputUnit: "B",
2136
- targetUnit: Z,
2137
- value: this.settings.cacheSize ?? 0
2138
- }), this.cacheLocation = this.settings.cacheLocation, this.proxyTypes = this.settings.config.proxyTypes ?? [], this.siteUrl = this.settings.config.siteUrl, this.isRecentAssetsLoading = !1, this.isFavoriteAssetsLoading = !1, this.isUploadingAssetsLoading = !1, this.isPinnedAssetsLoading = !1, this.connectError = "", this.disconnectError = "", this.upgradeError = "", this.totalCount = 0, this.folderPathsSet = /* @__PURE__ */ new Set(), this.validConnectionUrl = !1, this.isAddingRootIDs = !1, this.fetchFolders = async ({
2139
- excludes: t = [],
2140
- folderId: e,
2141
- folderPathsSet: i,
2142
- limit: a = void 0,
2143
- start: s = 0
2144
- }) => {
2145
- try {
2146
- return await Ct({
2147
- excludes: t,
2148
- folderId: e,
2149
- folderPathsSet: i,
2150
- limit: a,
2151
- searchText: this.searchText,
2152
- siteUrl: this.settings.config.siteUrl,
2153
- start: s,
2154
- token: this.token
2155
- });
2156
- } catch (n) {
2157
- n instanceof Error && n.message === "Failed to fetch" && this.emit("cx-renew-token");
2158
- }
2159
- return {
2160
- data: this.availableFolderIdentifiers,
2161
- totalCount: this.availableFolderIdentifiers.length
2162
- };
2163
- }, this.searchText = "", this.loadMore = async () => {
2164
- const t = this.availableFolderIdentifiers?.length ?? 0;
2165
- if (t >= this.totalCount)
2166
- return;
2167
- this.isLoading = !0;
2168
- const { data: e, totalCount: i } = await this.fetchFolders({
2169
- folderId: "",
2170
- folderPathsSet: this.folderPathsSet,
2171
- start: t
2172
- });
2173
- this.availableFolderIdentifiers = [
2174
- ...this.availableFolderIdentifiers ?? [],
2175
- ...e
2176
- ], this.totalCount = i, this.isLoading = !1;
2177
- };
2178
- }
2179
- connectedCallback() {
2180
- super.connectedCallback();
2181
- }
2182
- runFirstUpdated() {
2183
- this.settings.config.siteUrl && this.connect();
2184
- }
2185
- fetchData() {
2186
- if (!this.connectionEstablished) {
2187
- this.validConnectionUrl = K(this.settings.config.siteUrl);
2188
- return;
2189
- }
2190
- this.folderPathsSet = /* @__PURE__ */ new Set(), this.fetchFolders({
2191
- folderId: "",
2192
- folderPathsSet: this.folderPathsSet
2193
- }).then((t) => {
2194
- this.availableFolderIdentifiers = t.data, this.totalCount = t.totalCount;
2195
- });
2196
- }
2197
- // set recent tab as active when connection is established
2198
- async showRecentTab() {
2199
- this.connectionEstablished && (await this.updateComplete, await this.assetsListTabGroup?.updateComplete, this.assetsListTabGroup?.show(x.RECENT));
2200
- }
2201
- updateSettingsStates() {
2202
- this._activeFoldersMode = this.settings.config.rootIDs?.length > 0, this.rootIDs = this.settings.config.rootIDs ?? [], this.cacheSize = et({
2203
- decimals: 2,
2204
- inputUnit: "B",
2205
- targetUnit: Z,
2206
- value: this.settings.cacheSize ?? 0
2207
- }), this.cacheLocation = this.settings.cacheLocation ?? "Default", this.proxyTypes = this.settings.config.proxyTypes ?? [], this.siteUrl = this.settings.config.siteUrl ?? "", this.validConnectionUrl = K(this.settings.config.siteUrl);
2208
- }
2209
- get formHasChanges() {
2210
- return this.settings.cacheSize !== this.cacheSize || this.settings.cacheLocation !== this.cacheLocation || !!st(this.settings.config.proxyTypes, this.proxyTypes).length || !!st(this.settings.config.rootIDs, this.rootIDs).length;
2211
- }
2212
- connect(t = null) {
2213
- if (t?.preventDefault(), this.connectError = "", !this.siteUrl?.trim())
2214
- return;
2215
- const e = ht(this.siteUrl);
2216
- if (!K(e)) {
2217
- this.connectError = this.localize.term("pleaseEnterAValidUrl");
2218
- return;
2219
- }
2220
- this.settings.config.siteUrl = e, this.emit("cx-connect", {
2221
- detail: {
2222
- connectionUrl: this.settings.config.siteUrl
2223
- }
2224
- });
2225
- }
2226
- cancelConnection() {
2227
- this.emit("cx-cancel-connection", {
2228
- detail: {
2229
- connectionUrl: this.settings.config.siteUrl
2230
- }
2231
- });
2232
- }
2233
- disconnect() {
2234
- this.emit("cx-disconnect", {
2235
- detail: {
2236
- connectionUrl: this.settings.config.siteUrl
2237
- }
2238
- });
2239
- }
2240
- upgrade() {
2241
- this.emit("cx-upgrade");
2242
- }
2243
- clearCache() {
2244
- this.emit("cx-clear-cache");
2245
- }
2246
- importSettings() {
2247
- this.emit("cx-import-settings");
2248
- }
2249
- exportSettings() {
2250
- this.emit("cx-export-settings");
2251
- }
2252
- viewLogs(t = "") {
2253
- this.emit("cx-view-logs", {
2254
- detail: {
2255
- assetId: t
2256
- }
2257
- });
2258
- }
2259
- clearUpload() {
2260
- this.emit("cx-clear-upload");
2261
- }
2262
- saveSettings() {
2263
- this.emit("cx-save-settings", {
2264
- detail: {
2265
- settings: {
2266
- cacheLocation: this.cacheLocation,
2267
- cacheSize: et({
2268
- decimals: 2,
2269
- inputUnit: Z,
2270
- targetUnit: "B",
2271
- value: this.cacheSize
2272
- }),
2273
- cacheUsage: this.settings.cacheUsage,
2274
- config: {
2275
- latestVersion: this.settings.config.latestVersion,
2276
- monitoringActivated: this.settings.config.monitoringActivated,
2277
- mountPoint: this.settings.config.mountPoint,
2278
- mountProxy: this.settings.config.mountProxy,
2279
- proxyTypes: this.proxyTypes,
2280
- rootIDs: this.rootIDs.filter(
2281
- (t) => !this.removedIds.includes(t)
2282
- ),
2283
- siteUrl: this.settings.config.siteUrl,
2284
- version: this.settings.config.version
2285
- // maxDownloadRate: this._maxDownloadRate,
2286
- // maxUploadRate: this._maxUploadRate,
2287
- // unlimitedDownloadRate: this._unlimitedDownloadRate,
2288
- // unlimitedUploadRate: this._unlimitedUploadRate,
2289
- }
2290
- }
2291
- }
2292
- });
2293
- }
2294
- openSearch() {
2295
- this.emit("cx-open-search");
2296
- }
2297
- openDrive(t) {
2298
- this.emit("cx-open-drive", {
2299
- detail: {
2300
- asset: t
2301
- }
2302
- });
2303
- }
2304
- openCacheLocation() {
2305
- this.emit("cx-open-cache-location");
2306
- }
2307
- hideSettings() {
2308
- this.isSettingsOpened = !1, this.isDisconnecting = !1, this.disconnectError = "", this.isUpgrading = !1, this.upgradeError = "", this.updateSettingsStates();
2309
- }
2310
- showSettings() {
2311
- this.isSettingsOpened = !0;
2312
- }
2313
- requestMoreRecentAssets() {
2314
- if (!this.recentAssetsList)
2315
- return;
2316
- const { clientHeight: t, scrollHeight: e, scrollTop: i } = this.recentAssetsList;
2317
- !this.isRecentAssetsLoading && this.recentAssets.hasMore && i + t >= e - X && (this.isRecentAssetsLoading = !0, this.emit("cx-file-on-demand-load-more", {
2318
- detail: {
2319
- type: "recent"
2320
- }
2321
- }));
2322
- }
2323
- onRecentAssetsChanged() {
2324
- this.isRecentAssetsLoading = !1;
2325
- }
2326
- requestMoreFavoriteAssets() {
2327
- if (!this.favoritesAssetsList)
2328
- return;
2329
- const { clientHeight: t, scrollHeight: e, scrollTop: i } = this.favoritesAssetsList;
2330
- !this.isFavoriteAssetsLoading && this.favoriteAssets.hasMore && i + t >= e - X && (this.isFavoriteAssetsLoading = !0, this.emit("cx-file-on-demand-load-more", {
2331
- detail: {
2332
- type: "favorites"
2333
- }
2334
- }));
2335
- }
2336
- requestMorePinnedAssets() {
2337
- if (!this.pinnedAssetsList)
2338
- return;
2339
- const { clientHeight: t, scrollHeight: e, scrollTop: i } = this.pinnedAssetsList;
2340
- !this.isPinnedAssetsLoading && this.pinnedAssets.hasMore && i + t >= e - X && (this.isPinnedAssetsLoading = !0, this.emit("cx-file-on-demand-load-more", {
2341
- detail: {
2342
- type: "pinned"
2343
- }
2344
- }));
2345
- }
2346
- onPinnedAssetsChanged() {
2347
- this.isPinnedAssetsLoading = !1;
2348
- }
2349
- onFavoriteAssetsChanged() {
2350
- this.isFavoriteAssetsLoading = !1;
2351
- }
2352
- requestMoreUploadingAssets() {
2353
- if (!this.uploadsAssetsList)
2354
- return;
2355
- const { clientHeight: t, scrollHeight: e, scrollTop: i } = this.uploadsAssetsList;
2356
- !this.isUploadingAssetsLoading && this.uploadingAssets.hasMore && i + t >= e - X && (this.isUploadingAssetsLoading = !0, this.emit("cx-file-on-demand-load-more", {
2357
- detail: {
2358
- type: "uploads"
2359
- }
2360
- }));
2361
- }
2362
- onUploadingAssetsChanged() {
2363
- this.isUploadingAssetsLoading = !1;
2364
- }
2365
- async updateActiveFolderIdentifiers(t) {
2366
- const e = this.rootIDs;
2367
- this.rootIDs = t, await this.updateComplete;
2368
- const i = this.container.querySelectorAll("cx-tree-item"), a = st(this.rootIDs, e);
2369
- i.forEach((s) => {
2370
- a.includes(s.dataset.id ?? "") && vt(s);
2371
- });
2372
- }
2373
- // #region Render
2374
- renderHeader() {
2375
- const t = () => {
2376
- this.openDrive();
2377
- };
2378
- return o`
2379
- <div class="header">
2380
- <div class="header__user">
2381
- <cx-avatar
2382
- class="header__avatar"
2383
- image=${this.userAvatarUrl}
2384
- label=${this.username}
2385
- ></cx-avatar>
2386
- <div class="header__username">
2387
- <cx-line-clamp lines="1" class="header__username__text">
2388
- <cx-typography variant="body3">${this.username}</cx-typography>
2389
- </cx-line-clamp>
2390
- </div>
2391
- </div>
2392
- <div class="header__actions">
2393
- <cx-tooltip content=${this.localize.term("search")} hoist>
2394
- <cx-icon-button
2395
- data-testid="header__search-button"
2396
- name="search"
2397
- @click=${this.openSearch}
2398
- ></cx-icon-button>
2399
- </cx-tooltip>
2400
- <cx-tooltip content=${this.localize.term("openDrive")} hoist>
2401
- <cx-icon-button
2402
- data-testid="header__drive-button"
2403
- name="folder_open"
2404
- @click=${t}
2405
- ></cx-icon-button>
2406
- </cx-tooltip>
2407
- <cx-tooltip content=${this.localize.term("settings")} hoist>
2408
- <cx-icon-button
2409
- data-testid="header__settings-button"
2410
- class="header__settings"
2411
- name="settings"
2412
- @click=${this.showSettings}
2413
- >
2414
- ${p(
2415
- this.hasNewVersion,
2416
- () => o`<cx-badge
2417
- class="settings__version__badge"
2418
- slot="badge"
2419
- variant="danger"
2420
- pill
2421
- size="x-small"
2422
- ></cx-badge>`
2423
- )}
2424
- </cx-icon-button>
2425
- </cx-tooltip>
2426
- </div>
2427
- </div>
2428
- `;
2429
- }
2430
- // #region Assets
2431
- renderAsset(t, e) {
2432
- return o`<cx-file-on-demand-asset
2433
- .asset=${t}
2434
- .listType=${e}
2435
- .favoriteInProgressAssets=${this.favoriteInProgressAssets}
2436
- .pinInProgressAssets=${this.pinInProgressAssets}
2437
- ></cx-file-on-demand-asset>`;
2438
- }
2439
- renderRecentAssets() {
2440
- const t = o`
2441
- <div class="recent-empty assets-list__tab-group__empty-message">
2442
- <cx-icon class="empty-icon" name="explore"></cx-icon>
2443
- <cx-typography variant="body2">
2444
- ${this.localize.term("allViewedAssetsWillBeVisibleHere")}
2445
- </cx-typography>
2446
- </div>
2447
- `, [e, i] = ut(
2448
- this.recentAssets.assets
2449
- ), a = o`
2450
- <div class="recent__list" @scroll=${this.requestMoreRecentAssets}>
2451
- <div
2452
- class=${C({
2453
- empty: e.length === 0,
2454
- recent__today: !0
2455
- })}
2456
- data-testid="recent__today"
2457
- >
2458
- <div class="asset-group__label">
2459
- <cx-typography variant="small">
2460
- ${this.localize.term("today")}
2461
- </cx-typography>
2462
- </div>
2463
- ${U(
2464
- e,
2465
- (s) => s.recordId,
2466
- (s) => this.renderAsset(s, x.RECENT)
2467
- )}
2468
- </div>
2469
- <div
2470
- class=${C({
2471
- empty: i.length === 0,
2472
- recent__other: !0
2473
- })}
2474
- >
2475
- <div class="asset-group__label">
2476
- <cx-typography variant="small">
2477
- ${this.localize.term("allOther")}
2478
- </cx-typography>
2479
- </div>
2480
- ${U(
2481
- i,
2482
- (s) => s.recordId,
2483
- (s) => this.renderAsset(s, x.RECENT)
2484
- )}
2485
- </div>
2486
- </div>
2487
- `;
2488
- return o`
2489
- <cx-tab-panel
2490
- name=${x.RECENT}
2491
- class="assets-list__recent-tab-panel"
2492
- >
2493
- ${p(
2494
- this.recentAssets.assets.length > 0,
2495
- () => a,
2496
- () => t
2497
- )}
2498
- </cx-tab-panel>
2499
- `;
2500
- }
2501
- renderFavoriteAssets() {
2502
- const t = o`
2503
- <div class="favorites-empty assets-list__tab-group__empty-message">
2504
- <cx-icon class="empty-icon" name="star"></cx-icon>
2505
- <cx-typography variant="body2">
2506
- ${this.localize.term("allFavoriteAssetsWillBeVisibleHere")}
2507
- </cx-typography>
2508
- </div>
2509
- `, e = mt(this.favoriteAssets.assets), i = o`
2510
- <div class="favorites__list" @scroll=${this.requestMoreFavoriteAssets}>
2511
- ${U(
2512
- e,
2513
- (a) => a.recordId,
2514
- (a) => this.renderAsset(a, x.FAVORITES)
2515
- )}
2516
- </div>
2517
- `;
2518
- return o`
2519
- <cx-tab-panel
2520
- name=${x.FAVORITES}
2521
- class="assets-list__favorites-tab-panel"
2522
- >
2523
- <div class="favorites-tab-panel__content">
2524
- <div class="asset-group__label favorites__sync-time">
2525
- <cx-typography variant="small">
2526
- ${this.localize.term("favoritesSync")} -
2527
- <cx-relative-time
2528
- format="narrow"
2529
- numeric="always"
2530
- date=${new Date(this.favoritesLastSync)}
2531
- sync
2532
- sync-interval=${O}
2533
- ></cx-relative-time>
2534
- </cx-typography>
2535
- </div>
2536
- ${p(
2537
- e.length > 0,
2538
- () => i,
2539
- () => t
2540
- )}
2541
- </div>
2542
- </cx-tab-panel>
2543
- `;
2544
- }
2545
- renderUploadingAssets() {
2546
- const t = o`
2547
- <div class="uploads-empty assets-list__tab-group__empty-message">
2548
- <cx-icon class="empty-icon" name="arrow_upward"></cx-icon>
2549
- <cx-typography variant="body2">
2550
- ${this.localize.term("allAssetUploadsWillBeVisibleHere")}
2551
- </cx-typography>
2552
- </div>
2553
- `, [e, i] = ut(
2554
- this.uploadingAssets.assets
2555
- ), a = o`
2556
- <div class="uploads__list" @scroll=${this.requestMoreUploadingAssets}>
2557
- <div
2558
- class=${C({
2559
- empty: e.length === 0,
2560
- recent__today: !0
2561
- })}
2562
- data-testid="uploads__today"
2563
- >
2564
- <div class="asset-group__label">
2565
- <cx-typography variant="small">
2566
- ${this.localize.term("today")}
2567
- </cx-typography>
2568
- <cx-button
2569
- class="asset-group__clear-button"
2570
- variant="text"
2571
- size="small"
2572
- @click=${this.clearUpload}
2573
- >
2574
- ${this.localize.term("clearAll")}
2575
- </cx-button>
2576
- </div>
2577
- ${U(
2578
- e,
2579
- (s) => s.recordId,
2580
- (s) => this.renderAsset(s, x.UPLOADS)
2581
- )}
2582
- </div>
2583
- <div
2584
- class=${C({
2585
- empty: i.length === 0,
2586
- uploads__other: !0
2587
- })}
2588
- >
2589
- <div class="asset-group__label">
2590
- <cx-typography variant="small">
2591
- ${this.localize.term("allOther")}
2592
- </cx-typography>
2593
- </div>
2594
- ${U(
2595
- i,
2596
- (s) => s.recordId,
2597
- (s) => this.renderAsset(s, x.UPLOADS)
2598
- )}
2599
- </div>
2600
- </div>
2601
- `;
2602
- return o`
2603
- <cx-tab-panel
2604
- name=${x.UPLOADS}
2605
- class="assets-list__uploads-tab-panel"
2606
- >
2607
- ${p(
2608
- this.uploadingAssets.assets.length > 0,
2609
- () => a,
2610
- () => t
2611
- )}
2612
- </cx-tab-panel>
2613
- `;
2614
- }
2615
- renderPinnedAssets() {
2616
- const t = o`
2617
- <div class="pinned-empty assets-list__tab-group__empty-message">
2618
- <cx-icon class="empty-icon" name="keep"></cx-icon>
2619
- <cx-typography variant="body2">
2620
- ${this.localize.term("allPinnedAssetsWillBeVisibleHere")}
2621
- </cx-typography>
2622
- </div>
2623
- `, e = mt(this.pinnedAssets.assets), i = o`
2624
- <div class="pinned__list" @scroll=${this.requestMorePinnedAssets}>
2625
- ${U(
2626
- e,
2627
- (a) => a.recordId,
2628
- (a) => this.renderAsset(a, x.PINNED)
2629
- )}
2630
- </div>
2631
- `;
2632
- return o`
2633
- <cx-tab-panel
2634
- name=${x.PINNED}
2635
- class="assets-list__pinned-tab-panel"
2636
- >
2637
- <div class="pinned-tab-panel__content">
2638
- ${p(
2639
- e.length > 0,
2640
- () => i,
2641
- () => t
2642
- )}
2643
- </div>
2644
- </cx-tab-panel>
2645
- `;
2646
- }
2647
- renderAssetsList() {
2648
- return o`
2649
- <div class="assets-list">
2650
- <cx-tab-group
2651
- @cx-tab-show=${async (e) => {
2652
- switch (await e.target.updateComplete, e.detail.name) {
2653
- case x.RECENT:
2654
- this.requestMoreRecentAssets();
2655
- break;
2656
- case x.FAVORITES:
2657
- this.requestMoreFavoriteAssets();
2658
- break;
2659
- case x.UPLOADS:
2660
- this.requestMoreUploadingAssets();
2661
- break;
2662
- case x.PINNED:
2663
- this.requestMorePinnedAssets();
2664
- break;
2665
- }
2666
- }}
2667
- no-scroll-controls
2668
- class="assets-list__tab-group"
2669
- >
2670
- <cx-tab
2671
- active
2672
- data-testid="assets-list__recent-tab"
2673
- slot="nav"
2674
- panel=${x.RECENT}
2675
- >
2676
- ${this.localize.term("recent")}
2677
- </cx-tab>
2678
- <cx-tab
2679
- data-testid="assets-list__pins-tab"
2680
- slot="nav"
2681
- panel=${x.PINNED}
2682
- >
2683
- ${this.localize.term("pins")}
2684
- </cx-tab>
2685
- <cx-tab
2686
- data-testid="assets-list__favorites-tab"
2687
- slot="nav"
2688
- panel=${x.FAVORITES}
2689
- >
2690
- ${this.localize.term("favorites")}
2691
- </cx-tab>
2692
- <cx-tab
2693
- data-testid="assets-list__uploads-tab"
2694
- slot="nav"
2695
- panel=${x.UPLOADS}
2696
- >
2697
- ${this.localize.term("uploads")}
2698
- </cx-tab>
2699
- ${this.renderRecentAssets()} ${this.renderFavoriteAssets()}
2700
- ${this.renderUploadingAssets()} ${this.renderPinnedAssets()}
2701
- </cx-tab-group>
2702
- </div>
2703
- `;
2704
- }
2705
- renderAssetsView() {
2706
- return o`
2707
- <div class="assets">
2708
- ${this.renderHeader()}${this.renderAssetsList()}${this.renderStatusFooter()}
2709
- </div>
2710
- `;
2711
- }
2712
- onSearch() {
2713
- this.folderPathsSet = /* @__PURE__ */ new Set(), this.fetchFolders({
2714
- folderId: "",
2715
- folderPathsSet: this.folderPathsSet
2716
- }).then((t) => {
2717
- this.availableFolderIdentifiers = t.data, this.totalCount = t.totalCount;
2718
- });
2719
- }
2720
- renderSelectFoldersPopup() {
2721
- const t = () => {
2722
- this.folderTree.rootIDs = this.rootIDs, this.dialog.show();
2723
- }, e = (s = null) => {
2724
- s?.target && s.target !== this.dialog || (this.folderTree.resetTree(), this.folderTree.rootIDs = [], this.folderTree.removedIDs = [], this.dialog.hide(), this.searchText = "");
2725
- }, i = async () => {
2726
- this.isAddingRootIDs = !0, await this.updateComplete, this.searchText = "";
2727
- const s = this.rootIDs.filter((h) => {
2728
- if (!this.folderTree.shadowRoot?.querySelector(
2729
- `[data-id="${I(h).id}"]`
2730
- ))
2731
- return !0;
2732
- }), n = /* @__PURE__ */ new Set([
2733
- ...this.folderTree.currentRootIDs,
2734
- ...s
2735
- ]);
2736
- for (const h of n) {
2737
- const _ = R(I(h).path), m = this.folderTree.removedIDs.filter(
2738
- (g) => R(I(g).path).startsWith(_)
2739
- );
2740
- if (m.length > 0) {
2741
- const { totalCount: g } = await this.fetchFolders({
2742
- excludes: m.map((f) => I(f).id),
2743
- folderId: I(h).id,
2744
- start: 0
2745
- }), { data: $ } = await this.fetchFolders({
2746
- excludes: m.map((f) => I(f).id),
2747
- folderId: I(h).id,
2748
- limit: g || 10,
2749
- start: 0
2750
- });
2751
- $.forEach((f) => {
2752
- n.add(
2753
- N({ id: f.id, path: f.fullPath })
2754
- );
2755
- }), n.delete(h);
2756
- }
2757
- }
2758
- const l = Array.from(n);
2759
- this.updateActiveFolderIdentifiers(l), this.removedIds = l.filter(
2760
- (h) => [...l].some((_) => {
2761
- const m = I(h), g = I(_), $ = R(g.path);
2762
- return _ !== h && m.path.startsWith($);
2763
- })
2764
- ), e(), this.isAddingRootIDs = !1;
2765
- }, a = (s) => {
2766
- const n = s.target;
2767
- this.searchText = (n.value ?? "").trim();
2768
- };
2769
- return o`
2770
- <cx-dialog
2771
- class="select-folders-popup"
2772
- no-header
2773
- @cx-after-hide=${e}
2774
- .boundary=${this.container}
2775
- >
2776
- <cx-input
2777
- autofocus
2778
- clearable
2779
- @cx-input=${a}
2780
- value=${this.searchText}
2781
- placeholder=${this.localize.term("search")}
2782
- >
2783
- <cx-icon name="search" slot="prefix"></cx-icon>
2784
- </cx-input>
2785
- ${this.renderSelectableFolderTree()}
2786
- <div class="select-folders-popup__actions">
2787
- <cx-button
2788
- ?loading=${this.isAddingRootIDs}
2789
- variant="primary"
2790
- @click=${i}
2791
- >
2792
- ${this.localize.term("add")}
2793
- </cx-button>
2794
- </div>
2795
- </cx-dialog>
2796
- <cx-button
2797
- data-testid="settings__select-folders-button"
2798
- @click=${t}
2799
- >
2800
- <cx-icon name="folder" slot="prefix"></cx-icon>
2801
- ${this.localize.term("selectFolders")}
2802
- </cx-button>
2803
- `;
2804
- }
2805
- renderSelectableFolderTree() {
2806
- const t = this.availableFolderIdentifiers;
2807
- return o`
2808
- <cx-folder-tree
2809
- class="selectable-folder-tree"
2810
- .siteUrl=${this.settings.config.siteUrl}
2811
- .token=${this.token}
2812
- .searchText=${this.searchText}
2813
- .folders=${t}
2814
- .rootIDs=${this.rootIDs}
2815
- .totalCount=${this.totalCount}
2816
- .loadMore=${this.loadMore}
2817
- .folderPathsSet=${this.folderPathsSet}
2818
- ?isLoading=${this.isLoading}
2819
- ></cx-folder-tree>
2820
- `;
2821
- }
2822
- renderRootFolderTree() {
2823
- if (!this.rootIDs.length)
2824
- return Ut;
2825
- const t = this.rootIDs.filter(
2826
- (a) => !this.removedIds.includes(a)
2827
- ), e = (a) => {
2828
- this.updateActiveFolderIdentifiers(
2829
- t.filter(
2830
- (s) => I(s).id !== a
2831
- )
2832
- ), this.folderTree.rootIDs = this.rootIDs, this.folderTree.resetTree();
2833
- }, i = (a) => {
2834
- const { id: s, path: n } = I(a), l = () => {
2835
- e(s);
2836
- };
2837
- return o`
2838
- <cx-tree-item
2839
- data-id=${s}
2840
- class=${C({
2841
- "folder-tree__item": !0
2842
- })}
2843
- >
2844
- <div class="folder-tree__label">
2845
- <cx-icon class="folder-tree__icon" name="folder"></cx-icon>
2846
- <cx-line-clamp lines="1" class="folder-tree__label__value">
2847
- ${n}
2848
- </cx-line-clamp>
2849
- </div>
2850
- <cx-tooltip
2851
- slot="actions"
2852
- content=${this.localize.term("removeFolder", 1)}
2853
- hoist
2854
- >
2855
- <cx-icon-button
2856
- @click=${l}
2857
- name="close"
2858
- ></cx-icon-button>
2859
- </cx-tooltip>
2860
- </cx-tree-item>
2861
- `;
2862
- };
2863
- return o`
2864
- <div data-testid="root-folder-tree" class="folder-tree">
2865
- <cx-tree selection="none">
2866
- ${U(
2867
- t,
2868
- (a) => a,
2869
- (a) => i(a)
2870
- )}
2871
- >
2872
- </cx-tree>
2873
- </div>
2874
- `;
2875
- }
2876
- handleActiveFolderChange(t) {
2877
- t.target.value === "custom" ? (this._activeFoldersMode = !0, this.rootIDs = this.settings.config.rootIDs ?? []) : (this._activeFoldersMode = !1, this.rootIDs = []);
2878
- }
2879
- renderGeneralSettings() {
2880
- const t = o`
2881
- <div class="settings-group settings__active-folder">
2882
- <cx-typography variant="h5">
2883
- ${this.localize.term("activeFolders")}
2884
- </cx-typography>
2885
- <cx-typography variant="body3">
2886
- ${this.localize.term("activeFoldersHelpText")}
2887
- </cx-typography>
2888
- <cx-select
2889
- data-testid="settings__active-folder-select"
2890
- hoist
2891
- input-behavior="none"
2892
- value=${this._activeFoldersMode ? "custom" : "all"}
2893
- @cx-change=${this.handleActiveFolderChange}
2894
- >
2895
- <cx-option value="all">
2896
- ${this.localize.term("allFoldersDefault")}
2897
- </cx-option>
2898
- <cx-option value="custom">${this.localize.term("custom")}</cx-option>
2899
- </cx-select>
2900
- ${p(
2901
- this._activeFoldersMode,
2902
- () => o`
2903
- ${this.renderRootFolderTree()} ${this.renderSelectFoldersPopup()}
2904
- `
2905
- )}
2906
- </div>
2907
- `;
2908
- return o`
2909
- <div class="settings__general">
2910
- ${t}
2911
- <div class="settings-group settings__software">
2912
- <cx-typography variant="h5">
2913
- ${this.localize.term("software")}
2914
- </cx-typography>
2915
- <div class="settings__software__version">
2916
- <div class="settings__software__version__value">
2917
- <cx-line-clamp
2918
- lines="1"
2919
- class="settings__software__version__value__text"
2920
- >
2921
- <cx-typography variant="body3">
2922
- ${this.localize.term("currentVersion")}
2923
- ${gt(this.settings.config.version ?? "")}
2924
- </cx-typography>
2925
- </cx-line-clamp>
2926
- </div>
2927
- ${p(
2928
- this.hasNewVersion,
2929
- () => o`<div class="settings__software__version__value">
2930
- <cx-badge
2931
- class="settings__version__badge"
2932
- slot="badge"
2933
- variant="danger"
2934
- pill
2935
- size="x-small"
2936
- ></cx-badge>
2937
-
2938
- <cx-line-clamp
2939
- lines="1"
2940
- class="settings__software__version__value__text"
2941
- >
2942
- <cx-typography variant="body3">
2943
- ${this.localize.term(
2944
- "newVersionAvailable",
2945
- gt(
2946
- this.settings.config.latestVersion ?? ""
2947
- )
2948
- )}
2949
- </cx-typography>
2950
- </cx-line-clamp>
2951
- <cx-button
2952
- size="small"
2953
- ?loading=${this.isUpgrading}
2954
- class="settings__software__version__install-button"
2955
- outline
2956
- @click=${this.upgrade}
2957
- >
2958
- <cx-icon name="install_desktop" slot="prefix"></cx-icon>
2959
- ${this.localize.term("download")}
2960
- </cx-button>
2961
- </div>`
2962
- )}
2963
- </div>
2964
- </div>
2965
- <div class="settings-group settings__connection">
2966
- <cx-typography variant="h5">
2967
- ${this.localize.term("connection")}
2968
- </cx-typography>
2969
- <div class="settings__connection-url">
2970
- <cx-typography variant="body3">URL:</cx-typography>
2971
- <cx-line-clamp class="settings__connection-url__value" lines="1">
2972
- <cx-typography variant="body3">
2973
- ${this.settings.config.siteUrl}
2974
- </cx-typography>
2975
- </cx-line-clamp>
2976
- </div>
2977
- </div>
2978
- <cx-space direction="vertical">
2979
- <div class="settings__disconnect">
2980
- <cx-button
2981
- slot="trigger"
2982
- ?loading=${this.isDisconnecting}
2983
- text
2984
- variant="text"
2985
- class="settings__disconnect-button"
2986
- @click=${this.disconnect}
2987
- >
2988
- <cx-icon name="cloud_off" slot="prefix"></cx-icon>
2989
- ${this.localize.term("disconnect")}
2990
- </cx-button>
2991
- <cx-typography class="error-message" variant="body3">
2992
- ${this.disconnectError}
2993
- </cx-typography>
2994
- </div>
2995
- </cx-space>
2996
- <div class="settings-group settings__about">
2997
- <div data-testid="settings__about__content">
2998
- <cx-typography variant="small">${this.aboutContent}</cx-typography>
2999
- </div>
3000
- </div>
3001
- </div>
3002
- `;
3003
- }
3004
- handleProxyChange(t) {
3005
- const i = t.target.value;
3006
- i.includes("All") ? this.proxyTypes = ["All"] : this.proxyTypes = i;
3007
- }
3008
- handleCacheSizeKeydown(t) {
3009
- const e = /\d/;
3010
- // Block minus sign and non-numeric characters
3011
- (t.key === "Minus" || // for key="-" (Firefox)
3012
- t.key === "-" || // for key="-" (Chrome)
3013
- t.key.length === 1 && !e.test(t.key)) && t.preventDefault();
3014
- }
3015
- handleCacheSizeChange(t) {
3016
- const e = t.target;
3017
- if (Number(e.value) < 0) {
3018
- e.setCustomValidity(this.localize.term("cacheSizeCannotBeNegative"));
3019
- return;
3020
- }
3021
- this.cacheSize = Number(e.value);
3022
- }
3023
- async handleCacheLocationClick() {
3024
- const t = await this.pickCacheLocation();
3025
- this.cacheLocation = t;
3026
- }
3027
- async handleCacheLocationChange() {
3028
- await this.updateComplete, this.cacheLocationValueText?.handleResize();
3029
- }
3030
- renderAdvancedSettings() {
3031
- const t = o`<cx-tooltip
3032
- content=${this.localize.term("openDrive")}
3033
- hoist
3034
- >
3035
- <cx-icon-button
3036
- data-testid="settings__cache__location__open-button"
3037
- name="folder_open"
3038
- outline
3039
- @click=${this.openCacheLocation}
3040
- ></cx-icon-button>
3041
- </cx-tooltip>`;
3042
- return o`
3043
- <div class="settings__advanced">
3044
- <div class="settings-group settings__proxy">
3045
- <cx-typography variant="h5">Proxy</cx-typography>
3046
- <cx-select
3047
- class="settings__proxy__select"
3048
- label=${this.localize.term("types")}
3049
- multiple
3050
- input-behavior="none"
3051
- value=${(this.proxyTypes ?? []).join(" ")}
3052
- @cx-change=${this.handleProxyChange}
3053
- >
3054
- <cx-option
3055
- value="Image"
3056
- ?disabled=${(this.proxyTypes ?? []).includes("All")}
3057
- >${this.localize.term("image")}</cx-option
3058
- >
3059
- <cx-option
3060
- value="Video"
3061
- ?disabled=${(this.proxyTypes ?? []).includes("All")}
3062
- >${this.localize.term("video")}</cx-option
3063
- >
3064
- <cx-option
3065
- value="Audio"
3066
- ?disabled=${(this.proxyTypes ?? []).includes("All")}
3067
- >${this.localize.term("audio")}</cx-option
3068
- >
3069
- <cx-option value="All">${this.localize.term("all")}</cx-option>
3070
- </cx-select>
3071
- <cx-typography variant="small">
3072
- ${this.localize.term(
3073
- "itCanTakeAFewMinutesForThisSettingToTakeEffect"
3074
- )}
3075
- </cx-typography>
3076
- </div>
3077
- <div class="settings-group settings__cache">
3078
- <cx-typography variant="h5">
3079
- ${this.localize.term("cache")}
3080
- </cx-typography>
3081
- <div class="settings__cache__size">
3082
- <cx-typography
3083
- variant="body3"
3084
- class="settings__cache__size__label"
3085
- >
3086
- ${this.localize.term("currentUsage")}: <cx-format-bytes .value=${this.settings.cacheUsage}></cx-format-bytes>
3087
- </cx-typography>
3088
- <cx-typography
3089
- variant="body3"
3090
- class="settings__cache__size__label"
3091
- >
3092
- ${this.localize.term("capacity")}
3093
- </cx-typography>
3094
- <cx-input
3095
- data-testid="settings__cache__size__input"
3096
- label=${this.localize.term("size")}
3097
- type="number"
3098
- no-spin-buttons
3099
- min="0"
3100
- step="any"
3101
- value=${this.cacheSize}
3102
- @keydown=${this.handleCacheSizeKeydown}
3103
- @cx-change=${this.handleCacheSizeChange}
3104
- >
3105
- <cx-typography slot="suffix" variant="body2"
3106
- >${Z}</cx-typography
3107
- >
3108
- </cx-input>
3109
- </div>
3110
- <div class="settings__cache__location">
3111
- <cx-typography
3112
- variant="body3"
3113
- class="settings__cache__location__label"
3114
- >
3115
- ${this.localize.term("location")}
3116
- </cx-typography>
3117
- <div class="settings__cache__location__value">
3118
- <cx-line-clamp
3119
- lines="1"
3120
- class="settings__cache__location__value__text"
3121
- >
3122
- <cx-typography variant="body3">
3123
- ${this.cacheLocation}
3124
- </cx-typography>
3125
- </cx-line-clamp>
3126
- <cx-space
3127
- spacing="x-small"
3128
- class="settings__cache__location__actions"
3129
- >
3130
- <cx-button
3131
- class="settings__cache__location__change-button"
3132
- outline
3133
- @click=${this.handleCacheLocationClick}
3134
- >
3135
- <cx-icon name="edit" slot="prefix"></cx-icon>
3136
- ${this.localize.term("change")}
3137
- </cx-button>
3138
- ${t}
3139
- </cx-space>
3140
- </div>
3141
- </div>
3142
-
3143
- <div class="settings__cache__buttons">
3144
- <cx-button
3145
- data-testid="settings__cache__clear-button"
3146
- @click=${this.clearCache}
3147
- >
3148
- <cx-icon name="delete" slot="prefix"></cx-icon>
3149
- ${this.localize.term("clearCache")}
3150
- </cx-button>
3151
- </div>
3152
- </div>
3153
- <div class="settings-group settings__config">
3154
- <cx-typography variant="h5">
3155
- ${this.localize.term("config")}
3156
- </cx-typography>
3157
- <div class="settings__config__buttons">
3158
- <cx-button
3159
- data-testid="settings__config__export-button"
3160
- @click=${this.exportSettings}
3161
- >
3162
- <cx-icon name="file_download" slot="prefix"></cx-icon>
3163
- ${this.localize.term("export")}
3164
- </cx-button>
3165
- <cx-button
3166
- @click=${this.importSettings}
3167
- data-testid="settings__config__import-button"
3168
- >
3169
- <cx-icon name="file_upload" slot="prefix"></cx-icon>
3170
- ${this.localize.term("import")}
3171
- </cx-button>
3172
- </div>
3173
- </div>
3174
- <div class="settings-group settings__logs">
3175
- <cx-typography variant="h5">
3176
- ${this.localize.term("logs")}
3177
- </cx-typography>
3178
- <div class="settings__logs__buttons">
3179
- <cx-button
3180
- data-testid="settings__logs__view-button"
3181
- @click=${this.viewLogs}
3182
- >
3183
- <cx-icon name="code" slot="prefix"></cx-icon>
3184
- ${this.localize.term("view")}
3185
- </cx-button>
3186
- </div>
3187
- </div>
3188
- </div>
3189
- `;
3190
- }
3191
- renderSettingsView() {
3192
- const t = () => {
3193
- this.hideSettings();
3194
- };
3195
- return o`
3196
- <div class="settings">
3197
- <form class="settings__form" @submit=${(i) => {
3198
- i.preventDefault(), this.saveSettings();
3199
- }}>
3200
- <cx-tab-group no-scroll-controls class="settings__tab-group">
3201
- <cx-tab
3202
- active
3203
- class="settings_general-tab"
3204
- slot="nav"
3205
- panel="general"
3206
- >
3207
- ${this.localize.term("general")}
3208
- </cx-tab>
3209
- <cx-tab
3210
- data-testid="settings_advanced-tab"
3211
- slot="nav"
3212
- panel="advanced"
3213
- >
3214
- ${this.localize.term("advanced")}
3215
- </cx-tab>
3216
- <cx-tab-panel name="general">
3217
- ${this.renderGeneralSettings()}
3218
- </cx-tab-panel>
3219
- <cx-tab-panel name="advanced" class="settings_advanced-tab-panel">
3220
- ${this.renderAdvancedSettings()}
3221
- </cx-tab-panel>
3222
- </cx-tab-group>
3223
- <div class="settings__footer">
3224
- <div class="settings__footer__actions">
3225
- <cx-button
3226
- data-testid="settings__cancel-button"
3227
- type="button"
3228
- @click=${t}
3229
- >
3230
- ${this.localize.term("cancel")}
3231
- </cx-button>
3232
- <cx-button
3233
- data-testid="settings__save-button"
3234
- ?disabled=${!this.formHasChanges}
3235
- type="submit"
3236
- variant="primary"
3237
- >
3238
- ${this.localize.term("save")}
3239
- </cx-button>
3240
- </div>
3241
- </div>
3242
- </form>
3243
- </div>
3244
- `;
3245
- }
3246
- // #endregion
3247
- renderStatusFooter() {
3248
- const t = o`
3249
- <cx-typography class="error-message" variant="small">
3250
- ${this.localize.term("fileOnDemandSyncErrorMessage")}
3251
- </cx-typography>
3252
- `, e = () => {
3253
- switch (this.connectionStatus) {
3254
- case "excellent":
3255
- return o`
3256
- <cx-icon variant="filled" name="check_circle"></cx-icon>
3257
- `;
3258
- case "good":
3259
- return o` <cx-icon variant="filled" name="circle"></cx-icon> `;
3260
- case "bad":
3261
- return o` <cx-icon variant="filled" name="circle"></cx-icon> `;
3262
- }
3263
- }, i = () => {
3264
- switch (this.assetIndexSyncStatus) {
3265
- case "loaded":
3266
- return o`
3267
- <cx-icon variant="filled" name="check_circle"></cx-icon>
3268
- `;
3269
- case "loading":
3270
- return o` <cx-icon variant="filled" name="cached"></cx-icon> `;
3271
- case "error":
3272
- return o` <cx-icon variant="filled" name="error"></cx-icon> `;
3273
- }
3274
- }, a = o`<div
3275
- class=${C({
3276
- "connection-status": !0,
3277
- "connection-status--bad": this.connectionStatus === "bad",
3278
- "connection-status--excellent": this.connectionStatus === "excellent",
3279
- "connection-status--good": this.connectionStatus === "good"
3280
- })}
3281
- >
3282
- <cx-typography class="label" variant="small">
3283
- ${this.localize.term("connection")}
3284
- </cx-typography>
3285
- <cx-tooltip
3286
- class="connection-status__tooltip"
3287
- content=${this.connectionStatusTooltip}
3288
- hoist
3289
- ?disabled=${!this.connectionStatusTooltip.trim()}
3290
- >
3291
- <div class="connection-status__value">
3292
- <cx-typography variant="small">
3293
- ${this.connectionStatus}
3294
- </cx-typography>
3295
- ${e()}
3296
- </div>
3297
- </cx-tooltip>
3298
- </div>`, s = this.settings.cacheUsage >= this.settings.cacheSize;
3299
- return o`
3300
- <cx-divider class="status-footer__divider"></cx-divider>
3301
- <div class="status-footer">
3302
- <div class="connected-url">
3303
- <cx-typography class="label" variant="small">
3304
- ${this.localize.term("connectedTo")}
3305
- </cx-typography>
3306
- <cx-line-clamp class="value-line-clamp" lines="1">
3307
- <cx-typography class="value" variant="small">
3308
- ${this.settings.config.siteUrl}
3309
- </cx-typography>
3310
- </cx-line-clamp>
3311
- </div>
3312
- ${a}
3313
- <div
3314
- class=${C({
3315
- "asset-index-sync-status": !0,
3316
- "asset-index-sync-status--error": this.assetIndexSyncStatus === "error",
3317
- "asset-index-sync-status--loaded": this.assetIndexSyncStatus === "loaded",
3318
- "asset-index-sync-status--loading": this.assetIndexSyncStatus === "loading"
3319
- })}
3320
- >
3321
- <cx-typography class="label" variant="small">
3322
- ${this.localize.term("assetIndexSync")}
3323
- </cx-typography>
3324
- <div class="value">
3325
- <cx-typography variant="small">
3326
- ${ue[this.assetIndexSyncStatus]}
3327
- </cx-typography>
3328
- ${i()}
3329
- </div>
3330
- </div>
3331
- <div class="cache-usage">
3332
- <cx-typography class="label" variant="small">
3333
- ${this.localize.term("cache")}
3334
- </cx-typography>
3335
- <cx-tooltip ?disabled=${!s} content=${this.localize.term("cacheUsageWarning")}>
3336
- <cx-space spacing="3x-small">
3337
- <cx-line-clamp class="value-line-clamp" lines="1">
3338
- <cx-typography class="value" variant="small">
3339
- <cx-format-bytes .value=${this.settings.cacheUsage}></cx-format-bytes>
3340
- /
3341
- <cx-format-bytes .value=${this.settings.cacheSize}></cx-format-bytes>
3342
- </cx-typography>
3343
- </cx-line-clamp>
3344
- ${p(s, () => o`<cx-icon class="cache-usage__warning-icon" name="warning" variant="filled"></cx-icon>`)}
3345
- </cx-space>
3346
- </cx-tooltip>
3347
- </div>
3348
- ${p(this.assetIndexSyncStatus === "error", () => t)}
3349
- </div>
3350
- `;
3351
- }
3352
- handleConnectionURLInput(t) {
3353
- this.validConnectionUrl = !0, this.siteUrl = t.target.value.trim();
3354
- const e = ht(this.siteUrl);
3355
- K(e) || (this.validConnectionUrl = !1);
3356
- }
3357
- renderWelcomeView() {
3358
- return o`
3359
- <div class="welcome">
3360
- <div class="welcome__message">
3361
- <cx-typography variant="h5">
3362
- ${this.localize.term("welcomeToFileOnDemand")}
3363
- </cx-typography>
3364
- <cx-typography variant="body3">
3365
- ${this.localize.term("enterYourSiteUrlToConnect")}
3366
- </cx-typography>
3367
- </div>
3368
- <form class="welcome__actions" @submit=${this.connect}>
3369
- <cx-input
3370
- aria-label=${this.localize.term("connectionURLInput")}
3371
- class="welcome__input"
3372
- placeholder="Ex: https://cortex.orangelogic.com/"
3373
- value=${this.settings.config.siteUrl}
3374
- @cx-input=${this.handleConnectionURLInput}
3375
- ></cx-input>
3376
- <cx-tooltip
3377
- class="welcome__connect-button__tooltip"
3378
- ?disabled=${this.siteUrl.trim() && this.validConnectionUrl}
3379
- content=${this.siteUrl.trim() ? this.localize.term("pleaseEnterAValidUrl") : this.localize.term("connectionCannotBeEmpty")}
3380
- >
3381
- <cx-button
3382
- type="submit"
3383
- ?loading=${this.isConnecting}
3384
- variant="primary"
3385
- class=${C({
3386
- "welcome__connect-button": !0,
3387
- "welcome__connect-button--disabled": !this.siteUrl.trim() || !this.validConnectionUrl
3388
- })}
3389
- ?disabled=${!this.siteUrl.trim() || !this.validConnectionUrl}
3390
- >
3391
- ${this.localize.term("connect")}
3392
- </cx-button>
3393
- </cx-tooltip>
3394
- <cx-button
3395
- type="button"
3396
- ?loading=${this.isCancellingConnection}
3397
- variant="text"
3398
- class=${C({
3399
- "welcome__cancel-connection-button": !0
3400
- })}
3401
- ?disabled=${!this.isConnecting}
3402
- @click=${this.cancelConnection}
3403
- >
3404
- ${this.localize.term("cancel")}
3405
- </cx-button>
3406
- <cx-typography class="error-message" variant="body3">
3407
- ${p(
3408
- this.connectError,
3409
- () => this.connectError,
3410
- () => " "
3411
- )}
3412
- </cx-typography>
3413
- </form>
3414
- </div>
3415
- `;
3416
- }
3417
- renderView() {
3418
- return this.connectionEstablished ? this.isSettingsOpened ? this.renderSettingsView() : this.renderAssetsView() : this.renderWelcomeView();
3419
- }
3420
- renderLoadingOverlay() {
3421
- return o`
3422
- <div class="loading-overlay">
3423
- <cx-spinner></cx-spinner>
3424
- </div>
3425
- `;
3426
- }
3427
- render() {
3428
- return o`
3429
- <div
3430
- class=${C({
3431
- container: !0,
3432
- "container--connected": this.connectionEstablished,
3433
- "container--user-interaction-blocked": this.userInteractionBlocked
3434
- })}
3435
- >
3436
- ${this.renderView()}
3437
- ${p(this.userInteractionBlocked, () => this.renderLoadingOverlay())}
3438
- </div>
3439
- `;
3440
- }
3441
- // #endregion
3442
- };
3443
- r.styles = Oe;
3444
- r.dependencies = {
3445
- "cx-avatar": Ot,
3446
- "cx-button": Nt,
3447
- "cx-confirm-popover": Kt,
3448
- "cx-dialog": jt,
3449
- "cx-divider": Bt,
3450
- "cx-file-on-demand-asset": L,
3451
- "cx-folder-tree": b,
3452
- "cx-format-bytes": ot,
3453
- "cx-icon": J,
3454
- "cx-icon-button": It,
3455
- "cx-input": Mt,
3456
- "cx-line-clamp": Q,
3457
- "cx-option": Vt,
3458
- "cx-relative-time": St,
3459
- "cx-select": Ht,
3460
- "cx-space": Wt,
3461
- "cx-tab": qt,
3462
- "cx-tab-group": Gt,
3463
- "cx-tab-panel": Yt,
3464
- "cx-tooltip": wt,
3465
- "cx-tree": yt,
3466
- "cx-tree-item": ft,
3467
- "cx-typography": nt
3468
- };
3469
- c([
3470
- z(".container")
3471
- ], r.prototype, "container", 2);
3472
- c([
3473
- z("cx-folder-tree")
3474
- ], r.prototype, "folderTree", 2);
3475
- c([
3476
- z("cx-dialog")
3477
- ], r.prototype, "dialog", 2);
3478
- c([
3479
- z(".recent__list")
3480
- ], r.prototype, "recentAssetsList", 2);
3481
- c([
3482
- z(".favorites__list")
3483
- ], r.prototype, "favoritesAssetsList", 2);
3484
- c([
3485
- z(".uploads__list")
3486
- ], r.prototype, "uploadsAssetsList", 2);
3487
- c([
3488
- z(".pinned__list")
3489
- ], r.prototype, "pinnedAssetsList", 2);
3490
- c([
3491
- z(".assets-list__tab-group")
3492
- ], r.prototype, "assetsListTabGroup", 2);
3493
- c([
3494
- z(".settings__cache__location__value__text")
3495
- ], r.prototype, "cacheLocationValueText", 2);
3496
- c([
3497
- d({
3498
- attribute: "connection-established",
3499
- type: Boolean
3500
- })
3501
- ], r.prototype, "connectionEstablished", 2);
3502
- c([
3503
- d({
3504
- attribute: "connection-status",
3505
- reflect: !0,
3506
- type: String
3507
- })
3508
- ], r.prototype, "connectionStatus", 2);
3509
- c([
3510
- d({
3511
- attribute: "connection-status-tooltip",
3512
- type: String
3513
- })
3514
- ], r.prototype, "connectionStatusTooltip", 2);
3515
- c([
3516
- d({
3517
- attribute: "asset-index-sync-status",
3518
- reflect: !0,
3519
- type: String
3520
- })
3521
- ], r.prototype, "assetIndexSyncStatus", 2);
3522
- c([
3523
- d({
3524
- attribute: "user-avatar-url",
3525
- type: String
3526
- })
3527
- ], r.prototype, "userAvatarUrl", 2);
3528
- c([
3529
- d({
3530
- type: String
3531
- })
3532
- ], r.prototype, "username", 2);
3533
- c([
3534
- d({
3535
- attribute: "recent-assets",
3536
- type: Object
3537
- })
3538
- ], r.prototype, "recentAssets", 2);
3539
- c([
3540
- d({
3541
- attribute: "favorite-assets",
3542
- type: Object
3543
- })
3544
- ], r.prototype, "favoriteAssets", 2);
3545
- c([
3546
- d({
3547
- attribute: "favorite-last-sync",
3548
- type: Number
3549
- })
3550
- ], r.prototype, "favoritesLastSync", 2);
3551
- c([
3552
- d({
3553
- attribute: "favorite-in-progress-assets",
3554
- converter: {
3555
- fromAttribute: (t) => t.split(" ").filter(Boolean),
3556
- toAttribute: (t) => t.join(" ")
3557
- },
3558
- type: String
3559
- })
3560
- ], r.prototype, "favoriteInProgressAssets", 2);
3561
- c([
3562
- d({
3563
- attribute: "pin-in-progress-assets",
3564
- converter: {
3565
- fromAttribute: (t) => t.split(" ").filter(Boolean),
3566
- toAttribute: (t) => t.join(" ")
3567
- },
3568
- type: String
3569
- })
3570
- ], r.prototype, "pinInProgressAssets", 2);
3571
- c([
3572
- d({
3573
- attribute: "uploading-assets",
3574
- type: Object
3575
- })
3576
- ], r.prototype, "uploadingAssets", 2);
3577
- c([
3578
- d({
3579
- attribute: "pinned-assets",
3580
- type: Object
3581
- })
3582
- ], r.prototype, "pinnedAssets", 2);
3583
- c([
3584
- u()
3585
- ], r.prototype, "availableFolderIdentifiers", 2);
3586
- c([
3587
- u()
3588
- ], r.prototype, "isLoading", 2);
3589
- c([
3590
- d({
3591
- attribute: "settings",
3592
- type: Object
3593
- })
3594
- ], r.prototype, "settings", 2);
3595
- c([
3596
- d({ attribute: "pick-cache-location", type: Function })
3597
- ], r.prototype, "pickCacheLocation", 2);
3598
- c([
3599
- d({
3600
- attribute: "has-new-version",
3601
- type: Boolean
3602
- })
3603
- ], r.prototype, "hasNewVersion", 2);
3604
- c([
3605
- d({
3606
- attribute: "about-content",
3607
- type: String
3608
- })
3609
- ], r.prototype, "aboutContent", 2);
3610
- c([
3611
- d({ type: String })
3612
- ], r.prototype, "token", 2);
3613
- c([
3614
- d({
3615
- attribute: "user-interaction-blocked",
3616
- type: Boolean
3617
- })
3618
- ], r.prototype, "userInteractionBlocked", 2);
3619
- c([
3620
- d({
3621
- attribute: "is-connecting",
3622
- type: Boolean
3623
- })
3624
- ], r.prototype, "isConnecting", 2);
3625
- c([
3626
- d({
3627
- attribute: "is-cancelling-connection",
3628
- type: Boolean
3629
- })
3630
- ], r.prototype, "isCancellingConnection", 2);
3631
- c([
3632
- d({
3633
- attribute: "is-disconnecting",
3634
- type: Boolean
3635
- })
3636
- ], r.prototype, "isDisconnecting", 2);
3637
- c([
3638
- d({
3639
- attribute: "is-upgrading",
3640
- type: Boolean
3641
- })
3642
- ], r.prototype, "isUpgrading", 2);
3643
- c([
3644
- u()
3645
- ], r.prototype, "isSettingsOpened", 2);
3646
- c([
3647
- u()
3648
- ], r.prototype, "rootIDs", 2);
3649
- c([
3650
- u()
3651
- ], r.prototype, "_activeFoldersMode", 2);
3652
- c([
3653
- u()
3654
- ], r.prototype, "removedIds", 2);
3655
- c([
3656
- u()
3657
- ], r.prototype, "cacheSize", 2);
3658
- c([
3659
- u()
3660
- ], r.prototype, "cacheLocation", 2);
3661
- c([
3662
- u()
3663
- ], r.prototype, "proxyTypes", 2);
3664
- c([
3665
- u()
3666
- ], r.prototype, "siteUrl", 2);
3667
- c([
3668
- u()
3669
- ], r.prototype, "isRecentAssetsLoading", 2);
3670
- c([
3671
- u()
3672
- ], r.prototype, "isFavoriteAssetsLoading", 2);
3673
- c([
3674
- u()
3675
- ], r.prototype, "isUploadingAssetsLoading", 2);
3676
- c([
3677
- u()
3678
- ], r.prototype, "isPinnedAssetsLoading", 2);
3679
- c([
3680
- u()
3681
- ], r.prototype, "connectError", 2);
3682
- c([
3683
- u()
3684
- ], r.prototype, "disconnectError", 2);
3685
- c([
3686
- u()
3687
- ], r.prototype, "upgradeError", 2);
3688
- c([
3689
- u()
3690
- ], r.prototype, "totalCount", 2);
3691
- c([
3692
- u()
3693
- ], r.prototype, "folderPathsSet", 2);
3694
- c([
3695
- u()
3696
- ], r.prototype, "validConnectionUrl", 2);
3697
- c([
3698
- u()
3699
- ], r.prototype, "isAddingRootIDs", 2);
3700
- c([
3701
- P(["connectionEstablished", "token"])
3702
- ], r.prototype, "fetchData", 1);
3703
- c([
3704
- P(["connectionEstablished"])
3705
- ], r.prototype, "showRecentTab", 1);
3706
- c([
3707
- P("settings")
3708
- ], r.prototype, "updateSettingsStates", 1);
3709
- c([
3710
- P("recentAssets")
3711
- ], r.prototype, "onRecentAssetsChanged", 1);
3712
- c([
3713
- P("pinnedAssets")
3714
- ], r.prototype, "onPinnedAssetsChanged", 1);
3715
- c([
3716
- P("favoriteAssets")
3717
- ], r.prototype, "onFavoriteAssetsChanged", 1);
3718
- c([
3719
- P("uploadingAssets")
3720
- ], r.prototype, "onUploadingAssetsChanged", 1);
3721
- c([
3722
- u()
3723
- ], r.prototype, "searchText", 2);
3724
- c([
3725
- P(["searchText"]),
3726
- Xt(200)
3727
- ], r.prototype, "onSearch", 1);
3728
- c([
3729
- P("cacheLocation")
3730
- ], r.prototype, "handleCacheLocationChange", 1);
3731
- r = c([
3732
- W("cx-file-on-demand")
3733
- ], r);
3734
- export {
3735
- r as C,
3736
- De as a,
3737
- Pe as b,
3738
- ze as c,
3739
- Ee as i
3740
- };