@solibo/solibo-ui 2.2.10 → 2.2.12

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 (140) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/assets/index15.css +1 -1
  3. package/dist/assets/index17.css +1 -1
  4. package/dist/assets/index21.css +1 -1
  5. package/dist/assets/index22.css +1 -1
  6. package/dist/assets/index23.css +1 -1
  7. package/dist/assets/index24.css +1 -1
  8. package/dist/assets/index25.css +1 -1
  9. package/dist/assets/index26.css +1 -1
  10. package/dist/assets/index27.css +1 -1
  11. package/dist/assets/index28.css +1 -1
  12. package/dist/assets/index29.css +1 -1
  13. package/dist/assets/index30.css +1 -1
  14. package/dist/assets/index31.css +1 -1
  15. package/dist/assets/index32.css +1 -1
  16. package/dist/assets/index33.css +1 -1
  17. package/dist/assets/index34.css +1 -1
  18. package/dist/assets/index35.css +1 -1
  19. package/dist/assets/index36.css +1 -1
  20. package/dist/assets/index37.css +1 -1
  21. package/dist/assets/index38.css +1 -1
  22. package/dist/assets/index39.css +1 -1
  23. package/dist/assets/index40.css +1 -1
  24. package/dist/assets/index41.css +1 -1
  25. package/dist/assets/index42.css +1 -1
  26. package/dist/assets/index43.css +1 -1
  27. package/dist/assets/index44.css +1 -1
  28. package/dist/assets/index45.css +1 -1
  29. package/dist/assets/index46.css +1 -1
  30. package/dist/assets/index47.css +1 -1
  31. package/dist/assets/index48.css +1 -1
  32. package/dist/assets/index49.css +1 -1
  33. package/dist/assets/index50.css +1 -1
  34. package/dist/assets/index51.css +1 -1
  35. package/dist/assets/index52.css +1 -1
  36. package/dist/assets/index53.css +1 -1
  37. package/dist/assets/index54.css +1 -1
  38. package/dist/assets/index55.css +1 -1
  39. package/dist/assets/index56.css +1 -1
  40. package/dist/assets/index57.css +1 -0
  41. package/dist/assets/index58.css +1 -0
  42. package/dist/components/app-link/index.cjs +1 -1
  43. package/dist/components/app-link/index.js +1 -1
  44. package/dist/components/app-shell/index.cjs +1 -1
  45. package/dist/components/app-shell/index.js +1 -1
  46. package/dist/components/aside/index.cjs +1 -1
  47. package/dist/components/aside/index.js +1 -1
  48. package/dist/components/avatar/index.cjs +1 -1
  49. package/dist/components/avatar/index.js +1 -1
  50. package/dist/components/badge/index.cjs +1 -1
  51. package/dist/components/badge/index.js +1 -1
  52. package/dist/components/banner/index.cjs +1 -1
  53. package/dist/components/banner/index.js +1 -1
  54. package/dist/components/branding/index.cjs +1 -1
  55. package/dist/components/branding/index.js +1 -1
  56. package/dist/components/button/index.cjs +1 -1
  57. package/dist/components/button/index.js +34 -34
  58. package/dist/components/card/index.cjs +1 -1
  59. package/dist/components/card/index.js +1 -1
  60. package/dist/components/checkbox/index.cjs +1 -1
  61. package/dist/components/checkbox/index.js +1 -1
  62. package/dist/components/chip/index.cjs +1 -1
  63. package/dist/components/chip/index.js +1 -1
  64. package/dist/components/clipboard/index.cjs +1 -1
  65. package/dist/components/clipboard/index.js +1 -1
  66. package/dist/components/collapsible/index.cjs +1 -1
  67. package/dist/components/collapsible/index.js +1 -1
  68. package/dist/components/comment/index.cjs +1 -0
  69. package/dist/components/comment/index.js +10 -0
  70. package/dist/components/comments/index.cjs +1 -0
  71. package/dist/components/comments/index.js +58 -0
  72. package/dist/components/controls/index.cjs +1 -2
  73. package/dist/components/controls/index.js +6 -139
  74. package/dist/components/croppable/index.cjs +1 -1
  75. package/dist/components/croppable/index.js +1 -1
  76. package/dist/components/dialog/index.cjs +1 -1
  77. package/dist/components/dialog/index.js +1 -1
  78. package/dist/components/divider/index.cjs +1 -1
  79. package/dist/components/divider/index.js +1 -1
  80. package/dist/components/dropdown/index.cjs +1 -1
  81. package/dist/components/dropdown/index.js +3 -3
  82. package/dist/components/dropzone/index.cjs +1 -1
  83. package/dist/components/dropzone/index.js +1 -1
  84. package/dist/components/editor/index.cjs +1 -1
  85. package/dist/components/editor/index.js +491 -470
  86. package/dist/components/empty-state/index.cjs +1 -1
  87. package/dist/components/empty-state/index.js +1 -1
  88. package/dist/components/fieldset/index.cjs +1 -1
  89. package/dist/components/fieldset/index.js +1 -1
  90. package/dist/components/figure/index.cjs +1 -1
  91. package/dist/components/figure/index.js +1 -1
  92. package/dist/components/file/index.cjs +1 -1
  93. package/dist/components/file/index.js +1 -1
  94. package/dist/components/footer/index.cjs +1 -1
  95. package/dist/components/footer/index.js +1 -1
  96. package/dist/components/form/index.cjs +1 -1
  97. package/dist/components/form/index.js +1 -1
  98. package/dist/components/graph/index.cjs +1 -1
  99. package/dist/components/graph/index.js +1 -1
  100. package/dist/components/group/index.cjs +1 -1
  101. package/dist/components/group/index.js +1 -1
  102. package/dist/components/icon/index.cjs +1 -1
  103. package/dist/components/icon/index.js +1 -1
  104. package/dist/components/iframe/index.cjs +1 -1
  105. package/dist/components/iframe/index.js +5 -5
  106. package/dist/components/input/index.cjs +1 -1
  107. package/dist/components/input/index.js +1 -1
  108. package/dist/components/link/index.cjs +1 -1
  109. package/dist/components/link/index.js +1 -1
  110. package/dist/components/list/index.cjs +1 -1
  111. package/dist/components/list/index.js +1 -1
  112. package/dist/components/loading/index.cjs +1 -1
  113. package/dist/components/loading/index.js +1 -1
  114. package/dist/components/message/index.cjs +1 -1
  115. package/dist/components/message/index.js +42 -37
  116. package/dist/components/messages/index.cjs +1 -1
  117. package/dist/components/messages/index.js +105 -79
  118. package/dist/components/popover/index.cjs +1 -1
  119. package/dist/components/popover/index.js +1 -1
  120. package/dist/components/search/index.cjs +1 -1
  121. package/dist/components/search/index.js +14 -14
  122. package/dist/components/select/index.cjs +1 -1
  123. package/dist/components/select/index.js +1 -1
  124. package/dist/components/toolbar/index.cjs +1 -1
  125. package/dist/components/toolbar/index.js +1 -1
  126. package/dist/content-Duav5qcc.js +10 -0
  127. package/dist/content-i-MRPlxK.cjs +1 -0
  128. package/dist/index-Bl5EEYDv.cjs +2 -0
  129. package/dist/index-DQuc_Zkg.js +149 -0
  130. package/dist/index-DqZSdMHT.cjs +1 -0
  131. package/dist/{index-Dd20d_9U.js → index-FSKjg3Z8.js} +1 -1
  132. package/dist/{index-Dx-KtGBg.js → index-HVXauXrX.js} +1 -1
  133. package/dist/index-KGoXYG8u.js +123 -0
  134. package/dist/{index-7blZaPiA.cjs → index-S1XsOUKE.cjs} +1 -1
  135. package/dist/{index-VLDsM9it.cjs → index-riaH5c_S.cjs} +1 -1
  136. package/dist/index.cjs +1 -1
  137. package/dist/index.d.ts +78 -3
  138. package/dist/index.js +110 -104
  139. package/dist/tokens.json +1 -1
  140. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "../avatar/index.js";
4
+ import "../button/index.js";
5
+ import "../group/index.js";
6
+ import "../icon/index.js";
7
+ import { C as a } from "../../index-KGoXYG8u.js";
8
+ export {
9
+ a as Comment
10
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const e=require("react/jsx-runtime"),s=require("react"),y=require("../button/index.cjs"),j=require("../../index-DqZSdMHT.cjs"),p=require("../icon/index.cjs"),v=require("../loading/index.cjs"),I="_comments_7c16w_1",R="_content_7c16w_26",S="_guidance_7c16w_32",k="_list_7c16w_39",c={comments:I,content:R,guidance:S,list:k},N=({comments:o,title:g,open:t,onOpenChange:l,showLabel:f="Show",hideLabel:b="Hide",guidance:a,loading:C,composer:d,status:m,pagination:q})=>{const u=s.useId(),_=s.useRef(null),r=s.useRef(null),i=s.useCallback(()=>{var h;const n=Array.from(((h=_.current)==null?void 0:h.querySelectorAll("[data-comment-id]"))??[]).find(w=>w.dataset.commentId===r.current);n&&(r.current=null,n.scrollIntoView({behavior:"smooth",block:"center"}))},[]);s.useEffect(i,[o,t,i]);const x=n=>{r.current=n,i()};return e.jsxs("div",{className:c.comments,"data-component":"comments","data-open":t,onClick:t?void 0:()=>l(!0),ref:_,children:[e.jsxs("header",{children:[e.jsx("h3",{children:g}),e.jsxs(y.Button,{"aria-controls":u,"aria-expanded":t,onClick:n=>{n.stopPropagation(),l(!t)},variant:"tertiary",children:[t?b:f,e.jsx(p.Icon,{name:t?"CaretUp":"CaretDown",size:"small"})]})]}),t&&e.jsxs("div",{className:c.content,id:u,children:[a&&e.jsx("p",{className:c.guidance,children:a}),C?e.jsx(v.Loading,{}):o.length>0&&e.jsx("ul",{className:c.list,children:o.map(n=>e.jsx("li",{children:e.jsx(j.Comment,{...n,onPublished:x})},n.id))}),q,d&&e.jsx(j.CommentComposer,{...d,onPublished:x}),m&&e.jsx("sub",{children:m})]})]})};exports.Comments=N;
@@ -0,0 +1,58 @@
1
+ import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
+ import { useId as I, useRef as C, useCallback as k, useEffect as x } from "react";
3
+ import { Button as N } from "../button/index.js";
4
+ import { C as P, a as S } from "../../index-KGoXYG8u.js";
5
+ import { Icon as j } from "../icon/index.js";
6
+ import { Loading as A } from "../loading/index.js";
7
+ import '../../assets/index37.css';const R = "_comments_7c16w_1", q = "_content_7c16w_26", z = "_guidance_7c16w_32", B = "_list_7c16w_39", c = {
8
+ comments: R,
9
+ content: q,
10
+ guidance: z,
11
+ list: B
12
+ }, V = ({
13
+ comments: r,
14
+ title: g,
15
+ open: e,
16
+ onOpenChange: l,
17
+ showLabel: p = "Show",
18
+ hideLabel: w = "Hide",
19
+ guidance: a,
20
+ loading: b,
21
+ composer: m,
22
+ status: d,
23
+ pagination: v
24
+ }) => {
25
+ const u = I(), h = C(null), s = C(null), i = k(() => {
26
+ var _;
27
+ const t = Array.from(((_ = h.current) == null ? void 0 : _.querySelectorAll("[data-comment-id]")) ?? []).find((y) => y.dataset.commentId === s.current);
28
+ t && (s.current = null, t.scrollIntoView({
29
+ behavior: "smooth",
30
+ block: "center"
31
+ }));
32
+ }, []);
33
+ x(i, [r, e, i]);
34
+ const f = (t) => {
35
+ s.current = t, i();
36
+ };
37
+ return /* @__PURE__ */ o("div", { className: c.comments, "data-component": "comments", "data-open": e, onClick: e ? void 0 : () => l(!0), ref: h, children: [
38
+ /* @__PURE__ */ o("header", { children: [
39
+ /* @__PURE__ */ n("h3", { children: g }),
40
+ /* @__PURE__ */ o(N, { "aria-controls": u, "aria-expanded": e, onClick: (t) => {
41
+ t.stopPropagation(), l(!e);
42
+ }, variant: "tertiary", children: [
43
+ e ? w : p,
44
+ /* @__PURE__ */ n(j, { name: e ? "CaretUp" : "CaretDown", size: "small" })
45
+ ] })
46
+ ] }),
47
+ e && /* @__PURE__ */ o("div", { className: c.content, id: u, children: [
48
+ a && /* @__PURE__ */ n("p", { className: c.guidance, children: a }),
49
+ b ? /* @__PURE__ */ n(A, {}) : r.length > 0 && /* @__PURE__ */ n("ul", { className: c.list, children: r.map((t) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(P, { ...t, onPublished: f }) }, t.id)) }),
50
+ v,
51
+ m && /* @__PURE__ */ n(S, { ...m, onPublished: f }),
52
+ d && /* @__PURE__ */ n("sub", { children: d })
53
+ ] })
54
+ ] });
55
+ };
56
+ export {
57
+ V as Comments
58
+ };
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const b=require("react/jsx-runtime"),Z=require("classix"),l=require("react"),ee=require("../button/index.cjs"),A=require("../../menu-popover-bqblnK6P.cjs"),te="_controls_t1re6_13",ne="_inline_t1re6_43",ie="_embedded_t1re6_48",re="_fixed_t1re6_49",oe="_adaptive_t1re6_60",se="_measurement_t1re6_65",h={controls:te,default:"_default_t1re6_28",inline:ne,embedded:ie,fixed:re,adaptive:oe,measurement:se,"non-button-content":"_non-button-content_t1re6_99","overflow-trigger":"_overflow-trigger_t1re6_128"},de={primary:2,secondary:1,tertiary:0,simple:0},ce={default:h.default,embedded:h.embedded,fixed:h.fixed,inline:h.inline},ae=s=>de[s.props.variant??"secondary"];function le({buttons:s,menuAccessibleLabel:i,triggerAccessibleLabel:n}){const x=s.map(o=>({button:o,isDanger:o.props.intent==="danger",value:o}));return b.jsx(A.MenuPopover,{triggerAccessibleLabel:n,"data-component":"overflowmenu",children:({close:o,initialFocus:r})=>b.jsx(A.MenuActionList,{actions:x,initialFocus:r,menuAccessibleLabel:i,onSelect:()=>o(),usesMenuSemantics:!0})})}const p=(s,i)=>{const n=Number.parseFloat(String(s[i]));return Number.isFinite(n)?n:0},ue=s=>{if(!s.trim().endsWith("px"))return;const i=Number.parseFloat(s);return Number.isFinite(i)?i:void 0},me=(s,i)=>{const n=s.parentElement;if(!n)return;const x=n.getBoundingClientRect(),o=getComputedStyle(n),r=x.width||n.clientWidth,S=x.left+p(o,"borderLeftWidth")+p(o,"paddingLeft"),M=x.left+r-p(o,"borderRightWidth")-p(o,"paddingRight"),_=Array.from(n.children).slice(0,Array.from(n.children).indexOf(s)),y=_.reduce((f,u)=>Math.max(f,u.getBoundingClientRect().right),S),c=_.length>0?p(o,"columnGap"):0,a=Math.max(0,M-y-c),R=(i==null?void 0:i.parent)===n?Math.max(0,r-i.parentWidth):0;return{availableWidth:R>0?Math.max(a,((i==null?void 0:i.availableWidth)??0)+R):a,parent:n,parentWidth:r}},fe=({children:s,className:i,maxVisibleButtons:n,overflow:x,overflowAccessibleLabel:o="More actions",variant:r="default",...S})=>{const M=l.Children.toArray(s),_=[],y=[];M.forEach(e=>{l.isValidElement(e)&&e.type===ee.Button?_.push(e):y.push(e)});const c=_.map((e,d)=>({button:e,index:d,rank:ae(e)})).sort((e,d)=>e.rank-d.rank||e.index-d.index).map(({button:e,index:d})=>l.cloneElement(e,{key:e.key??d})),a=r==="embedded"||r==="fixed"&&x==="menu",R=typeof n=="number"&&Number.isFinite(n)?Math.floor(n):0,f=r==="embedded"&&R>0?Math.min(c.length,R):c.length,u=l.useRef(null),N=l.useRef(void 0),z=l.useRef(null),E=l.useRef(null),[F,C]=l.useState(f),k=c.map(e=>String(e.key)).join(`
2
- `),[D,G]=l.useState(k);D!==k&&(G(k),C(f));const g=l.useCallback(()=>{var L,I,T;if(!a){C(f);return}const e=u.current,d=z.current;if(!e||!d)return;const W=Array.from(d.querySelectorAll('[data-component="button"]')),w=W.at(-1);if(!w)return;const v=W.slice(0,c.length).map(t=>t.getBoundingClientRect().width);if(v.length!==c.length)return;const m=getComputedStyle(e),H=p(m,"paddingLeft")+p(m,"paddingRight")+p(m,"borderLeftWidth")+p(m,"borderRightWidth"),J=ue(m.maxWidth),B=r==="embedded"?me(e,N.current):void 0;B&&(N.current=B);const Q=(B==null?void 0:B.availableWidth)??((L=e.parentElement)==null?void 0:L.clientWidth)??0,U=((I=window.visualViewport)==null?void 0:I.width)??document.documentElement.clientWidth,V=Math.min(...[J,Q,U].filter(t=>typeof t=="number"&&Number.isFinite(t)&&t>0));if(!Number.isFinite(V))return;const q=Math.max(0,V-H),P=((T=E.current)==null?void 0:T.getBoundingClientRect().width)??0,X=v.reduce((t,Y)=>t+Y,0);if(f===c.length&&P+X<=q){C(t=>t===f?t:f);return}let K=P+w.getBoundingClientRect().width,j=0;for(let t=0;t<f&&!(K+v[t]>q);t+=1)K+=v[t],j=t+1;C(t=>t===j?t:j)},[a,c.length,r,f]);if(l.useLayoutEffect(()=>{var d,W,w,v;if(g(),!a)return;const e=typeof ResizeObserver>"u"?void 0:new ResizeObserver(g);return u.current&&(e==null||e.observe(u.current)),(d=u.current)!=null&&d.parentElement&&(e==null||e.observe(u.current.parentElement)),r==="embedded"&&((W=u.current)!=null&&W.parentElement)&&Array.from(u.current.parentElement.children).forEach(m=>{m!==u.current&&(e==null||e.observe(m))}),E.current&&(e==null||e.observe(E.current)),window.addEventListener("resize",g),(w=window.visualViewport)==null||w.addEventListener("resize",g),(v=document.fonts)==null||v.ready.then(g),()=>{var m;e==null||e.disconnect(),window.removeEventListener("resize",g),(m=window.visualViewport)==null||m.removeEventListener("resize",g)}},[a,s,g,r]),M.length===0)return null;const $=a?c.slice(0,F):c,O=a?c.slice(F):[];return b.jsxs("div",{"data-dynamic-position":r==="fixed"?!0:void 0,"data-adaptive":a?!0:void 0,className:Z(h.controls,ce[r],a&&h.adaptive,i),ref:u,...S,"data-component":"controls",children:[a&&b.jsxs("div",{"aria-hidden":"true",className:h.measurement,ref:z,children:[c.map((e,d)=>l.cloneElement(e,{"aria-hidden":!0,id:void 0,key:`measure-${String(e.key??d)}`,onClick:void 0,ref:void 0,tabIndex:-1})),b.jsx(A.MenuPopover,{triggerAccessibleLabel:o,children:null})]}),r!=="embedded"&&y.length>0&&b.jsx("span",{className:h["non-button-content"],ref:E,children:y}),$,O.length>0&&b.jsx("span",{className:h["overflow-trigger"],children:b.jsx(le,{buttons:O,menuAccessibleLabel:o,triggerAccessibleLabel:o})})]})};exports.Controls=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("classix");require("react");require("../../menu-popover-bqblnK6P.cjs");const e=require("../../index-Bl5EEYDv.cjs");exports.Controls=e.Controls;
@@ -1,141 +1,8 @@
1
- import { jsxs as G, jsx as v } from "react/jsx-runtime";
2
- import ne from "classix";
3
- import { Children as ie, isValidElement as re, cloneElement as P, useRef as C, useState as T, useCallback as oe, useLayoutEffect as de } from "react";
4
- import { Button as se } from "../button/index.js";
5
- import { a as $, M as ce } from "../../menu-popover-Ceb_9V67.js";
6
- import '../../assets/index37.css';const ae = "_controls_t1re6_13", le = "_inline_t1re6_43", ue = "_embedded_t1re6_48", me = "_fixed_t1re6_49", fe = "_adaptive_t1re6_60", he = "_measurement_t1re6_65", f = {
7
- controls: ae,
8
- default: "_default_t1re6_28",
9
- inline: le,
10
- embedded: ue,
11
- fixed: me,
12
- adaptive: fe,
13
- measurement: he,
14
- "non-button-content": "_non-button-content_t1re6_99",
15
- "overflow-trigger": "_overflow-trigger_t1re6_128"
16
- }, pe = {
17
- primary: 2,
18
- secondary: 1,
19
- tertiary: 0,
20
- simple: 0
21
- }, ge = {
22
- default: f.default,
23
- embedded: f.embedded,
24
- fixed: f.fixed,
25
- inline: f.inline
26
- }, be = (d) => pe[d.props.variant ?? "secondary"];
27
- function ve({
28
- buttons: d,
29
- menuAccessibleLabel: i,
30
- triggerAccessibleLabel: n
31
- }) {
32
- const g = d.map((o) => ({
33
- button: o,
34
- isDanger: o.props.intent === "danger",
35
- value: o
36
- }));
37
- return /* @__PURE__ */ v($, { triggerAccessibleLabel: n, "data-component": "overflowmenu", children: ({
38
- close: o,
39
- initialFocus: r
40
- }) => /* @__PURE__ */ v(ce, { actions: g, initialFocus: r, menuAccessibleLabel: i, onSelect: () => o(), usesMenuSemantics: !0 }) });
41
- }
42
- const h = (d, i) => {
43
- const n = Number.parseFloat(String(d[i]));
44
- return Number.isFinite(n) ? n : 0;
45
- }, _e = (d) => {
46
- if (!d.trim().endsWith("px")) return;
47
- const i = Number.parseFloat(d);
48
- return Number.isFinite(i) ? i : void 0;
49
- }, xe = (d, i) => {
50
- const n = d.parentElement;
51
- if (!n) return;
52
- const g = n.getBoundingClientRect(), o = getComputedStyle(n), r = g.width || n.clientWidth, S = g.left + h(o, "borderLeftWidth") + h(o, "paddingLeft"), B = g.left + r - h(o, "borderRightWidth") - h(o, "paddingRight"), _ = Array.from(n.children).slice(0, Array.from(n.children).indexOf(d)), x = _.reduce((m, l) => Math.max(m, l.getBoundingClientRect().right), S), c = _.length > 0 ? h(o, "columnGap") : 0, a = Math.max(0, B - x - c), W = (i == null ? void 0 : i.parent) === n ? Math.max(0, r - i.parentWidth) : 0;
53
- return {
54
- availableWidth: W > 0 ? Math.max(a, ((i == null ? void 0 : i.availableWidth) ?? 0) + W) : a,
55
- parent: n,
56
- parentWidth: r
57
- };
58
- }, Me = ({
59
- children: d,
60
- className: i,
61
- maxVisibleButtons: n,
62
- overflow: g,
63
- overflowAccessibleLabel: o = "More actions",
64
- variant: r = "default",
65
- ...S
66
- }) => {
67
- const B = ie.toArray(d), _ = [], x = [];
68
- B.forEach((e) => {
69
- re(e) && e.type === se ? _.push(e) : x.push(e);
70
- });
71
- const c = _.map((e, s) => ({
72
- button: e,
73
- index: s,
74
- rank: be(e)
75
- })).sort((e, s) => e.rank - s.rank || e.index - s.index).map(({
76
- button: e,
77
- index: s
78
- }) => P(e, {
79
- key: e.key ?? s
80
- })), a = r === "embedded" || r === "fixed" && g === "menu", W = typeof n == "number" && Number.isFinite(n) ? Math.floor(n) : 0, m = r === "embedded" && W > 0 ? Math.min(c.length, W) : c.length, l = C(null), N = C(void 0), z = C(null), M = C(null), [F, E] = T(m), k = c.map((e) => String(e.key)).join(`
81
- `), [H, J] = T(k);
82
- H !== k && (J(k), E(m));
83
- const p = oe(() => {
84
- var I, q, D;
85
- if (!a) {
86
- E(m);
87
- return;
88
- }
89
- const e = l.current, s = z.current;
90
- if (!e || !s) return;
91
- const y = Array.from(s.querySelectorAll('[data-component="button"]')), w = y.at(-1);
92
- if (!w) return;
93
- const b = y.slice(0, c.length).map((t) => t.getBoundingClientRect().width);
94
- if (b.length !== c.length) return;
95
- const u = getComputedStyle(e), U = h(u, "paddingLeft") + h(u, "paddingRight") + h(u, "borderLeftWidth") + h(u, "borderRightWidth"), X = _e(u.maxWidth), R = r === "embedded" ? xe(e, N.current) : void 0;
96
- R && (N.current = R);
97
- const Y = (R == null ? void 0 : R.availableWidth) ?? ((I = e.parentElement) == null ? void 0 : I.clientWidth) ?? 0, Z = ((q = window.visualViewport) == null ? void 0 : q.width) ?? document.documentElement.clientWidth, O = Math.min(...[X, Y, Z].filter((t) => typeof t == "number" && Number.isFinite(t) && t > 0));
98
- if (!Number.isFinite(O)) return;
99
- const j = Math.max(0, O - U), K = ((D = M.current) == null ? void 0 : D.getBoundingClientRect().width) ?? 0, ee = b.reduce((t, te) => t + te, 0);
100
- if (m === c.length && K + ee <= j) {
101
- E((t) => t === m ? t : m);
102
- return;
103
- }
104
- let L = K + w.getBoundingClientRect().width, A = 0;
105
- for (let t = 0; t < m && !(L + b[t] > j); t += 1)
106
- L += b[t], A = t + 1;
107
- E((t) => t === A ? t : A);
108
- }, [a, c.length, r, m]);
109
- if (de(() => {
110
- var s, y, w, b;
111
- if (p(), !a) return;
112
- const e = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(p);
113
- return l.current && (e == null || e.observe(l.current)), (s = l.current) != null && s.parentElement && (e == null || e.observe(l.current.parentElement)), r === "embedded" && ((y = l.current) != null && y.parentElement) && Array.from(l.current.parentElement.children).forEach((u) => {
114
- u !== l.current && (e == null || e.observe(u));
115
- }), M.current && (e == null || e.observe(M.current)), window.addEventListener("resize", p), (w = window.visualViewport) == null || w.addEventListener("resize", p), (b = document.fonts) == null || b.ready.then(p), () => {
116
- var u;
117
- e == null || e.disconnect(), window.removeEventListener("resize", p), (u = window.visualViewport) == null || u.removeEventListener("resize", p);
118
- };
119
- }, [a, d, p, r]), B.length === 0)
120
- return null;
121
- const Q = a ? c.slice(0, F) : c, V = a ? c.slice(F) : [];
122
- return /* @__PURE__ */ G("div", { "data-dynamic-position": r === "fixed" ? !0 : void 0, "data-adaptive": a ? !0 : void 0, className: ne(f.controls, ge[r], a && f.adaptive, i), ref: l, ...S, "data-component": "controls", children: [
123
- a && /* @__PURE__ */ G("div", { "aria-hidden": "true", className: f.measurement, ref: z, children: [
124
- c.map((e, s) => P(e, {
125
- "aria-hidden": !0,
126
- id: void 0,
127
- key: `measure-${String(e.key ?? s)}`,
128
- onClick: void 0,
129
- ref: void 0,
130
- tabIndex: -1
131
- })),
132
- /* @__PURE__ */ v($, { triggerAccessibleLabel: o, children: null })
133
- ] }),
134
- r !== "embedded" && x.length > 0 && /* @__PURE__ */ v("span", { className: f["non-button-content"], ref: M, children: x }),
135
- Q,
136
- V.length > 0 && /* @__PURE__ */ v("span", { className: f["overflow-trigger"], children: /* @__PURE__ */ v(ve, { buttons: V, menuAccessibleLabel: o, triggerAccessibleLabel: o }) })
137
- ] });
138
- };
1
+ import "react/jsx-runtime";
2
+ import "classix";
3
+ import "react";
4
+ import "../../menu-popover-Ceb_9V67.js";
5
+ import { C as s } from "../../index-DQuc_Zkg.js";
139
6
  export {
140
- Me as Controls
7
+ s as Controls
141
8
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const i=require("react/jsx-runtime"),gt=require("classix"),c=require("react"),Vt=require("../toolbar/index.cjs"),ot=require("../button/index.cjs"),Ct=require("../figure/index.cjs"),te=require("../icon/index.cjs"),X=10,Z=.1,ee=.92,y=(s,d,R)=>Math.min(R,Math.max(d,s)),ne=s=>new Promise((d,R)=>{const f=URL.createObjectURL(s),h=new globalThis.Image;h.onload=()=>{URL.revokeObjectURL(f),d(h)},h.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},h.src=f}),re=async({file:s,fill:d,transform:R,viewport:f})=>{const h=await ne(s),z=f.width/h.naturalWidth,Q=f.height/h.naturalHeight,j=Math.max(z,Q),q=h.naturalWidth*j,k=h.naturalHeight*j,M=d==="width"?Math.max(Z,z/j):d==="height"?Math.max(Z,Q/j):Z,P=y(R.zoom,M,X),D=j*P,O=q*P,$=k*P,ct=(f.width-O)/2+R.offset.x,E=(f.height-$)/2+R.offset.y,F=y(-ct/D,0,h.naturalWidth),v=y(-E/D,0,h.naturalHeight),_=y(f.width/D,1,Math.max(1,h.naturalWidth-F)),b=y(f.height/D,1,Math.max(1,h.naturalHeight-v)),T=document.createElement("canvas"),U=T.getContext("2d");if(!U)throw new Error("croppable-image-context-missing");T.width=Math.max(1,Math.round(_)),T.height=Math.max(1,Math.round(b)),U.drawImage(h,F,v,_,b,0,0,T.width,T.height);const g=s.type.startsWith("image/")?s.type:"image/jpeg",x=await new Promise(Y=>{T.toBlob(Y,g,ee)});if(!x)throw new Error("croppable-image-export-failed");return new globalThis.File([x],s.name,{lastModified:Date.now(),type:x.type||g})},oe="_croppable_1tvcl_1",ce="_empty_1tvcl_15",se="_action_1tvcl_28",ie="_caption_1tvcl_36",ae="_media_1tvcl_43",ue="_viewport_1tvcl_54",le="_draggable_1tvcl_66",de="_dragging_1tvcl_70",fe="_inner_1tvcl_74",he="_standalone_1tvcl_90",l={croppable:oe,empty:ce,"drop-target":"_drop-target_1tvcl_23",action:se,caption:ie,media:ae,viewport:ue,draggable:le,dragging:de,inner:fe,standalone:he},pe=192,L={offset:{x:0,y:0},zoom:1},It=(s,d)=>(s==null?void 0:s.file)===d.file&&(s==null?void 0:s.source)===d.source&&(s==null?void 0:s.settings)===d.settings,me=({cancelLabel:s,children:d,deleteLabel:R,fill:f="none",height:h,image:z,isDeleting:Q,isSaving:j,onCroppableChange:q,onDelete:k,onFileChange:M,onImageChange:P,onSave:D,onTransformChange:O,saveLabel:$,standalone:ct,transform:E,uploadLabel:F})=>{const v=c.useRef(null),_=c.useRef(null),b=c.useRef(null),T=c.useRef(null),U=c.useRef(0),g=c.useRef(P),x=c.useRef(null),Y=c.useRef(null),H=c.useRef(null),G=c.useRef(new Map),u=c.useRef(L),st=c.useRef(null),[w,V]=c.useState(null),[it,at]=c.useState(null),[xt,C]=c.useState(!1),[Lt,ut]=c.useState(!1),[St,lt]=c.useState(L),[S,dt]=c.useState(null),[m,At]=c.useState({width:0,height:0}),[wt,ft]=c.useState(null),[J,tt]=c.useState(null),K=(()=>{const t=m.width,e=m.height;if(!t||!e)return{width:0,height:0,minZoom:Z};if(!w)return{width:t,height:e,minZoom:Z};const r=t/w.width,n=e/w.height,o=Math.max(r,n),a=f==="width"?r/o:f==="height"?n/o:0;return{width:w.width*o,height:w.height*o,minZoom:Math.max(Z,a)}})(),B=K.minZoom,A=E??St,N=y(A.zoom,B,X),et=it??z??null,yt=!d&&!!z&&!it&&!S,nt=!yt,_t=d??(et?i.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const e=t.currentTarget;e.naturalWidth&&e.naturalHeight&&V({width:e.naturalWidth,height:e.naturalHeight})},src:et}):null),I=_t==null,ht={file:S,source:it,settings:JSON.stringify([f,N,A.offset.x,A.offset.y,m.width,m.height])};c.useEffect(()=>{!J||!z||z===J.image&&z!==J.crop.source||(ft(J.crop),tt(null))},[z,J]);const pt=(t,e)=>{const{maxX:r,maxY:n}=Rt(e);return{x:y(t.x,-r,r),y:y(t.y,-n,n)}},bt=(t,e)=>{const r=st.current;if(!r)return null;const n=r.getBoundingClientRect(),o=t-n.left-n.width/2,a=e-n.top-n.height/2;return{x:o,y:a}},Nt=(t,e,r,n)=>{const o=y(e,B,X),a=y(r,B,X);if(o===0)return t;const p=a/o;return{x:(1-p)*n.x+p*t.x,y:(1-p)*n.y+p*t.y}},Wt=(t,e,r)=>{const n=u.current.zoom,o=y(t,B,X),a=u.current.offset,p=r?Nt(a,n,o,r):e,W=pt(p,o);u.current={zoom:o,offset:W},E||lt({zoom:o,offset:W}),O==null||O({zoom:o,offset:W})},rt=(t,e,r)=>{Y.current={zoom:t,offset:e,anchor:r??null},_.current==null&&(_.current=window.requestAnimationFrame(()=>{_.current=null;const n=Y.current;Y.current=null;const o=(n==null?void 0:n.zoom)??u.current.zoom,a=(n==null?void 0:n.offset)??u.current.offset,p=(n==null?void 0:n.anchor)??null;Wt(o,a,p)}))},Xt=t=>{if(I||!nt)return;const e=t.ctrlKey?.001:25e-5,r=u.current.zoom*Math.exp(-t.deltaY*e),n=bt(t.clientX,t.clientY);rt(r,u.current.offset,n)},Rt=t=>{const e=m.width,r=m.height;if(!e||!r)return{maxX:0,maxY:0};const n=y(t,B,X),o=K.width*n,a=K.height*n,p=Math.max(0,(o-e)/2),W=Math.max(0,(a-r)/2);return{maxX:p,maxY:W}},zt=t=>{if(tt(null),ft(null),x.current&&(URL.revokeObjectURL(x.current),x.current=null),!t){at(null),dt(null),M==null||M(null);return}const e=URL.createObjectURL(t);x.current=e,at(e),V(null),dt(t),rt(L.zoom,L.offset),u.current=L,M==null||M(t)},kt=t=>{var e;zt(((e=t.target.files)==null?void 0:e[0])??null),t.target.value=""},Mt=t=>!j&&(Array.from(t.items??[]).some(e=>e.kind==="file"&&e.type.startsWith("image/"))||Array.from(t.files??[]).some(e=>e.type.startsWith("image/"))),Yt=t=>{if(t.preventDefault(),t.stopPropagation(),U.current=0,ut(!1),j)return;const e=Array.from(t.dataTransfer.files).find(r=>r.type.startsWith("image/"));e&&zt(e)},jt=()=>{tt(null),ft(null),_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null),Y.current=null,v.current=null,b.current=null,H.current=null,G.current.clear(),C(!1),x.current&&(URL.revokeObjectURL(x.current),x.current=null),at(null),V(null),dt(null),u.current=L,lt(L),O==null||O(L),M==null||M(null)},Ht=t=>{t.stopPropagation(),jt()},Bt=t=>{t.stopPropagation(),jt(),k==null||k()},Zt=t=>{if(!(I||!nt||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const e=G.current;if(e.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.size===2){b.current=null,v.current=null,C(!1);const[r,n]=Array.from(e.values());H.current=Math.hypot(r.x-n.x,r.y-n.y);return}}v.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:u.current.offset.x,originY:u.current.offset.y}}},qt=t=>{if(I||!nt)return;if(t.pointerType==="touch"){const o=G.current;if(!o.has(t.pointerId))return;if(o.set(t.pointerId,{x:t.clientX,y:t.clientY}),o.size===2){const[a,p]=Array.from(o.values()),W=a.x-p.x,Gt=a.y-p.y,Ot=Math.hypot(W,Gt),Ut={x:(a.x+p.x)/2,y:(a.y+p.y)/2};if(H.current){const Jt=Ot/H.current,Kt=u.current.zoom*Jt,Qt=bt(Ut.x,Ut.y);rt(Kt,u.current.offset,Qt)}H.current=Ot;return}}if(v.current!==t.pointerId||!b.current||!mt)return;const e=t.clientX-b.current.x,r=t.clientY-b.current.y,n=Math.abs(e)+Math.abs(r);!xt&&n>2&&C(!0),!(n<=1)&&rt(u.current.zoom,{x:b.current.originX+e,y:b.current.originY+r})},Dt=t=>{t.pointerType==="touch"&&(G.current.delete(t.pointerId),G.current.size<2&&(H.current=null)),v.current===t.pointerId&&(v.current=null,b.current=null,C(!1))};c.useEffect(()=>{if(!E)return;const t=y(E.zoom,B,X);u.current={zoom:t,offset:pt(E.offset,t)}},[E,m.width,m.height,w==null?void 0:w.width,w==null?void 0:w.height]),c.useEffect(()=>()=>{x.current&&URL.revokeObjectURL(x.current)},[]),c.useEffect(()=>{const t=st.current;if(!t)return;const e=()=>{const o=t.getBoundingClientRect();At(a=>a.width===o.width&&a.height===o.height?a:{width:o.width,height:o.height}),q&&q(o)};e();const r=()=>e();if(window.addEventListener("scroll",r,!0),typeof ResizeObserver>"u"){const o=()=>e();return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",r,!0)}}const n=new ResizeObserver(()=>e());return n.observe(t),()=>{n.disconnect(),window.removeEventListener("scroll",r,!0)}},[q]),c.useEffect(()=>{if(E)return;const t=u.current.offset,e=pt(t,N);t.x===e.x&&t.y===e.y||(u.current={zoom:u.current.zoom,offset:e},lt(r=>({...r,offset:e})))},[N,w,m.width,m.height]),c.useEffect(()=>{et||V(null)},[et]),c.useEffect(()=>{g.current=P},[P]),c.useEffect(()=>{var r;if(!P)return;if(!S||!m.width||!m.height||d){(r=g.current)==null||r.call(g,null);return}let t=!0;const e=window.setTimeout(()=>{re({file:S,fill:f,transform:{zoom:N,offset:A.offset},viewport:m}).then(n=>{var o;t&&((o=g.current)==null||o.call(g,n))}).catch(()=>{var n;t&&((n=g.current)==null||n.call(g,null))})},75);return()=>{t=!1,window.clearTimeout(e)}},[d,N,A.offset,f,S,m]),c.useEffect(()=>()=>{_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null)},[]);const Et=Rt(N),mt=!I&&nt&&(Et.maxX>0||Et.maxY>0),vt=!I&&!yt&&!!D&&!It(wt,ht),Tt=!!z&&!d&&!!S&&!It(wt,ht),$t=!Tt&&!I&&!!(S||k),Pt=()=>{var t;return(t=T.current)==null?void 0:t.click()},Ft=t=>{t.preventDefault(),t.stopPropagation(),Pt()};return i.jsxs("div",{className:gt(l.croppable,ct&&l.standalone,Lt&&l["drop-target"]),onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),U.current+=1,ut(Mt(t.dataTransfer))},onDragOver:t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=Mt(t.dataTransfer)?"copy":"none"},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),U.current=Math.max(0,U.current-1),U.current||ut(!1)},onDrop:Yt,onClick:()=>{I&&Pt()},"data-component":"croppable",children:[i.jsx("input",{accept:"image/*",onChange:kt,ref:T,type:"file"}),i.jsx("div",{className:l.viewport,ref:st,onDragStart:t=>t.preventDefault(),onPointerDown:Zt,onPointerMove:qt,onPointerUp:Dt,onPointerCancel:Dt,onWheel:Xt,style:{"--croppable-height":`${h??pe}px`,"--croppable-zoom":N,"--croppable-x":`${A.offset.x}px`,"--croppable-y":`${A.offset.y}px`,...w?{"--croppable-image-width":`${K.width}px`,"--croppable-image-height":`${K.height}px`}:null},children:I?i.jsx("div",{className:l.empty,children:i.jsx(Ct.Figure,{children:i.jsx(te.Icon,{name:"Image",size:"large"})})}):i.jsx("div",{className:gt(l.media,mt&&l.draggable,mt&&xt&&l.dragging),children:i.jsx("div",{className:gt(l.inner),children:_t})})}),i.jsxs(Vt.Toolbar,{children:[vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{isLoading:j,"aria-label":$??"Save image",icon:"FloppyDisk",onClick:()=>{tt({image:z,crop:ht}),D==null||D()},variant:"primary"}),$&&i.jsx("span",{className:l.caption,children:$})]}),!vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":F,icon:"UploadSimple",onClick:Ft,variant:"secondary"}),i.jsx("span",{className:l.caption,children:F})]}),Tt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":s??"Cancel changes",icon:"X",onClick:Ht,variant:"secondary"}),s&&i.jsx("span",{className:l.caption,children:s})]}),$t&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":R??"Delete image",icon:"Trash",intent:"danger",isLoading:Q,onClick:Bt,variant:"secondary"}),R&&i.jsx("span",{className:l.caption,children:R})]})]})]})};exports.Croppable=me;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const i=require("react/jsx-runtime"),gt=require("classix"),c=require("react"),Vt=require("../toolbar/index.cjs"),ot=require("../button/index.cjs"),Ct=require("../figure/index.cjs"),te=require("../icon/index.cjs"),X=10,Z=.1,ee=.92,y=(s,d,R)=>Math.min(R,Math.max(d,s)),ne=s=>new Promise((d,R)=>{const f=URL.createObjectURL(s),h=new globalThis.Image;h.onload=()=>{URL.revokeObjectURL(f),d(h)},h.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},h.src=f}),re=async({file:s,fill:d,transform:R,viewport:f})=>{const h=await ne(s),z=f.width/h.naturalWidth,Q=f.height/h.naturalHeight,j=Math.max(z,Q),q=h.naturalWidth*j,k=h.naturalHeight*j,M=d==="width"?Math.max(Z,z/j):d==="height"?Math.max(Z,Q/j):Z,P=y(R.zoom,M,X),D=j*P,O=q*P,$=k*P,ct=(f.width-O)/2+R.offset.x,E=(f.height-$)/2+R.offset.y,F=y(-ct/D,0,h.naturalWidth),v=y(-E/D,0,h.naturalHeight),_=y(f.width/D,1,Math.max(1,h.naturalWidth-F)),b=y(f.height/D,1,Math.max(1,h.naturalHeight-v)),T=document.createElement("canvas"),U=T.getContext("2d");if(!U)throw new Error("croppable-image-context-missing");T.width=Math.max(1,Math.round(_)),T.height=Math.max(1,Math.round(b)),U.drawImage(h,F,v,_,b,0,0,T.width,T.height);const g=s.type.startsWith("image/")?s.type:"image/jpeg",x=await new Promise(Y=>{T.toBlob(Y,g,ee)});if(!x)throw new Error("croppable-image-export-failed");return new globalThis.File([x],s.name,{lastModified:Date.now(),type:x.type||g})},oe="_croppable_1tvcl_1",ce="_empty_1tvcl_15",se="_action_1tvcl_28",ie="_caption_1tvcl_36",ae="_media_1tvcl_43",ue="_viewport_1tvcl_54",le="_draggable_1tvcl_66",de="_dragging_1tvcl_70",fe="_inner_1tvcl_74",he="_standalone_1tvcl_90",l={croppable:oe,empty:ce,"drop-target":"_drop-target_1tvcl_23",action:se,caption:ie,media:ae,viewport:ue,draggable:le,dragging:de,inner:fe,standalone:he},pe=192,L={offset:{x:0,y:0},zoom:1},It=(s,d)=>(s==null?void 0:s.file)===d.file&&(s==null?void 0:s.source)===d.source&&(s==null?void 0:s.settings)===d.settings,me=({cancelLabel:s,children:d,deleteLabel:R,fill:f="none",height:h,image:z,isDeleting:Q,isSaving:j,onCroppableChange:q,onDelete:k,onFileChange:M,onImageChange:P,onSave:D,onTransformChange:O,saveLabel:$,standalone:ct,transform:E,uploadLabel:F})=>{const v=c.useRef(null),_=c.useRef(null),b=c.useRef(null),T=c.useRef(null),U=c.useRef(0),g=c.useRef(P),x=c.useRef(null),Y=c.useRef(null),H=c.useRef(null),G=c.useRef(new Map),u=c.useRef(L),st=c.useRef(null),[w,V]=c.useState(null),[it,at]=c.useState(null),[xt,C]=c.useState(!1),[Lt,ut]=c.useState(!1),[St,lt]=c.useState(L),[S,dt]=c.useState(null),[m,At]=c.useState({width:0,height:0}),[wt,ft]=c.useState(null),[J,tt]=c.useState(null),K=(()=>{const t=m.width,e=m.height;if(!t||!e)return{width:0,height:0,minZoom:Z};if(!w)return{width:t,height:e,minZoom:Z};const r=t/w.width,n=e/w.height,o=Math.max(r,n),a=f==="width"?r/o:f==="height"?n/o:0;return{width:w.width*o,height:w.height*o,minZoom:Math.max(Z,a)}})(),B=K.minZoom,A=E??St,N=y(A.zoom,B,X),et=it??z??null,yt=!d&&!!z&&!it&&!S,nt=!yt,_t=d??(et?i.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const e=t.currentTarget;e.naturalWidth&&e.naturalHeight&&V({width:e.naturalWidth,height:e.naturalHeight})},src:et}):null),I=_t==null,ht={file:S,source:it,settings:JSON.stringify([f,N,A.offset.x,A.offset.y,m.width,m.height])};c.useEffect(()=>{!J||!z||z===J.image&&z!==J.crop.source||(ft(J.crop),tt(null))},[z,J]);const pt=(t,e)=>{const{maxX:r,maxY:n}=Rt(e);return{x:y(t.x,-r,r),y:y(t.y,-n,n)}},bt=(t,e)=>{const r=st.current;if(!r)return null;const n=r.getBoundingClientRect(),o=t-n.left-n.width/2,a=e-n.top-n.height/2;return{x:o,y:a}},Nt=(t,e,r,n)=>{const o=y(e,B,X),a=y(r,B,X);if(o===0)return t;const p=a/o;return{x:(1-p)*n.x+p*t.x,y:(1-p)*n.y+p*t.y}},Wt=(t,e,r)=>{const n=u.current.zoom,o=y(t,B,X),a=u.current.offset,p=r?Nt(a,n,o,r):e,W=pt(p,o);u.current={zoom:o,offset:W},E||lt({zoom:o,offset:W}),O==null||O({zoom:o,offset:W})},rt=(t,e,r)=>{Y.current={zoom:t,offset:e,anchor:r??null},_.current==null&&(_.current=window.requestAnimationFrame(()=>{_.current=null;const n=Y.current;Y.current=null;const o=(n==null?void 0:n.zoom)??u.current.zoom,a=(n==null?void 0:n.offset)??u.current.offset,p=(n==null?void 0:n.anchor)??null;Wt(o,a,p)}))},Xt=t=>{if(I||!nt)return;const e=t.ctrlKey?.001:25e-5,r=u.current.zoom*Math.exp(-t.deltaY*e),n=bt(t.clientX,t.clientY);rt(r,u.current.offset,n)},Rt=t=>{const e=m.width,r=m.height;if(!e||!r)return{maxX:0,maxY:0};const n=y(t,B,X),o=K.width*n,a=K.height*n,p=Math.max(0,(o-e)/2),W=Math.max(0,(a-r)/2);return{maxX:p,maxY:W}},zt=t=>{if(tt(null),ft(null),x.current&&(URL.revokeObjectURL(x.current),x.current=null),!t){at(null),dt(null),M==null||M(null);return}const e=URL.createObjectURL(t);x.current=e,at(e),V(null),dt(t),rt(L.zoom,L.offset),u.current=L,M==null||M(t)},kt=t=>{var e;zt(((e=t.target.files)==null?void 0:e[0])??null),t.target.value=""},Mt=t=>!j&&(Array.from(t.items??[]).some(e=>e.kind==="file"&&e.type.startsWith("image/"))||Array.from(t.files??[]).some(e=>e.type.startsWith("image/"))),Yt=t=>{if(t.preventDefault(),t.stopPropagation(),U.current=0,ut(!1),j)return;const e=Array.from(t.dataTransfer.files).find(r=>r.type.startsWith("image/"));e&&zt(e)},jt=()=>{tt(null),ft(null),_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null),Y.current=null,v.current=null,b.current=null,H.current=null,G.current.clear(),C(!1),x.current&&(URL.revokeObjectURL(x.current),x.current=null),at(null),V(null),dt(null),u.current=L,lt(L),O==null||O(L),M==null||M(null)},Ht=t=>{t.stopPropagation(),jt()},Bt=t=>{t.stopPropagation(),jt(),k==null||k()},Zt=t=>{if(!(I||!nt||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const e=G.current;if(e.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.size===2){b.current=null,v.current=null,C(!1);const[r,n]=Array.from(e.values());H.current=Math.hypot(r.x-n.x,r.y-n.y);return}}v.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:u.current.offset.x,originY:u.current.offset.y}}},qt=t=>{if(I||!nt)return;if(t.pointerType==="touch"){const o=G.current;if(!o.has(t.pointerId))return;if(o.set(t.pointerId,{x:t.clientX,y:t.clientY}),o.size===2){const[a,p]=Array.from(o.values()),W=a.x-p.x,Gt=a.y-p.y,Ot=Math.hypot(W,Gt),Ut={x:(a.x+p.x)/2,y:(a.y+p.y)/2};if(H.current){const Jt=Ot/H.current,Kt=u.current.zoom*Jt,Qt=bt(Ut.x,Ut.y);rt(Kt,u.current.offset,Qt)}H.current=Ot;return}}if(v.current!==t.pointerId||!b.current||!mt)return;const e=t.clientX-b.current.x,r=t.clientY-b.current.y,n=Math.abs(e)+Math.abs(r);!xt&&n>2&&C(!0),!(n<=1)&&rt(u.current.zoom,{x:b.current.originX+e,y:b.current.originY+r})},Dt=t=>{t.pointerType==="touch"&&(G.current.delete(t.pointerId),G.current.size<2&&(H.current=null)),v.current===t.pointerId&&(v.current=null,b.current=null,C(!1))};c.useEffect(()=>{if(!E)return;const t=y(E.zoom,B,X);u.current={zoom:t,offset:pt(E.offset,t)}},[E,m.width,m.height,w==null?void 0:w.width,w==null?void 0:w.height]),c.useEffect(()=>()=>{x.current&&URL.revokeObjectURL(x.current)},[]),c.useEffect(()=>{const t=st.current;if(!t)return;const e=()=>{const o=t.getBoundingClientRect();At(a=>a.width===o.width&&a.height===o.height?a:{width:o.width,height:o.height}),q&&q(o)};e();const r=()=>e();if(window.addEventListener("scroll",r,!0),typeof ResizeObserver>"u"){const o=()=>e();return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",r,!0)}}const n=new ResizeObserver(()=>e());return n.observe(t),()=>{n.disconnect(),window.removeEventListener("scroll",r,!0)}},[q]),c.useEffect(()=>{if(E)return;const t=u.current.offset,e=pt(t,N);t.x===e.x&&t.y===e.y||(u.current={zoom:u.current.zoom,offset:e},lt(r=>({...r,offset:e})))},[N,w,m.width,m.height]),c.useEffect(()=>{et||V(null)},[et]),c.useEffect(()=>{g.current=P},[P]),c.useEffect(()=>{var r;if(!P)return;if(!S||!m.width||!m.height||d){(r=g.current)==null||r.call(g,null);return}let t=!0;const e=window.setTimeout(()=>{re({file:S,fill:f,transform:{zoom:N,offset:A.offset},viewport:m}).then(n=>{var o;t&&((o=g.current)==null||o.call(g,n))}).catch(()=>{var n;t&&((n=g.current)==null||n.call(g,null))})},75);return()=>{t=!1,window.clearTimeout(e)}},[d,N,A.offset,f,S,m]),c.useEffect(()=>()=>{_.current!=null&&(window.cancelAnimationFrame(_.current),_.current=null)},[]);const Et=Rt(N),mt=!I&&nt&&(Et.maxX>0||Et.maxY>0),vt=!I&&!yt&&!!D&&!It(wt,ht),Tt=!!z&&!d&&!!S&&!It(wt,ht),$t=!Tt&&!I&&!!(S||k),Pt=()=>{var t;return(t=T.current)==null?void 0:t.click()},Ft=t=>{t.preventDefault(),t.stopPropagation(),Pt()};return i.jsxs("div",{className:gt(l.croppable,ct&&l.standalone,Lt&&l["drop-target"]),onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),U.current+=1,ut(Mt(t.dataTransfer))},onDragOver:t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=Mt(t.dataTransfer)?"copy":"none"},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),U.current=Math.max(0,U.current-1),U.current||ut(!1)},onDrop:Yt,onClick:()=>{I&&Pt()},"data-component":"croppable",children:[i.jsx("input",{accept:"image/*",onChange:kt,ref:T,type:"file"}),i.jsx("div",{className:l.viewport,ref:st,onDragStart:t=>t.preventDefault(),onPointerDown:Zt,onPointerMove:qt,onPointerUp:Dt,onPointerCancel:Dt,onWheel:Xt,style:{"--croppable-height":`${h??pe}px`,"--croppable-zoom":N,"--croppable-x":`${A.offset.x}px`,"--croppable-y":`${A.offset.y}px`,...w?{"--croppable-image-width":`${K.width}px`,"--croppable-image-height":`${K.height}px`}:null},children:I?i.jsx("div",{className:l.empty,children:i.jsx(Ct.Figure,{children:i.jsx(te.Icon,{name:"Image",size:"large"})})}):i.jsx("div",{className:gt(l.media,mt&&l.draggable,mt&&xt&&l.dragging),children:i.jsx("div",{className:gt(l.inner),children:_t})})}),i.jsxs(Vt.Toolbar,{children:[vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{isLoading:j,"aria-label":$??"Save image",icon:"FloppyDisk",onClick:()=>{tt({image:z,crop:ht}),D==null||D()},variant:"primary"}),$&&i.jsx("span",{className:l.caption,children:$})]}),!vt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":F,icon:"UploadSimple",onClick:Ft,variant:"secondary"}),i.jsx("span",{className:l.caption,children:F})]}),Tt&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":s??"Cancel changes",icon:"X",onClick:Ht,variant:"secondary"}),s&&i.jsx("span",{className:l.caption,children:s})]}),$t&&i.jsxs("span",{className:l.action,children:[i.jsx(ot.Button,{"aria-label":R??"Delete image",icon:"Trash",intent:"danger",isLoading:Q,onClick:Bt,variant:"secondary"}),R&&i.jsx("span",{className:l.caption,children:R})]})]})]})};exports.Croppable=me;
@@ -5,7 +5,7 @@ import { Toolbar as rr } from "../toolbar/index.js";
5
5
  import { Button as it } from "../button/index.js";
6
6
  import { Figure as nr } from "../figure/index.js";
7
7
  import { Icon as er } from "../icon/index.js";
8
- import '../../assets/index38.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z) => Math.min(z, Math.max(l, c)), cr = (c) => new Promise((l, z) => {
8
+ import '../../assets/index39.css';const j = 10, F = 0.1, or = 0.92, y = (c, l, z) => Math.min(z, Math.max(l, c)), cr = (c) => new Promise((l, z) => {
9
9
  const u = URL.createObjectURL(c), d = new globalThis.Image();
10
10
  d.onload = () => {
11
11
  URL.revokeObjectURL(u), l(d);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const e=require("react/jsx-runtime"),p=require("classix"),a=require("react"),j=require("../button/index.cjs"),P=require("../icon/index.cjs"),T="_dialog_cz5d0_3",X="_close_cz5d0_34",E="_fullscreen_cz5d0_45",F="_structured_cz5d0_87",M="_content_cz5d0_87",S="_header_cz5d0_96",Y="_controls_cz5d0_101",r={dialog:T,close:X,fullscreen:E,structured:F,content:M,header:S,controls:Y},z=l=>a.Children.toArray(l).some(s=>a.isValidElement(s)?s.type===j.Button&&s.props.intent==="danger"?!0:z(s.props.children):!1),w=({children:l,className:s,controls:n,fullscreen:f=!1,header:_,onCancel:i,onClick:d,onClose:u,open:o=!1,setOpen:c,...B})=>{const g=a.useRef(null),m=z(n),h=f||_!=null||n!=null;a.useEffect(()=>{const t=g.current;t&&(o&&!t.open?t.showModal():!o&&t.open&&t.close())},[o]);const b=t=>{i==null||i(t),!(t.defaultPrevented||!c)&&(t.preventDefault(),c(!1))},q=t=>{if(d==null||d(t),m||t.defaultPrevented||t.target!==t.currentTarget||!c)return;const{bottom:N,left:R,right:D,top:k}=t.currentTarget.getBoundingClientRect();(t.clientX<R||t.clientX>D||t.clientY<k||t.clientY>N)&&c(!1)},y=t=>{u==null||u(t),o&&(c==null||c(!1))},x=c&&!m?e.jsx(j.Button,{"aria-label":"Close dialog",className:r.close,onClick:()=>c(!1),variant:"simple",children:e.jsx(P.Icon,{name:"X"})}):null;return e.jsx("dialog",{className:p(r.dialog,h&&r.structured,f&&r.fullscreen,s),onCancel:b,onClick:q,onClose:y,ref:g,...B,"data-component":"dialog",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.header,children:[_,x]}),e.jsx("div",{className:r.content,children:l}),n!=null&&e.jsx("div",{className:r.controls,children:n})]}):e.jsxs(e.Fragment,{children:[x,l]})})};exports.Dialog=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const e=require("react/jsx-runtime"),p=require("classix"),a=require("react"),j=require("../button/index.cjs"),P=require("../icon/index.cjs"),T="_dialog_cz5d0_3",X="_close_cz5d0_34",E="_fullscreen_cz5d0_45",F="_structured_cz5d0_87",M="_content_cz5d0_87",S="_header_cz5d0_96",Y="_controls_cz5d0_101",r={dialog:T,close:X,fullscreen:E,structured:F,content:M,header:S,controls:Y},z=l=>a.Children.toArray(l).some(s=>a.isValidElement(s)?s.type===j.Button&&s.props.intent==="danger"?!0:z(s.props.children):!1),w=({children:l,className:s,controls:n,fullscreen:f=!1,header:_,onCancel:i,onClick:d,onClose:u,open:o=!1,setOpen:c,...B})=>{const g=a.useRef(null),m=z(n),h=f||_!=null||n!=null;a.useEffect(()=>{const t=g.current;t&&(o&&!t.open?t.showModal():!o&&t.open&&t.close())},[o]);const b=t=>{i==null||i(t),!(t.defaultPrevented||!c)&&(t.preventDefault(),c(!1))},q=t=>{if(d==null||d(t),m||t.defaultPrevented||t.target!==t.currentTarget||!c)return;const{bottom:N,left:R,right:D,top:k}=t.currentTarget.getBoundingClientRect();(t.clientX<R||t.clientX>D||t.clientY<k||t.clientY>N)&&c(!1)},y=t=>{u==null||u(t),o&&(c==null||c(!1))},x=c&&!m?e.jsx(j.Button,{"aria-label":"Close dialog",className:r.close,onClick:()=>c(!1),variant:"simple",children:e.jsx(P.Icon,{name:"X"})}):null;return e.jsx("dialog",{className:p(r.dialog,h&&r.structured,f&&r.fullscreen,s),onCancel:b,onClick:q,onClose:y,ref:g,...B,"data-component":"dialog",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.header,children:[_,x]}),e.jsx("div",{className:r.content,children:l}),n!=null&&e.jsx("div",{className:r.controls,children:n})]}):e.jsxs(e.Fragment,{children:[x,l]})})};exports.Dialog=w;
@@ -3,7 +3,7 @@ import P from "classix";
3
3
  import B, { useRef as T, useEffect as Y } from "react";
4
4
  import { Button as N } from "../button/index.js";
5
5
  import { Icon as w } from "../icon/index.js";
6
- import '../../assets/index39.css';const A = "_dialog_cz5d0_3", F = "_close_cz5d0_34", I = "_fullscreen_cz5d0_45", M = "_structured_cz5d0_87", V = "_content_cz5d0_87", q = "_header_cz5d0_96", G = "_controls_cz5d0_101", c = {
6
+ import '../../assets/index40.css';const A = "_dialog_cz5d0_3", F = "_close_cz5d0_34", I = "_fullscreen_cz5d0_45", M = "_structured_cz5d0_87", V = "_content_cz5d0_87", q = "_header_cz5d0_96", G = "_controls_cz5d0_101", c = {
7
7
  dialog: A,
8
8
  close: F,
9
9
  fullscreen: I,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const r=require("react/jsx-runtime"),d=require("classix"),t="_divider_1oie5_1",s={divider:t},o=({className:e,...i})=>r.jsx("hr",{className:d(s.divider,e),...i,"data-component":"divider"});exports.Divider=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const r=require("react/jsx-runtime"),d=require("classix"),t="_divider_1oie5_1",s={divider:t},o=({className:e,...i})=>r.jsx("hr",{className:d(s.divider,e),...i,"data-component":"divider"});exports.Divider=o;
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import e from "classix";
3
- import '../../assets/index40.css';const o = "_divider_1oie5_1", t = {
3
+ import '../../assets/index41.css';const o = "_divider_1oie5_1", t = {
4
4
  divider: o
5
5
  }, m = ({
6
6
  className: i,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const s=require("react/jsx-runtime"),C=require("classix"),r=require("react"),V=require("../button/index.cjs"),$e=require("../../icons-BIdcCH-v.cjs"),fe=require("../../index-7blZaPiA.cjs"),De=require("../list/index.cjs"),Fe=require("../loading/index.cjs"),F=require("../../index-VLDsM9it.cjs");function L(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(L).join(" "):r.isValidElement(t)?L(t.props.children):""}function Le(t){return r.isValidElement(t)&&t.type==="option"}function Me(t){return r.isValidElement(t)&&t.type==="optgroup"}function Qe(t){return r.isValidElement(t)&&t.type===r.Fragment}function We(t){return r.isValidElement(t)&&t.type===F.Select}function Z(t,c,i=!1){const o=[];return r.Children.forEach(t,n=>{if(Qe(n))o.push(...Z(n.props.children,c,i));else if(Le(n)){const a=L(n.props.children).trim(),h=n.props.value!=null?String(n.props.value):a;o.push({disabled:i||!!n.props.disabled,groupLabel:c,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&h===""),label:n.props.children,selected:!!n.props.selected,text:a,value:h})}else Me(n)&&o.push(...Z(n.props.children,n.props.label,i||!!n.props.disabled))}),o}function ze(t){const c=t.trim();if(!c)return null;const o=[.../[*?]/.test(c)?c:`*${c}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${o}$`,"i")}function Ge(t,c){const i=ze(c),o=t.filter(n=>!n.hidden&&!n.isPlaceholder);return i?o.filter(n=>i.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):o}function Pe(t,c){return t.find(i=>i.value===c)??t.find(i=>i.isPlaceholder)??t[0]}function Te(t,c,i){var o,n;return c!=null?String(c):i!=null?String(i):((o=t.find(a=>a.selected))==null?void 0:o.value)??((n=t[0])==null?void 0:n.value)??""}function Ae(t){if(We(t)){const{children:c,placeholder:i,...o}=t.props;return{children:s.jsxs(s.Fragment,{children:[i&&s.jsx("option",{hidden:!0,value:"",children:i}),c]}),props:o}}return{children:t.props.children,props:t.props}}const Ke="_combobox_5r227_3",Oe="_dropdown_5r227_20",He="_empty_5r227_25",Je="_group_5r227_26",Ue="_placeholder_5r227_27",Xe="_filter_5r227_35",Ye="_native_5r227_45",Ze="_option_5r227_55",et="_options_5r227_76",tt="_panel_5r227_83",nt="_selected_5r227_108",st="_text_5r227_112",rt="_trigger_5r227_120",lt="_minimal_5r227_157",it="_inline_5r227_217",ot="_label_5r227_249",l={combobox:Ke,"combobox-input":"_combobox-input_5r227_12",dropdown:Oe,empty:He,group:Je,placeholder:Ue,filter:Xe,native:Ye,option:Ze,options:et,panel:tt,selected:nt,text:st,trigger:rt,minimal:lt,inline:it,label:ot,"inline-field":"_inline-field_5r227_255"};function pe(t,c){return{"--icon-svg":$e.iconSVG(t,c)}}const ct=({children:t,className:c,combobox:i=!1,createOption:o,emptyLabel:n="No matches found",errorLabel:a,onRetry:h,retryLabel:me="Retry",label:b,filterOptions:_e=!0,hasNextPage:v=!1,loading:m=!1,loadMoreLabel:be="Load more",onLoadMore:g,onOpenChange:I,onSearchChange:B,searchValue:M,renderOption:Q,searchPlaceholder:W="Filter",selectedItems:ve,variant:j="default",...xe})=>{const z=Ae(t),{defaultValue:ye,onChange:G,value:P,...he}=z.props,u=F.sanitizeSelectProps(he),{className:ge,...je}=u,ee=r.useRef(null),te=r.useRef(null),k=r.useId(),ne=r.useRef(null),x=r.useRef(null),se=r.useRef(null),re=r.useRef(null),T=r.useRef(!1),A=r.useRef(!1),K=r.useRef(g),le=!!g,w=Z(z.children),E=P!=null,O=Te(w,P,ye),[H,J]=r.useState(()=>O),[d,we]=r.useState(!1),[Ee,Re]=r.useState(""),R=M??Ee,N=r.useCallback(e=>{M===void 0&&Re(e),B==null||B(e)},[B,M]),p=r.useCallback(e=>{T.current===e||e&&u.disabled||(T.current=e,we(e),I==null||I(e),e||N(""))},[I,u.disabled,N]),q=E?String(P):H,ie={default:F.resolveColor("--colors-semantic-content-secondary"),white:F.resolveColor("--color-white","white")},oe=j==="minimal"?ie.white:ie.default,$=Pe(w,q),Ne=pe("CaretDown",oe),Se=pe("MagnifyingGlass",oe),U=Ge(w,_e?R:""),y=R.trim(),D=!!(i&&o&&y&&o.isValid(y)),Ce=b&&j==="inline"?fe.formatInlineLabel(b):b,ce=e=>e?(Q==null?void 0:Q({groupLabel:e.groupLabel,isSelected:e.value===q,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";r.useEffect(()=>{!E&&!w.some(e=>e.value===H)&&J(O)},[O,H,E,w]),r.useEffect(()=>{var e;d&&((e=x.current)==null||e.focus())},[d]),r.useEffect(()=>{if(!d)return;const e=f=>{var _;(_=te.current)!=null&&_.contains(f.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p,d]),r.useEffect(()=>{K.current=g},[g]),r.useEffect(()=>{u.disabled&&p(!1)},[p,u.disabled]);const X=r.useCallback(()=>{!T.current||u.disabled||m||a||!v||!K.current||A.current||(A.current=!0,K.current())},[a,v,m,u.disabled]);r.useEffect(()=>{if(A.current=!1,!d||u.disabled||m||a||!v||!le)return;const e=re.current,f=se.current;if(!e||!f||typeof IntersectionObserver>"u")return;let _=!0;const S=new IntersectionObserver(ke=>{_&&ke.some(qe=>qe.isIntersecting)&&X()},{root:f});return S.observe(e),()=>{_=!1,S.disconnect()}},[d,m,a,v,le,X,U.length,R,u.disabled]);const Ve=e=>{E||J(e.target.value),G==null||G(e)},Y=()=>{var e;p(!1),i||(e=ee.current)==null||e.focus()},ae=()=>{var e;N(""),p(!0),(e=x.current)==null||e.focus()},ue=()=>{!o||!D||(o.onCreate(y),ae())},Ie=e=>{var S;E||J(e);const f=ne.current;if(!f){Y();return}const _=(S=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:S.set;_==null||_.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),i?ae():Y()},Be=e=>{e.key==="Escape"&&Y(),e.key==="Enter"&&e.target===x.current&&D&&(e.preventDefault(),ue())},de=s.jsxs("div",{className:C(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,c),onKeyDown:Be,ref:te,...xe,"data-component":"dropdown",children:[s.jsx("select",{...je,"aria-hidden":"true",className:C(l.native,ge),onChange:Ve,ref:ne,tabIndex:-1,value:q,children:z.children}),i?s.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=x.current)==null?void 0:e.focus()},children:[ve,s.jsx("input",{"aria-autocomplete":"list","aria-expanded":d,"aria-label":u["aria-label"]??b??W,className:l["combobox-input"],disabled:u.disabled,onChange:e=>{N(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:W||void 0,ref:x,role:"combobox",type:"text",value:R})]}):s.jsx(V.Button,{"aria-expanded":d,"aria-haspopup":"dialog","aria-labelledby":b?`${k} ${k}-value`:void 0,className:C(l.trigger,($==null?void 0:$.isPlaceholder)&&l.placeholder),"data-open":d?"true":void 0,disabled:u.disabled,onClick:()=>p(!d),ref:ee,style:Ne,variant:"simple",children:s.jsx("span",{className:l.text,id:`${k}-value`,children:ce($)})}),d&&s.jsxs("div",{className:l.panel,children:[!i&&s.jsx(fe.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>N(e.target.value),placeholder:W,ref:x,style:Se,type:"search",value:R}),s.jsxs(De.List,{"aria-label":"Dropdown","aria-busy":m||void 0,className:l.options,ref:se,children:[U.map(e=>{const f=e.value===q;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(V.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:C(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Ie(e.value),variant:"tertiary",children:[s.jsx("span",{className:l.text,children:ce(e)}),e.groupLabel&&s.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),D&&o&&s.jsx("li",{children:s.jsx(V.Button,{"aria-label":L(o.render(y))||y,className:l.option,onClick:ue,variant:"tertiary",children:s.jsx("span",{className:l.text,children:o.render(y)})})}),U.length===0&&!D&&!m&&!a&&!v&&s.jsx("li",{className:l.empty,children:n}),a&&s.jsxs("li",{className:l.empty,children:[s.jsx("span",{role:"alert",children:a}),h&&s.jsx(V.Button,{disabled:m,onClick:h,variant:"tertiary",children:me})]}),m&&s.jsx("li",{"aria-label":"Loading",className:l.empty,role:"status",children:s.jsx(Fe.Loading,{size:"small"})}),v&&g&&!a&&s.jsx("li",{ref:re,children:s.jsx(V.Button,{className:l.option,disabled:m,onClick:X,variant:"tertiary",children:be})})]})]})]});return b?s.jsxs("div",{className:C(l.label,j==="inline"&&l["inline-field"]),"data-component":"dropdown",children:[s.jsx("span",{id:k,children:Ce}),de]}):de};exports.Dropdown=ct;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const s=require("react/jsx-runtime"),C=require("classix"),r=require("react"),V=require("../button/index.cjs"),$e=require("../../icons-BIdcCH-v.cjs"),fe=require("../../index-S1XsOUKE.cjs"),De=require("../list/index.cjs"),Fe=require("../loading/index.cjs"),F=require("../../index-riaH5c_S.cjs");function L(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(L).join(" "):r.isValidElement(t)?L(t.props.children):""}function Le(t){return r.isValidElement(t)&&t.type==="option"}function Me(t){return r.isValidElement(t)&&t.type==="optgroup"}function Qe(t){return r.isValidElement(t)&&t.type===r.Fragment}function We(t){return r.isValidElement(t)&&t.type===F.Select}function Z(t,c,i=!1){const o=[];return r.Children.forEach(t,n=>{if(Qe(n))o.push(...Z(n.props.children,c,i));else if(Le(n)){const a=L(n.props.children).trim(),h=n.props.value!=null?String(n.props.value):a;o.push({disabled:i||!!n.props.disabled,groupLabel:c,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&h===""),label:n.props.children,selected:!!n.props.selected,text:a,value:h})}else Me(n)&&o.push(...Z(n.props.children,n.props.label,i||!!n.props.disabled))}),o}function ze(t){const c=t.trim();if(!c)return null;const o=[.../[*?]/.test(c)?c:`*${c}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${o}$`,"i")}function Ge(t,c){const i=ze(c),o=t.filter(n=>!n.hidden&&!n.isPlaceholder);return i?o.filter(n=>i.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):o}function Pe(t,c){return t.find(i=>i.value===c)??t.find(i=>i.isPlaceholder)??t[0]}function Te(t,c,i){var o,n;return c!=null?String(c):i!=null?String(i):((o=t.find(a=>a.selected))==null?void 0:o.value)??((n=t[0])==null?void 0:n.value)??""}function Ae(t){if(We(t)){const{children:c,placeholder:i,...o}=t.props;return{children:s.jsxs(s.Fragment,{children:[i&&s.jsx("option",{hidden:!0,value:"",children:i}),c]}),props:o}}return{children:t.props.children,props:t.props}}const Ke="_combobox_5r227_3",Oe="_dropdown_5r227_20",He="_empty_5r227_25",Je="_group_5r227_26",Ue="_placeholder_5r227_27",Xe="_filter_5r227_35",Ye="_native_5r227_45",Ze="_option_5r227_55",et="_options_5r227_76",tt="_panel_5r227_83",nt="_selected_5r227_108",st="_text_5r227_112",rt="_trigger_5r227_120",lt="_minimal_5r227_157",it="_inline_5r227_217",ot="_label_5r227_249",l={combobox:Ke,"combobox-input":"_combobox-input_5r227_12",dropdown:Oe,empty:He,group:Je,placeholder:Ue,filter:Xe,native:Ye,option:Ze,options:et,panel:tt,selected:nt,text:st,trigger:rt,minimal:lt,inline:it,label:ot,"inline-field":"_inline-field_5r227_255"};function pe(t,c){return{"--icon-svg":$e.iconSVG(t,c)}}const ct=({children:t,className:c,combobox:i=!1,createOption:o,emptyLabel:n="No matches found",errorLabel:a,onRetry:h,retryLabel:me="Retry",label:b,filterOptions:_e=!0,hasNextPage:v=!1,loading:m=!1,loadMoreLabel:be="Load more",onLoadMore:g,onOpenChange:I,onSearchChange:B,searchValue:M,renderOption:Q,searchPlaceholder:W="Filter",selectedItems:ve,variant:j="default",...xe})=>{const z=Ae(t),{defaultValue:ye,onChange:G,value:P,...he}=z.props,u=F.sanitizeSelectProps(he),{className:ge,...je}=u,ee=r.useRef(null),te=r.useRef(null),k=r.useId(),ne=r.useRef(null),x=r.useRef(null),se=r.useRef(null),re=r.useRef(null),T=r.useRef(!1),A=r.useRef(!1),K=r.useRef(g),le=!!g,w=Z(z.children),E=P!=null,O=Te(w,P,ye),[H,J]=r.useState(()=>O),[d,we]=r.useState(!1),[Ee,Re]=r.useState(""),R=M??Ee,N=r.useCallback(e=>{M===void 0&&Re(e),B==null||B(e)},[B,M]),p=r.useCallback(e=>{T.current===e||e&&u.disabled||(T.current=e,we(e),I==null||I(e),e||N(""))},[I,u.disabled,N]),q=E?String(P):H,ie={default:F.resolveColor("--colors-semantic-content-secondary"),white:F.resolveColor("--color-white","white")},oe=j==="minimal"?ie.white:ie.default,$=Pe(w,q),Ne=pe("CaretDown",oe),Se=pe("MagnifyingGlass",oe),U=Ge(w,_e?R:""),y=R.trim(),D=!!(i&&o&&y&&o.isValid(y)),Ce=b&&j==="inline"?fe.formatInlineLabel(b):b,ce=e=>e?(Q==null?void 0:Q({groupLabel:e.groupLabel,isSelected:e.value===q,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";r.useEffect(()=>{!E&&!w.some(e=>e.value===H)&&J(O)},[O,H,E,w]),r.useEffect(()=>{var e;d&&((e=x.current)==null||e.focus())},[d]),r.useEffect(()=>{if(!d)return;const e=f=>{var _;(_=te.current)!=null&&_.contains(f.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p,d]),r.useEffect(()=>{K.current=g},[g]),r.useEffect(()=>{u.disabled&&p(!1)},[p,u.disabled]);const X=r.useCallback(()=>{!T.current||u.disabled||m||a||!v||!K.current||A.current||(A.current=!0,K.current())},[a,v,m,u.disabled]);r.useEffect(()=>{if(A.current=!1,!d||u.disabled||m||a||!v||!le)return;const e=re.current,f=se.current;if(!e||!f||typeof IntersectionObserver>"u")return;let _=!0;const S=new IntersectionObserver(ke=>{_&&ke.some(qe=>qe.isIntersecting)&&X()},{root:f});return S.observe(e),()=>{_=!1,S.disconnect()}},[d,m,a,v,le,X,U.length,R,u.disabled]);const Ve=e=>{E||J(e.target.value),G==null||G(e)},Y=()=>{var e;p(!1),i||(e=ee.current)==null||e.focus()},ae=()=>{var e;N(""),p(!0),(e=x.current)==null||e.focus()},ue=()=>{!o||!D||(o.onCreate(y),ae())},Ie=e=>{var S;E||J(e);const f=ne.current;if(!f){Y();return}const _=(S=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:S.set;_==null||_.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),i?ae():Y()},Be=e=>{e.key==="Escape"&&Y(),e.key==="Enter"&&e.target===x.current&&D&&(e.preventDefault(),ue())},de=s.jsxs("div",{className:C(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,c),onKeyDown:Be,ref:te,...xe,"data-component":"dropdown",children:[s.jsx("select",{...je,"aria-hidden":"true",className:C(l.native,ge),onChange:Ve,ref:ne,tabIndex:-1,value:q,children:z.children}),i?s.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=x.current)==null?void 0:e.focus()},children:[ve,s.jsx("input",{"aria-autocomplete":"list","aria-expanded":d,"aria-label":u["aria-label"]??b??W,className:l["combobox-input"],disabled:u.disabled,onChange:e=>{N(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:W||void 0,ref:x,role:"combobox",type:"text",value:R})]}):s.jsx(V.Button,{"aria-expanded":d,"aria-haspopup":"dialog","aria-labelledby":b?`${k} ${k}-value`:void 0,className:C(l.trigger,($==null?void 0:$.isPlaceholder)&&l.placeholder),"data-open":d?"true":void 0,disabled:u.disabled,onClick:()=>p(!d),ref:ee,style:Ne,variant:"simple",children:s.jsx("span",{className:l.text,id:`${k}-value`,children:ce($)})}),d&&s.jsxs("div",{className:l.panel,children:[!i&&s.jsx(fe.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>N(e.target.value),placeholder:W,ref:x,style:Se,type:"search",value:R}),s.jsxs(De.List,{"aria-label":"Dropdown","aria-busy":m||void 0,className:l.options,ref:se,children:[U.map(e=>{const f=e.value===q;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(V.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:C(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Ie(e.value),variant:"tertiary",children:[s.jsx("span",{className:l.text,children:ce(e)}),e.groupLabel&&s.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),D&&o&&s.jsx("li",{children:s.jsx(V.Button,{"aria-label":L(o.render(y))||y,className:l.option,onClick:ue,variant:"tertiary",children:s.jsx("span",{className:l.text,children:o.render(y)})})}),U.length===0&&!D&&!m&&!a&&!v&&s.jsx("li",{className:l.empty,children:n}),a&&s.jsxs("li",{className:l.empty,children:[s.jsx("span",{role:"alert",children:a}),h&&s.jsx(V.Button,{disabled:m,onClick:h,variant:"tertiary",children:me})]}),m&&s.jsx("li",{"aria-label":"Loading",className:l.empty,role:"status",children:s.jsx(Fe.Loading,{size:"small"})}),v&&g&&!a&&s.jsx("li",{ref:re,children:s.jsx(V.Button,{className:l.option,disabled:m,onClick:X,variant:"tertiary",children:be})})]})]})]});return b?s.jsxs("div",{className:C(l.label,j==="inline"&&l["inline-field"]),"data-component":"dropdown",children:[s.jsx("span",{id:k,children:Ce}),de]}):de};exports.Dropdown=ct;
@@ -3,11 +3,11 @@ import $ from "classix";
3
3
  import ze, { Children as Ge, isValidElement as B, useRef as b, useId as Me, useState as te, useCallback as ne, useEffect as w } from "react";
4
4
  import { Button as k } from "../button/index.js";
5
5
  import { i as Pe } from "../../icons-DVeBguFb.js";
6
- import { f as qe, I as Ae } from "../../index-Dd20d_9U.js";
6
+ import { f as qe, I as Ae } from "../../index-FSKjg3Z8.js";
7
7
  import { List as Ke } from "../list/index.js";
8
8
  import { Loading as Te } from "../loading/index.js";
9
- import { S as He, s as Oe, r as _e } from "../../index-Dx-KtGBg.js";
10
- import '../../assets/index41.css';function z(t) {
9
+ import { S as He, s as Oe, r as _e } from "../../index-HVXauXrX.js";
10
+ import '../../assets/index42.css';function z(t) {
11
11
  return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(z).join(" ") : B(t) ? z(t.props.children) : "";
12
12
  }
13
13
  function Je(t) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const i=require("react/jsx-runtime"),b=require("classix"),F=require("react"),q=require("../button/index.cjs"),I=require("../icon/index.cjs"),R="_dropzone_1rpsf_1",S="_dragging_1rpsf_19",T="_minimal_1rpsf_23",g={dropzone:R,dragging:S,minimal:T},k=({accepts:D,label:m="Select files",maxFileSize:_,multiple:u=!1,onChange:n,onValidation:a,variant:p="default",...y})=>{const f=F.useRef(null),[x,l]=F.useState(!1),c=e=>{e.preventDefault(),e.stopPropagation()},v=e=>{const t=f.current;if(!t)return;const s=new DataTransfer;for(const r of e)s.items.add(r);t.files=s.files,n==null||n({target:t,currentTarget:t})},z=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:r}=e.reduce((d,o)=>(o.size===0?d.emptyFiles.push(o):_&&o.size>_?d.oversizedFiles.push(o):d.validFiles.push(o),d),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||r.length>0)&&(a==null||a(s,r)),t},j=e=>{c(e),l(!1);const t=Array.from(e.dataTransfer.files??[]),s=z(t);if(s.length===0)return;const r=u?s:s.slice(0,1);v(r)},h=e=>{const t=Array.from(e.target.files??[]),s=z(t);if(s.length===t.length){n==null||n(e);return}const r=u?s:s.slice(0,1);v(r)};return i.jsx("div",{className:b(g.dropzone,g[p],x&&g.dragging),onDragEnter:e=>{c(e),l(!0)},onDragOver:e=>{c(e),l(!0)},onDragLeave:e=>{c(e),l(!1)},onDrop:j,...y,"data-component":"dropzone",children:i.jsxs("label",{children:[i.jsx("input",{accept:D,"aria-label":m,hidden:!0,multiple:u,onChange:h,ref:f,type:"file"}),i.jsx(I.Icon,{name:"UploadSimple",size:p==="minimal"?"medium":"large"}),i.jsx("br",{}),p!=="minimal"&&i.jsx(q.Button,{onClick:()=>{var e;return(e=f.current)==null?void 0:e.click()},type:"button",children:m})]})})};exports.Dropzone=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index43.css');const i=require("react/jsx-runtime"),b=require("classix"),F=require("react"),q=require("../button/index.cjs"),I=require("../icon/index.cjs"),R="_dropzone_1rpsf_1",S="_dragging_1rpsf_19",T="_minimal_1rpsf_23",g={dropzone:R,dragging:S,minimal:T},k=({accepts:D,label:m="Select files",maxFileSize:_,multiple:u=!1,onChange:n,onValidation:a,variant:p="default",...y})=>{const f=F.useRef(null),[x,l]=F.useState(!1),c=e=>{e.preventDefault(),e.stopPropagation()},v=e=>{const t=f.current;if(!t)return;const s=new DataTransfer;for(const r of e)s.items.add(r);t.files=s.files,n==null||n({target:t,currentTarget:t})},z=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:r}=e.reduce((d,o)=>(o.size===0?d.emptyFiles.push(o):_&&o.size>_?d.oversizedFiles.push(o):d.validFiles.push(o),d),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||r.length>0)&&(a==null||a(s,r)),t},j=e=>{c(e),l(!1);const t=Array.from(e.dataTransfer.files??[]),s=z(t);if(s.length===0)return;const r=u?s:s.slice(0,1);v(r)},h=e=>{const t=Array.from(e.target.files??[]),s=z(t);if(s.length===t.length){n==null||n(e);return}const r=u?s:s.slice(0,1);v(r)};return i.jsx("div",{className:b(g.dropzone,g[p],x&&g.dragging),onDragEnter:e=>{c(e),l(!0)},onDragOver:e=>{c(e),l(!0)},onDragLeave:e=>{c(e),l(!1)},onDrop:j,...y,"data-component":"dropzone",children:i.jsxs("label",{children:[i.jsx("input",{accept:D,"aria-label":m,hidden:!0,multiple:u,onChange:h,ref:f,type:"file"}),i.jsx(I.Icon,{name:"UploadSimple",size:p==="minimal"?"medium":"large"}),i.jsx("br",{}),p!=="minimal"&&i.jsx(q.Button,{onClick:()=>{var e;return(e=f.current)==null?void 0:e.click()},type:"button",children:m})]})})};exports.Dropzone=k;
@@ -3,7 +3,7 @@ import x from "classix";
3
3
  import { useRef as T, useState as j } from "react";
4
4
  import { Button as k } from "../button/index.js";
5
5
  import { Icon as A } from "../icon/index.js";
6
- import '../../assets/index42.css';const R = "_dropzone_1rpsf_1", S = "_dragging_1rpsf_19", w = "_minimal_1rpsf_23", u = {
6
+ import '../../assets/index43.css';const R = "_dropzone_1rpsf_1", S = "_dragging_1rpsf_19", w = "_minimal_1rpsf_23", u = {
7
7
  dropzone: R,
8
8
  dragging: S,
9
9
  minimal: w
@@ -1 +1 @@
1
- "use strict";require('../../assets/index43.css');var xt=Object.defineProperty;var kt=(l,r,e)=>r in l?xt(l,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[r]=e;var F=(l,r,e)=>kt(l,typeof r!="symbol"?r+"":r,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),ft=require("@lexical/html"),j=require("@lexical/link"),E=require("@lexical/list"),It=require("@lexical/react/LexicalAutoFocusPlugin"),Dt=require("@lexical/react/LexicalAutoLinkPlugin"),mt=require("@lexical/react/LexicalComposerContext"),Ct=require("@lexical/react/LexicalContentEditable"),Lt=require("@lexical/react/LexicalErrorBoundary"),vt=require("@lexical/react/LexicalExtensionComposer"),Nt=require("@lexical/react/LexicalHistoryPlugin"),wt=require("@lexical/react/LexicalLinkPlugin"),Mt=require("@lexical/react/LexicalListPlugin"),At=require("@lexical/react/LexicalOnChangePlugin"),St=require("@lexical/react/LexicalRichTextPlugin"),et=require("classix"),c=require("lexical"),s=require("react"),ut=require("sanitize-html"),A=require("../button/index.cjs"),yt=require("../file/index.cjs"),jt=require("@lexical/utils"),y=require("../icon/index.cjs"),_t=require("../../index-7blZaPiA.cjs"),Et=require("../toolbar/index.cjs"),Rt="_field_1trki_3",Tt="_editor_1trki_8",$t="_submit_1trki_26",Pt="_resizable_1trki_56",Ot="_resized_1trki_60",Bt="_invalid_1trki_86",qt="_error_1trki_90",Ut="_dragging_1trki_96",zt="_content_1trki_100",Ht="_files_1trki_116",Ft="_placeholder_1trki_125",Kt="_fill_1trki_133",Wt="_meta_1trki_161",Gt="_active_1trki_170",Xt="_bold_1trki_240",Yt="_italic_1trki_244",Zt="_underline_1trki_248",Vt="_link_1trki_252",Jt="_list_1trki_258",Qt="_paragraph_1trki_259",_={field:Rt,editor:Tt,submit:$t,"image-resize-handle":"_image-resize-handle_1trki_50",resizable:Pt,resized:Ot,"resize-handle":"_resize-handle_1trki_64",invalid:Bt,error:qt,dragging:Ut,content:zt,"has-files":"_has-files_1trki_112",files:Ht,placeholder:Ft,fill:Kt,"fill-editor":"_fill-editor_1trki_141",meta:Wt,active:Gt,"inline-image":"_inline-image_1trki_182",bold:Xt,italic:Yt,underline:Zt,link:Vt,list:Jt,paragraph:Qt};function te({alt:l="",editor:r,height:e,nodeKey:d,soliboDocumentId:f,soliboDocumentSlot:g,src:b,width:o}){const m=s.useRef(null),p=s.useRef(null),[P,N]=s.useState(),v=()=>{const n=r.getRootElement();if(!n)return 1/0;const u=getComputedStyle(n);return Math.max(1,n.clientWidth-(parseFloat(u.paddingLeft)||0)-(parseFloat(u.paddingRight)||0))},R=(n,u=v())=>Math.round(Math.min(u,Math.max(Math.min(32,u),n))),L=n=>{r.update(()=>{const u=c.$getNodeByKey(d);at(u)&&u.setWidth(n)}),N(void 0)};return i.jsxs("span",{className:_["inline-image"],contentEditable:!1,tabIndex:g?0:void 0,onKeyDown:n=>{!g||n.target!==n.currentTarget||!["Backspace","Delete"].includes(n.key)||(n.preventDefault(),n.stopPropagation(),r.update(()=>{const u=c.$getNodeByKey(d);if(!at(u))return;const k=u.getParent();c.$isParagraphNode(k)&&k.getChildrenSize()===1?k.remove():u.remove(),r.dispatchCommand(pt,g)}),r.focus())},"data-component":"editorimage",children:[i.jsx("img",{alt:l,"data-solibo-document-id":f,"data-solibo-document-slot":g,draggable:!1,height:P===void 0?e:void 0,ref:m,src:b,width:P??o,onClick:n=>{var u;n.preventDefault(),g&&((u=n.currentTarget.parentElement)==null||u.focus()),r.dispatchCommand(bt,{key:d,soliboDocumentSlot:g,src:b,width:o})}}),i.jsx("button",{type:"button","aria-label":`Resize image${l?`: ${l}`:""}`,title:"Drag to resize; use arrow keys to adjust width",className:_["image-resize-handle"],tabIndex:0,onClick:n=>{n.preventDefault(),n.stopPropagation()},onKeyDown:n=>{var k;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(n.key))return;n.preventDefault(),n.stopPropagation();const u=((k=m.current)==null?void 0:k.getBoundingClientRect().width)??o??32;L(R(u+(["ArrowRight","ArrowUp"].includes(n.key)?10:-10)))},onPointerDown:n=>{n.button!==0||!m.current||(n.preventDefault(),n.stopPropagation(),n.currentTarget.focus({preventScroll:!0}),n.currentTarget.setPointerCapture(n.pointerId),p.current={pointerId:n.pointerId,x:n.clientX,width:m.current.getBoundingClientRect().width,maximum:v()})},onPointerMove:n=>{const u=p.current;!u||u.pointerId!==n.pointerId||N(R(u.width+n.clientX-u.x,u.maximum))},onPointerUp:n=>{const u=p.current;!u||u.pointerId!==n.pointerId||(p.current=null,L(R(u.width+n.clientX-u.x,u.maximum)),n.currentTarget.releasePointerCapture(n.pointerId))},onPointerCancel:()=>{p.current=null,N(void 0)},onLostPointerCapture:()=>{p.current=null,N(void 0)}})]})}const pt=c.createCommand(),bt=c.createCommand();class rt extends c.DecoratorNode{constructor(e,d,f,g,b,o,m){super(b);F(this,"__src");F(this,"__alt");F(this,"__width");F(this,"__height");F(this,"__soliboDocumentId");F(this,"__soliboDocumentSlot");this.__src=e,this.__alt=d,this.__width=f,this.__height=g,this.__soliboDocumentId=o,this.__soliboDocumentSlot=m}static getType(){return"image"}static clone(e){return new rt(e.__src,e.__alt,e.__width,e.__height,e.__key,e.__soliboDocumentId,e.__soliboDocumentSlot)}static importJSON(e){return ot({alt:e.alt,height:e.height,soliboDocumentId:e.soliboDocumentId,soliboDocumentSlot:e.soliboDocumentSlot,src:e.src,width:e.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:e=>({conversion:d=>{if(!(d instanceof HTMLImageElement))return null;const f=d.getAttribute("src")??"";if(!f)return null;const g=d.getAttribute("width"),b=d.getAttribute("height");return{node:ot({alt:d.getAttribute("alt")??"",height:b?Number(b):void 0,soliboDocumentId:d.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:d.getAttribute("data-solibo-document-slot")??void 0,src:f,width:g?Number(g):void 0})}},priority:0})}}exportDOM(){const e=document.createElement("img");return this.__soliboDocumentSlot||e.setAttribute("src",this.__src),this.__soliboDocumentId&&e.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&e.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&e.setAttribute("alt",this.__alt),this.__width&&e.setAttribute("width",String(this.__width)),this.__height&&e.setAttribute("height",String(this.__height)),{element:e}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(e){const d=this.getWritable();return d.__src=e,d}setWidth(e){const d=this.getWritable();return d.__width=e,d.__height=void 0,d}decorate(e){return i.jsx(te,{alt:this.__alt,editor:e,height:this.__height,nodeKey:this.getKey(),soliboDocumentId:this.__soliboDocumentId,soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})}}function ot({alt:l="",height:r,soliboDocumentId:e,soliboDocumentSlot:d,src:f,width:g}){return c.$applyNodeReplacement(new rt(f,l,g,r,void 0,e,d))}function at(l){return l instanceof rt}const ee=({createImages:l,onRemove:r})=>{const[e]=mt.useLexicalComposerContext();return s.useEffect(()=>e.registerCommand(pt,d=>(r(d),!0),c.COMMAND_PRIORITY_HIGH),[e,r]),s.useEffect(()=>e.registerCommand(c.PASTE_COMMAND,d=>{var o;if(!("clipboardData"in d))return!1;const f=d,g=Array.from(((o=f.clipboardData)==null?void 0:o.items)??[]).flatMap(m=>{if(m.kind!=="file"||!m.type.startsWith("image/"))return[];const p=m.getAsFile();return p?[p]:[]});if(g.length===0)return!1;f.preventDefault();const b=l(g);return e.update(()=>{c.$insertNodes(b.map(m=>ot(m)))}),!0},c.COMMAND_PRIORITY_HIGH),[l,e]),null},re=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,ie=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,ne=[l=>{const r=re.exec(l);return r!=null&&r.length?{index:r.index,length:r[0].length,text:r[0],url:`mailto:${r[0]}`}:null},l=>{const r=ie.exec(l);return r!=null&&r.length?{index:r.index,length:r[0].length,text:r[0],url:r[0].startsWith("http")?r[0]:`https://${r[0]}`}:null}];function dt(l){try{const r=new URL(l);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function se({editableRef:l}){const r=s.useRef(null),[e,d]=s.useState(0),[f,g]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const m=()=>{d(Math.round(o.getBoundingClientRect().height)),g(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(m(),typeof ResizeObserver>"u")return;const p=new ResizeObserver(m);return p.observe(o),()=>p.disconnect()},[l]);const b=o=>{const m=l.current;if(!m)return;const p=parseFloat(getComputedStyle(m).minHeight)||0;m.style.height=`${Math.max(p,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":f,"aria-valuenow":e,"aria-valuetext":`${e} pixels`,className:_["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const m=l.current;m&&(o.key==="Home"?(o.preventDefault(),m.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),b(m.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const m=l.current;o.button!==0||!m||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),r.current={pointerId:o.pointerId,y:o.clientY,height:m.getBoundingClientRect().height})},onPointerMove:o=>{!r.current||r.current.pointerId!==o.pointerId||b(r.current.height+r.current.y-o.clientY)},onPointerUp:o=>{!r.current||r.current.pointerId!==o.pointerId||(r.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{r.current=null},onPointerCancel:()=>{r.current=null},"data-component":"editorresizehandle"})}const oe=({onFilesSelected:l,onInlineImageRemove:r})=>{const[e]=mt.useLexicalComposerContext(),[d,f]=s.useState(!1),[g,b]=s.useState(!1),[o,m]=s.useState(!1),[p,P]=s.useState(!1),[N,v]=s.useState(!1),[R,L]=s.useState(!1),[n,u]=s.useState(""),[k,K]=s.useState(null),[W,O]=s.useState(null),[B,w]=s.useState(""),J=dt(B.trim()),G=s.useRef(null),it=s.useRef(null),Q=s.useRef(null),T=s.useRef(null),S=s.useRef(!1),nt=t=>t.preventDefault(),X=s.useCallback(t=>{T.current=c.$isRangeSelection(t)?t.clone():null},[]),Y=s.useCallback(t=>{e.update(()=>{T.current&&c.$setSelection(T.current),t()}),T.current=null},[e]),st=t=>{S.current=!0,t.preventDefault()},$=()=>{if(S.current){S.current=!1;return}Z()},x=s.useCallback(()=>{b(!1),u(""),K(null),O(null)},[]),D=s.useCallback(()=>{v(!1),w("")},[]),z=s.useCallback(t=>{b(!0),u((t==null?void 0:t.src)??""),K((t==null?void 0:t.key)??null),O((t==null?void 0:t.soliboDocumentSlot)??null),D(),t!=null&&t.soliboDocumentSlot||setTimeout(()=>{var a;return(a=it.current)==null?void 0:a.focus()},0)},[D]),H=s.useCallback(t=>{e.getEditorState().read(()=>{X(c.$getSelection())}),v(!0),w(t),x(),setTimeout(()=>{var a;return(a=Q.current)==null?void 0:a.focus()},0)},[x,e,X]),tt=s.useCallback(()=>{const t=B.trim();dt(t)&&(Y(()=>{e.dispatchCommand(j.TOGGLE_LINK_COMMAND,{url:t,target:"_blank"});const a=c.$getSelection();if(!c.$isRangeSelection(a))return;const h=a.getNodes().at(-1)??null,I=(h==null?void 0:h.getParent())??null,C=j.$isLinkNode(h)?h:j.$isLinkNode(I)?I:null;if(C){const U=C.getLastChild();if(c.$isTextNode(U)){const ht=U.getTextContent(),gt=ht.replace(/\s+$/,"");gt!==ht&&U.setTextContent(gt)}const V=C.getNextSibling();if(c.$isTextNode(V)&&/^\s/.test(V.getTextContent())){V.select(1,1);return}const M=c.$createTextNode(" ");C.insertAfter(M),M.selectEnd()}}),D())},[D,e,B,Y]),Z=s.useCallback(()=>{const t=n.trim();if(!t){x();return}e.update(()=>{if(k){const a=c.$getNodeByKey(k);at(a)&&a.setSrc(t);return}c.$insertNodes([ot({src:t})])}),x()},[x,e,k,n]),lt=s.useCallback(()=>{if(!k){x();return}e.update(()=>{const t=c.$getNodeByKey(k);if(at(t)){const a=t.getParent();c.$isParagraphNode(a)&&a.getChildrenSize()===1?a.remove():t.remove(),W&&(r==null||r(W))}}),x()},[x,e,k,W,r]),ct=s.useCallback(()=>{Y(()=>{e.dispatchCommand(j.TOGGLE_LINK_COMMAND,null)}),D()},[D,e,Y]),q=s.useCallback(()=>{const t=c.$getSelection();if(!c.$isRangeSelection(t)){if(c.$isNodeSelection(t)){const I=t.getNodes(),C=I[0]??null,U=(C==null?void 0:C.getParent())??null;f(I.some(M=>c.$isTextNode(M)&&M.hasFormat("bold"))),m(I.some(M=>c.$isTextNode(M)&&M.hasFormat("italic"))),P(I.some(M=>c.$isTextNode(M)&&M.hasFormat("underline"))),L(E.$isListNode(U)||E.$isListItemNode(U)||E.$isListNode(C)||E.$isListItemNode(C));const V=j.$isLinkNode(C)?C:j.$isLinkNode(U)?U:null;if(V){v(!0),w(V.getURL());return}v(!1),w(""),T.current=null;return}f(!1),m(!1),P(!1),L(!1),v(!1),w(""),T.current=null;return}const[a]=t.getNodes(),h=(a==null?void 0:a.getParent())??null;if(f(t.hasFormat("bold")),m(t.hasFormat("italic")),P(t.hasFormat("underline")),L(E.$isListNode(h)||E.$isListItemNode(h)),j.$isLinkNode(h)){v(!0),w(h.getURL()),X(t);return}v(!1),w(""),T.current=null},[X]);return s.useEffect(()=>jt.mergeRegister(e.registerUpdateListener(({editorState:t})=>{t.read(()=>{q()})}),e.registerCommand(bt,t=>(t.soliboDocumentSlot?(x(),D()):z(t),!0),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(e.getEditorState().read(()=>{q()}),!1),c.COMMAND_PRIORITY_LOW)),[x,D,e,z,q]),i.jsxs(Et.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(A.Button,{"aria-label":"Bold","data-active":d,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextB"})}),i.jsx(A.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextItalic"})}),i.jsx(A.Button,{"aria-label":"Underline","data-active":p,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextUnderline"})}),i.jsx(A.Button,{"aria-label":"List","data-active":R,onClick:()=>{R?e.dispatchCommand(E.REMOVE_LIST_COMMAND,void 0):e.dispatchCommand(E.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx(y.Icon,{name:"ListBullets"})}),i.jsx(A.Button,{"aria-label":"Link","data-active":N,onClick:()=>{N?H(B):(e.dispatchCommand(j.TOGGLE_LINK_COMMAND,{url:"https://"}),H("https://"))},title:"Link",variant:"tertiary",children:i.jsx(y.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:t=>{t.target.files&&l(t.target.files),t.target.value=""},ref:G,type:"file"}),i.jsx(A.Button,{"aria-label":"Upload files",onClick:()=>{var t;return(t=G.current)==null?void 0:t.click()},title:"Upload files",variant:"tertiary",children:i.jsx(y.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:et(_.meta,N||g?_.active:""),children:[N&&i.jsxs(i.Fragment,{children:[i.jsx(_t.Input,{"aria-invalid":!J,onBlur:()=>tt(),onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),tt())},ref:Q,value:B}),i.jsx(A.Button,{"aria-label":"Apply link",disabled:!J,onClick:()=>{tt()},onMouseDown:nt,variant:"tertiary",children:i.jsx(y.Icon,{name:"Check"})}),i.jsx(A.Button,{"aria-label":"Remove link",onClick:()=>ct(),onMouseDown:nt,variant:"tertiary",children:i.jsx(y.Icon,{name:"Trash",variant:"danger"})})]}),g&&i.jsxs(i.Fragment,{children:[!W&&i.jsxs(i.Fragment,{children:[i.jsx(_t.Input,{className:et(_.active),onBlur:$,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),S.current=!0,Z())},ref:it,value:n}),i.jsx(A.Button,{"aria-label":"Apply image",onClick:()=>Z(),onMouseDown:st,variant:"tertiary",children:i.jsx(y.Icon,{name:"Check"})})]}),i.jsx(A.Button,{"aria-label":"Remove image",onClick:()=>lt(),onMouseDown:st,variant:"tertiary",children:i.jsx(y.Icon,{name:"Trash",variant:"danger"})})]})]})]})},ae=c.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[j.AutoLinkNode,j.LinkNode,E.ListNode,E.ListItemNode,rt],onError(l){throw l},theme:{link:_.link,list:{ol:_.list,ul:_.list},paragraph:_.paragraph,text:{bold:_.bold,italic:_.italic,underline:_.underline}}});function le({autofocus:l,content:r="",lastEmittedContentRef:e}){const[d]=mt.useLexicalComposerContext();return s.useEffect(()=>{e.current!==r&&d.update(()=>{const g=new DOMParser().parseFromString(r,"text/html"),b=ft.$generateNodesFromDOM(d,g),o=c.$getRoot();o.clear().select(),c.$insertNodes(b),l?o.selectEnd():c.$setSelection(null)})},[l,r,d,e]),null}const ce=({autofocus:l=!1,autolink:r=!1,content:e,disabled:d=!1,errorMessage:f,fill:g=!1,files:b,inline:o=!1,inlineImages:m,invalid:p=!1,isSubmitting:P=!1,maxRows:N=12,minRows:v=1,onChange:R,onFilesChange:L,onInlineImagesChange:n,onSubmit:u,onUpload:k,placeholder:K,required:W=!1,resizable:O=!1,submitLabel:B="Submit"})=>{const w=s.useId(),J=s.useRef(void 0),G=s.useRef(null),[it,Q]=s.useState(!1),[T,S]=s.useState(!1),[nt,X]=s.useState([]),[Y,st]=s.useState([]),$=s.useRef(new Map),x=b??nt,D=m??Y;s.useEffect(()=>{const t=G.current;if(!t)return;if(!O||g){t.style.removeProperty("height"),Q(!1);return}const a=()=>Q(t.style.height!==""),h=new MutationObserver(a);return h.observe(t,{attributes:!0,attributeFilter:["style"]}),a(),()=>h.disconnect()},[g,O]);const z=t=>{b===void 0&&X(t),L==null||L(t)},H=s.useCallback(t=>{m===void 0&&st(t),n==null||n(t)},[m,n]),tt=s.useCallback(t=>{const a=t.map(h=>{const I=`pasted-${crypto.randomUUID()}`,C=URL.createObjectURL(h);return $.current.set(I,C),{image:{alt:h.name,soliboDocumentSlot:I,src:C},pending:{file:h,slot:I}}});return H([...D,...a.map(({pending:h})=>h)]),a.map(({image:h})=>h)},[D,H]),Z=s.useCallback(t=>{H(D.filter(h=>h.slot!==t));const a=$.current.get(t);a&&URL.revokeObjectURL(a),$.current.delete(t)},[D,H]);s.useEffect(()=>()=>{$.current.forEach(t=>URL.revokeObjectURL(t)),$.current.clear()},[]),s.useEffect(()=>{const t=new Set(D.map(a=>a.slot));$.current.forEach((a,h)=>{t.has(h)||(URL.revokeObjectURL(a),$.current.delete(h))})},[D]);const lt=t=>{if(typeof DataTransfer<"u"){const a=new DataTransfer;return t.forEach(h=>a.items.add(h)),a.files}return Object.assign([...t],{item:a=>t[a]??null})},ct=async()=>{try{x.length>0&&await(k==null?void 0:k(lt(x))),await(u==null?void 0:u()),x.length>0&&z([])}catch{return}},q=t=>{t.preventDefault(),t.stopPropagation()};return i.jsxs("div",{className:et(_.field,g&&_.fill),"data-max-rows":N,"data-min-rows":v,onDragEnter:t=>{q(t),S(!!L)},onDragOver:t=>{q(t),S(!!L)},onDragLeave:t=>{q(t),S(!1)},onDropCapture:t=>{var h;const a=(h=t.dataTransfer)==null?void 0:h.files;a!=null&&a.length&&(q(t),(L||k)&&z([...x,...Array.from(a)]),S(!1))},onDrop:t=>{t.preventDefault(),S(!1)},"data-component":"editor",children:[O==="top"&&!g&&i.jsx(se,{editableRef:G}),i.jsx("div",{className:et(_.editor,g&&_["fill-editor"],O===!0&&!g&&_.resizable,O&&!g&&it&&_.resized,p&&_.invalid,x.length>0&&_["has-files"]),style:{"--editor-max-height":`calc(${N*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${v*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(vt.LexicalExtensionComposer,{contentEditable:null,extension:ae,children:[!o&&i.jsx(oe,{onInlineImageRemove:Z,onFilesSelected:k||L?t=>{z([...x,...Array.from(t)])}:void 0}),i.jsx("div",{className:et(_.content,T&&_.dragging),children:i.jsx(St.RichTextPlugin,{contentEditable:i.jsx(Ct.ContentEditable,{ref:G,"aria-placeholder":K??"",ariaErrorMessage:p&&f?w:void 0,ariaInvalid:p||void 0,ariaRequired:W||void 0,placeholder:()=>K?i.jsx("div",{className:_.placeholder,children:K}):null}),ErrorBoundary:Lt.LexicalErrorBoundary})}),!o&&u&&i.jsx("div",{className:_.submit,children:i.jsx(A.Button,{"aria-label":B,"data-cy":"toolbar-submit-button",disabled:d,icon:"PaperPlaneTilt",isLoading:P,onClick:()=>void ct(),variant:"primary",children:i.jsx("span",{children:B})})}),x.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:_.files,role:"region",children:x.map((t,a)=>i.jsx(yt.File,{deleteAccessibleLabel:`Remove ${t.name} from upload queue`,name:t.name,onDelete:()=>z(x.filter((h,I)=>I!==a))},`${t.name}-${t.size}-${t.lastModified}-${a}`))}),l&&i.jsx(It.AutoFocusPlugin,{}),r&&i.jsx(Dt.AutoLinkPlugin,{matchers:ne}),i.jsx(Nt.HistoryPlugin,{}),n&&i.jsx(ee,{createImages:tt,onRemove:Z}),e!==void 0&&i.jsx(le,{autofocus:l,content:e,lastEmittedContentRef:J}),i.jsx(wt.LinkPlugin,{validateUrl:dt}),i.jsx(Mt.ListPlugin,{}),R&&i.jsx(At.OnChangePlugin,{onChange:(t,a)=>{t.read(()=>{const h=ft.$generateHtmlFromNodes(a,null),I=ut(h,{allowedAttributes:{...ut.defaults.allowedAttributes,img:[...ut.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});J.current=I,R(I)})}})]})}),p&&f&&i.jsx("div",{className:_.error,id:w,children:f})]})};exports.Editor=ce;
1
+ "use strict";require('../../assets/index44.css');var xe=Object.defineProperty;var Ie=(l,t,e)=>t in l?xe(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var V=(l,t,e)=>Ie(l,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),fe=require("@lexical/html"),P=require("@lexical/link"),O=require("@lexical/list"),De=require("@lexical/react/LexicalAutoFocusPlugin"),Ce=require("@lexical/react/LexicalAutoLinkPlugin"),he=require("@lexical/react/LexicalComposerContext"),Le=require("@lexical/react/LexicalContentEditable"),ke=require("@lexical/react/LexicalErrorBoundary"),ve=require("@lexical/react/LexicalExtensionComposer"),we=require("@lexical/react/LexicalHistoryPlugin"),Ne=require("@lexical/react/LexicalLinkPlugin"),Me=require("@lexical/react/LexicalListPlugin"),Ae=require("@lexical/react/LexicalOnChangePlugin"),Se=require("@lexical/react/LexicalRichTextPlugin"),se=require("classix"),c=require("lexical"),s=require("react"),me=require("sanitize-html"),R=require("../button/index.cjs"),ye=require("../file/index.cjs"),Re=require("@lexical/utils"),$=require("../icon/index.cjs"),_e=require("../../index-S1XsOUKE.cjs"),je=require("../toolbar/index.cjs"),Te="_field_mzlbe_3",Ee="_editor_mzlbe_8",$e="_submit_mzlbe_26",Pe="_resizable_mzlbe_71",Oe="_resized_mzlbe_75",ze="_invalid_mzlbe_101",Be="_error_mzlbe_105",qe="_dragging_mzlbe_111",Ue="_content_mzlbe_115",He="_embedded_mzlbe_127",Fe="_files_mzlbe_147",We="_placeholder_mzlbe_156",Ke="_fill_mzlbe_164",Ge="_meta_mzlbe_196",Ye="_active_mzlbe_205",Xe="_bold_mzlbe_276",Ze="_italic_mzlbe_280",Ve="_underline_mzlbe_284",Je="_link_mzlbe_288",Qe="_list_mzlbe_294",et="_paragraph_mzlbe_295",f={field:Te,editor:Ee,submit:$e,"image-resize-handle":"_image-resize-handle_mzlbe_50","with-controls":"_with-controls_mzlbe_56",resizable:Pe,resized:Oe,"resize-handle":"_resize-handle_mzlbe_79",invalid:ze,error:Be,dragging:qe,content:Ue,embedded:He,"has-files":"_has-files_mzlbe_143",files:Fe,placeholder:We,fill:Ke,"fill-editor":"_fill-editor_mzlbe_172",meta:Ge,active:Ye,"inline-image":"_inline-image_mzlbe_217",bold:Xe,italic:Ze,underline:Ve,link:Je,list:Qe,paragraph:et};function tt({alt:l="",editor:t,height:e,nodeKey:d,soliboDocumentId:p,soliboDocumentSlot:_,src:I,width:o}){const u=s.useRef(null),b=s.useRef(null),[S,k]=s.useState(),C=()=>{const a=t.getRootElement();if(!a)return 1/0;const m=getComputedStyle(a);return Math.max(1,a.clientWidth-(parseFloat(m.paddingLeft)||0)-(parseFloat(m.paddingRight)||0))},w=(a,m=C())=>Math.round(Math.min(m,Math.max(Math.min(32,m),a))),z=a=>{t.update(()=>{const m=c.$getNodeByKey(d);de(m)&&m.setWidth(a)}),k(void 0)};return i.jsxs("span",{className:f["inline-image"],contentEditable:!1,tabIndex:_?0:void 0,onKeyDown:a=>{!_||a.target!==a.currentTarget||!["Backspace","Delete"].includes(a.key)||(a.preventDefault(),a.stopPropagation(),t.update(()=>{const m=c.$getNodeByKey(d);if(!de(m))return;const D=m.getParent();c.$isParagraphNode(D)&&D.getChildrenSize()===1?D.remove():m.remove(),t.dispatchCommand(pe,_)}),t.focus())},"data-component":"editorimage",children:[i.jsx("img",{alt:l,"data-solibo-document-id":p,"data-solibo-document-slot":_,draggable:!1,height:S===void 0?e:void 0,ref:u,src:I,width:S??o,onClick:a=>{var m;a.preventDefault(),_&&((m=a.currentTarget.parentElement)==null||m.focus()),t.dispatchCommand(be,{key:d,soliboDocumentSlot:_,src:I,width:o})}}),i.jsx("button",{type:"button","aria-label":`Resize image${l?`: ${l}`:""}`,title:"Drag to resize; use arrow keys to adjust width",className:f["image-resize-handle"],tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation()},onKeyDown:a=>{var D;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(a.key))return;a.preventDefault(),a.stopPropagation();const m=((D=u.current)==null?void 0:D.getBoundingClientRect().width)??o??32;z(w(m+(["ArrowRight","ArrowUp"].includes(a.key)?10:-10)))},onPointerDown:a=>{a.button!==0||!u.current||(a.preventDefault(),a.stopPropagation(),a.currentTarget.focus({preventScroll:!0}),a.currentTarget.setPointerCapture(a.pointerId),b.current={pointerId:a.pointerId,x:a.clientX,width:u.current.getBoundingClientRect().width,maximum:C()})},onPointerMove:a=>{const m=b.current;!m||m.pointerId!==a.pointerId||k(w(m.width+a.clientX-m.x,m.maximum))},onPointerUp:a=>{const m=b.current;!m||m.pointerId!==a.pointerId||(b.current=null,z(w(m.width+a.clientX-m.x,m.maximum)),a.currentTarget.releasePointerCapture(a.pointerId))},onPointerCancel:()=>{b.current=null,k(void 0)},onLostPointerCapture:()=>{b.current=null,k(void 0)}})]})}const pe=c.createCommand(),be=c.createCommand();class oe extends c.DecoratorNode{constructor(e,d,p,_,I,o,u){super(I);V(this,"__src");V(this,"__alt");V(this,"__width");V(this,"__height");V(this,"__soliboDocumentId");V(this,"__soliboDocumentSlot");this.__src=e,this.__alt=d,this.__width=p,this.__height=_,this.__soliboDocumentId=o,this.__soliboDocumentSlot=u}static getType(){return"image"}static clone(e){return new oe(e.__src,e.__alt,e.__width,e.__height,e.__key,e.__soliboDocumentId,e.__soliboDocumentSlot)}static importJSON(e){return ue({alt:e.alt,height:e.height,soliboDocumentId:e.soliboDocumentId,soliboDocumentSlot:e.soliboDocumentSlot,src:e.src,width:e.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:e=>({conversion:d=>{if(!(d instanceof HTMLImageElement))return null;const p=d.getAttribute("src")??"";if(!p)return null;const _=d.getAttribute("width"),I=d.getAttribute("height");return{node:ue({alt:d.getAttribute("alt")??"",height:I?Number(I):void 0,soliboDocumentId:d.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:d.getAttribute("data-solibo-document-slot")??void 0,src:p,width:_?Number(_):void 0})}},priority:0})}}exportDOM(){const e=document.createElement("img");return this.__soliboDocumentSlot||e.setAttribute("src",this.__src),this.__soliboDocumentId&&e.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&e.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&e.setAttribute("alt",this.__alt),this.__width&&e.setAttribute("width",String(this.__width)),this.__height&&e.setAttribute("height",String(this.__height)),{element:e}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(e){const d=this.getWritable();return d.__src=e,d}setWidth(e){const d=this.getWritable();return d.__width=e,d.__height=void 0,d}decorate(e){return i.jsx(tt,{alt:this.__alt,editor:e,height:this.__height,nodeKey:this.getKey(),soliboDocumentId:this.__soliboDocumentId,soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})}}function ue({alt:l="",height:t,soliboDocumentId:e,soliboDocumentSlot:d,src:p,width:_}){return c.$applyNodeReplacement(new oe(p,l,_,t,void 0,e,d))}function de(l){return l instanceof oe}const rt=({createImages:l,onRemove:t})=>{const[e]=he.useLexicalComposerContext();return s.useEffect(()=>e.registerCommand(pe,d=>(t(d),!0),c.COMMAND_PRIORITY_HIGH),[e,t]),s.useEffect(()=>e.registerCommand(c.PASTE_COMMAND,d=>{var o;if(!("clipboardData"in d))return!1;const p=d,_=Array.from(((o=p.clipboardData)==null?void 0:o.items)??[]).flatMap(u=>{if(u.kind!=="file"||!u.type.startsWith("image/"))return[];const b=u.getAsFile();return b?[b]:[]});if(_.length===0)return!1;p.preventDefault();const I=l(_);return e.update(()=>{c.$insertNodes(I.map(u=>ue(u)))}),!0},c.COMMAND_PRIORITY_HIGH),[l,e]),null},it=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,nt=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,st=[l=>{const t=it.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:`mailto:${t[0]}`}:null},l=>{const t=nt.exec(l);return t!=null&&t.length?{index:t.index,length:t[0].length,text:t[0],url:t[0].startsWith("http")?t[0]:`https://${t[0]}`}:null}];function ge(l){try{const t=new URL(l);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function ot({editableRef:l}){const t=s.useRef(null),[e,d]=s.useState(0),[p,_]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const u=()=>{d(Math.round(o.getBoundingClientRect().height)),_(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(u(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(u);return b.observe(o),()=>b.disconnect()},[l]);const I=o=>{const u=l.current;if(!u)return;const b=parseFloat(getComputedStyle(u).minHeight)||0;u.style.height=`${Math.max(b,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":p,"aria-valuenow":e,"aria-valuetext":`${e} pixels`,className:f["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const u=l.current;u&&(o.key==="Home"?(o.preventDefault(),u.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),I(u.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const u=l.current;o.button!==0||!u||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),t.current={pointerId:o.pointerId,y:o.clientY,height:u.getBoundingClientRect().height})},onPointerMove:o=>{!t.current||t.current.pointerId!==o.pointerId||I(t.current.height+t.current.y-o.clientY)},onPointerUp:o=>{!t.current||t.current.pointerId!==o.pointerId||(t.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{t.current=null},onPointerCancel:()=>{t.current=null},"data-component":"editorresizehandle"})}const at=({onFilesSelected:l,onInlineImageRemove:t})=>{const[e]=he.useLexicalComposerContext(),[d,p]=s.useState(!1),[_,I]=s.useState(!1),[o,u]=s.useState(!1),[b,S]=s.useState(!1),[k,C]=s.useState(!1),[w,z]=s.useState(!1),[a,m]=s.useState(""),[D,H]=s.useState(null),[B,F]=s.useState(null),[q,j]=s.useState(""),W=ge(q.trim()),re=s.useRef(null),J=s.useRef(null),ie=s.useRef(null),T=s.useRef(null),K=s.useRef(!1),Q=r=>r.preventDefault(),ee=s.useCallback(r=>{T.current=c.$isRangeSelection(r)?r.clone():null},[]),X=s.useCallback(r=>{e.update(()=>{T.current&&c.$setSelection(T.current),r()}),T.current=null},[e]),ae=r=>{K.current=!0,r.preventDefault()},Z=()=>{if(K.current){K.current=!1;return}v()},N=s.useCallback(()=>{I(!1),m(""),H(null),F(null)},[]),E=s.useCallback(()=>{C(!1),j("")},[]),le=s.useCallback(r=>{I(!0),m((r==null?void 0:r.src)??""),H((r==null?void 0:r.key)??null),F((r==null?void 0:r.soliboDocumentSlot)??null),E(),r!=null&&r.soliboDocumentSlot||setTimeout(()=>{var x;return(x=J.current)==null?void 0:x.focus()},0)},[E]),ce=s.useCallback(r=>{e.getEditorState().read(()=>{ee(c.$getSelection())}),C(!0),j(r),N(),setTimeout(()=>{var x;return(x=ie.current)==null?void 0:x.focus()},0)},[N,e,ee]),M=s.useCallback(()=>{const r=q.trim();ge(r)&&(X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:r,target:"_blank"});const x=c.$getSelection();if(!c.$isRangeSelection(x))return;const A=x.getNodes().at(-1)??null,U=(A==null?void 0:A.getParent())??null,L=P.$isLinkNode(A)?A:P.$isLinkNode(U)?U:null;if(L){const n=L.getLastChild();if(c.$isTextNode(n)){const y=n.getTextContent(),ne=y.replace(/\s+$/,"");ne!==y&&n.setTextContent(ne)}const h=L.getNextSibling();if(c.$isTextNode(h)&&/^\s/.test(h.getTextContent())){h.select(1,1);return}const g=c.$createTextNode(" ");L.insertAfter(g),g.selectEnd()}}),E())},[E,e,q,X]),v=s.useCallback(()=>{const r=a.trim();if(!r){N();return}e.update(()=>{if(D){const x=c.$getNodeByKey(D);de(x)&&x.setSrc(r);return}c.$insertNodes([ue({src:r})])}),N()},[N,e,D,a]),G=s.useCallback(()=>{if(!D){N();return}e.update(()=>{const r=c.$getNodeByKey(D);if(de(r)){const x=r.getParent();c.$isParagraphNode(x)&&x.getChildrenSize()===1?x.remove():r.remove(),B&&(t==null||t(B))}}),N()},[N,e,D,B,t]),te=s.useCallback(()=>{X(()=>{e.dispatchCommand(P.TOGGLE_LINK_COMMAND,null)}),E()},[E,e,X]),Y=s.useCallback(()=>{const r=c.$getSelection();if(!c.$isRangeSelection(r)){if(c.$isNodeSelection(r)){const U=r.getNodes(),L=U[0]??null,n=(L==null?void 0:L.getParent())??null;p(U.some(g=>c.$isTextNode(g)&&g.hasFormat("bold"))),u(U.some(g=>c.$isTextNode(g)&&g.hasFormat("italic"))),S(U.some(g=>c.$isTextNode(g)&&g.hasFormat("underline"))),z(O.$isListNode(n)||O.$isListItemNode(n)||O.$isListNode(L)||O.$isListItemNode(L));const h=P.$isLinkNode(L)?L:P.$isLinkNode(n)?n:null;if(h){C(!0),j(h.getURL());return}C(!1),j(""),T.current=null;return}p(!1),u(!1),S(!1),z(!1),C(!1),j(""),T.current=null;return}const[x]=r.getNodes(),A=(x==null?void 0:x.getParent())??null;if(p(r.hasFormat("bold")),u(r.hasFormat("italic")),S(r.hasFormat("underline")),z(O.$isListNode(A)||O.$isListItemNode(A)),P.$isLinkNode(A)){C(!0),j(A.getURL()),ee(r);return}C(!1),j(""),T.current=null},[ee]);return s.useEffect(()=>Re.mergeRegister(e.registerUpdateListener(({editorState:r})=>{r.read(()=>{Y()})}),e.registerCommand(be,r=>(r.soliboDocumentSlot?(N(),E()):le(r),!0),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(e.getEditorState().read(()=>{Y()}),!1),c.COMMAND_PRIORITY_LOW)),[N,E,e,le,Y]),i.jsxs(je.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(R.Button,{"aria-label":"Bold","data-active":d,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx($.Icon,{name:"TextB"})}),i.jsx(R.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx($.Icon,{name:"TextItalic"})}),i.jsx(R.Button,{"aria-label":"Underline","data-active":b,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx($.Icon,{name:"TextUnderline"})}),i.jsx(R.Button,{"aria-label":"List","data-active":w,onClick:()=>{w?e.dispatchCommand(O.REMOVE_LIST_COMMAND,void 0):e.dispatchCommand(O.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx($.Icon,{name:"ListBullets"})}),i.jsx(R.Button,{"aria-label":"Link","data-active":k,onClick:()=>{k?ce(q):(e.dispatchCommand(P.TOGGLE_LINK_COMMAND,{url:"https://"}),ce("https://"))},title:"Link",variant:"tertiary",children:i.jsx($.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:r=>{r.target.files&&l(r.target.files),r.target.value=""},ref:re,type:"file"}),i.jsx(R.Button,{"aria-label":"Upload files",onClick:()=>{var r;return(r=re.current)==null?void 0:r.click()},title:"Upload files",variant:"tertiary",children:i.jsx($.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:se(f.meta,k||_?f.active:""),children:[k&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{"aria-invalid":!W,onBlur:()=>M(),onChange:r=>j(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),M())},ref:ie,value:q}),i.jsx(R.Button,{"aria-label":"Apply link",disabled:!W,onClick:()=>{M()},onMouseDown:Q,variant:"tertiary",children:i.jsx($.Icon,{name:"Check"})}),i.jsx(R.Button,{"aria-label":"Remove link",onClick:()=>te(),onMouseDown:Q,variant:"tertiary",children:i.jsx($.Icon,{name:"Trash",variant:"danger"})})]}),_&&i.jsxs(i.Fragment,{children:[!B&&i.jsxs(i.Fragment,{children:[i.jsx(_e.Input,{className:se(f.active),onBlur:Z,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),K.current=!0,v())},ref:J,value:a}),i.jsx(R.Button,{"aria-label":"Apply image",onClick:()=>v(),onMouseDown:ae,variant:"tertiary",children:i.jsx($.Icon,{name:"Check"})})]}),i.jsx(R.Button,{"aria-label":"Remove image",onClick:()=>G(),onMouseDown:ae,variant:"tertiary",children:i.jsx($.Icon,{name:"Trash",variant:"danger"})})]})]})]})},lt=c.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[P.AutoLinkNode,P.LinkNode,O.ListNode,O.ListItemNode,oe],onError(l){throw l},theme:{link:f.link,list:{ol:f.list,ul:f.list},paragraph:f.paragraph,text:{bold:f.bold,italic:f.italic,underline:f.underline}}});function ct({autofocus:l,content:t="",sessionKey:e,lastEmittedContentRef:d,imagePreviews:p}){const[_]=he.useLexicalComposerContext(),I=s.useRef(e);return s.useEffect(()=>{const o=I.current!==e;I.current=e,!(!o&&d.current===t)&&(_.update(()=>{const b=new DOMParser().parseFromString(t,"text/html");b.querySelectorAll("img[data-solibo-document-slot]").forEach(C=>{const w=p.get(C.getAttribute("data-solibo-document-slot"));w&&C.setAttribute("src",w)});const S=fe.$generateNodesFromDOM(_,b),k=c.$getRoot();k.clear().select(),c.$insertNodes(S),l||o?k.selectEnd():c.$setSelection(null)},{discrete:!0}),o&&_.dispatchCommand(c.CLEAR_HISTORY_COMMAND,void 0))},[l,t,_,p,d,e]),null}const ut=({autofocus:l=!1,attachmentsEnabled:t=!0,sessionKey:e,autolink:d=!1,content:p,controls:_,disabled:I=!1,errorMessage:o,fill:u=!1,files:b,inline:S=!1,inlineImages:k,invalid:C=!1,isSubmitting:w=!1,maxRows:z=12,minRows:a=1,onChange:m,onFilesChange:D,onInlineImagesChange:H,onSubmit:B,onUpload:F,placeholder:q,required:j=!1,resizable:W=!1,submitLabel:re="Submit",variant:J="default"})=>{const ie=s.useId(),T=s.useRef(void 0),K=s.useRef(!1),Q=s.useRef(null),[ee,X]=s.useState(!1),[ae,Z]=s.useState(!1),[N,E]=s.useState([]),[le,ce]=s.useState([]),M=s.useRef(new Map),v=b??N,G=k??le;s.useEffect(()=>{const n=Q.current;if(!n)return;if(!W||u){n.style.removeProperty("height"),X(!1);return}const h=()=>X(n.style.height!==""),g=new MutationObserver(h);return g.observe(n,{attributes:!0,attributeFilter:["style"]}),h(),()=>g.disconnect()},[u,W]);const te=n=>{b===void 0&&E(n),D==null||D(n)},Y=s.useCallback(n=>{k===void 0&&ce(n),H==null||H(n)},[k,H]),r=s.useCallback(n=>{const h=n.map(g=>{const y=`pasted-${crypto.randomUUID()}`,ne=URL.createObjectURL(g);return M.current.set(y,ne),{image:{alt:g.name,soliboDocumentSlot:y,src:ne},pending:{file:g,slot:y}}});return Y([...G,...h.map(({pending:g})=>g)]),h.map(({image:g})=>g)},[G,Y]),x=s.useCallback(n=>{Y(G.filter(g=>g.slot!==n));const h=M.current.get(n);h&&URL.revokeObjectURL(h),M.current.delete(n)},[G,Y]);s.useEffect(()=>()=>{M.current.forEach(n=>URL.revokeObjectURL(n)),M.current.clear()},[]),s.useEffect(()=>{const n=new Set(G.map(h=>h.slot));M.current.forEach((h,g)=>{n.has(g)||(URL.revokeObjectURL(h),M.current.delete(g))})},[G]);const A=n=>{if(typeof DataTransfer<"u"){const h=new DataTransfer;return n.forEach(g=>h.items.add(g)),h.files}return Object.assign([...n],{item:h=>n[h]??null})},U=async()=>{if(!(I||w||K.current)){K.current=!0;try{t&&v.length>0&&await(F==null?void 0:F(A(v))),await(B==null?void 0:B()),t&&v.length>0&&te([])}catch{return}finally{K.current=!1}}},L=n=>{n.preventDefault(),n.stopPropagation()};return i.jsxs("div",{className:se(f.field,u&&f.fill),"data-max-rows":z,"data-min-rows":a,onDragEnter:n=>{L(n),Z(t&&!!D)},onDragOver:n=>{L(n),Z(t&&!!D)},onDragLeave:n=>{L(n),Z(!1)},onDropCapture:n=>{var g;const h=(g=n.dataTransfer)==null?void 0:g.files;h!=null&&h.length&&(L(n),t&&(D||F)&&te([...v,...Array.from(h)]),Z(!1))},onDrop:n=>{n.preventDefault(),Z(!1)},"data-component":"editor",children:[W==="top"&&!u&&i.jsx(ot,{editableRef:Q}),i.jsx("div",{className:se(f.editor,!!_&&f["with-controls"],J==="embedded"&&f.embedded,u&&f["fill-editor"],W===!0&&!u&&f.resizable,W&&!u&&ee&&f.resized,C&&f.invalid,v.length>0&&f["has-files"]),style:{"--editor-max-height":`calc(${z*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${a*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(ve.LexicalExtensionComposer,{contentEditable:null,extension:lt,children:[!S&&J!=="embedded"&&i.jsx(at,{onInlineImageRemove:t?x:void 0,onFilesSelected:t&&(F||D)?n=>{te([...v,...Array.from(n)])}:void 0}),i.jsx("div",{className:se(f.content,ae&&f.dragging),children:i.jsx(Se.RichTextPlugin,{contentEditable:i.jsx(Le.ContentEditable,{ref:Q,"aria-placeholder":q??"",ariaErrorMessage:C&&o?ie:void 0,ariaInvalid:C||void 0,ariaRequired:j||void 0,placeholder:()=>q?i.jsx("div",{className:f.placeholder,children:q}):null}),ErrorBoundary:ke.LexicalErrorBoundary})}),!S&&J!=="embedded"&&(_||B)&&i.jsx("div",{className:f.submit,children:_??i.jsx(R.Button,{"aria-label":re,"data-cy":"toolbar-submit-button",disabled:I,icon:"PaperPlaneTilt",isLoading:w,onClick:()=>void U(),variant:"primary",children:i.jsx("span",{children:re})})}),t&&v.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:f.files,role:"region",children:v.map((n,h)=>i.jsx(ye.File,{deleteAccessibleLabel:`Remove ${n.name} from upload queue`,name:n.name,onDelete:()=>te(v.filter((g,y)=>y!==h))},`${n.name}-${n.size}-${n.lastModified}-${h}`))}),l&&i.jsx(De.AutoFocusPlugin,{}),d&&i.jsx(Ce.AutoLinkPlugin,{matchers:st}),i.jsx(we.HistoryPlugin,{}),t&&H&&i.jsx(rt,{createImages:r,onRemove:x}),p!==void 0&&i.jsx(ct,{autofocus:l,content:p,sessionKey:e,lastEmittedContentRef:T,imagePreviews:M.current}),i.jsx(Ne.LinkPlugin,{validateUrl:ge}),i.jsx(Me.ListPlugin,{}),m&&i.jsx(Ae.OnChangePlugin,{ignoreHistoryMergeTagChange:!1,onChange:(n,h)=>{n.read(()=>{const g=fe.$generateHtmlFromNodes(h,null),y=me(g,{allowedAttributes:{...me.defaults.allowedAttributes,img:[...me.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});T.current=y,m(y)})}})]})}),C&&o&&i.jsx("div",{className:f.error,id:ie,children:o})]})};exports.Editor=ut;