jamespot-react-core 1.1.150 → 1.1.152

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.
@@ -0,0 +1,422 @@
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[560],{560:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>Kt,CommentsBloc:()=>Ye,DisplayForm:()=>ri,EditorsPortal:()=>Ut,Empty:()=>Ze,JRCInputTinyMCEWithExt:()=>Xt,JRCInputTinyMCEWithExtRaw:()=>Yt,TwoColLayout:()=>lt,WidgetList:()=>L,WidgetWrapperCore:()=>_e});var n=i(509),l=i(404),o=i(396),r=i(6),a=i.n(r),s=i(363),c=i.n(s),d=i(181),u=i(855),m=i(754),g=i.n(m);const p=g().div`
2
+ display: flex;
3
+ flex-direction: row;
4
+ flex-wrap: wrap;
5
+ gap: 10px;
6
+ justify-content: center;
7
+ `,f=g().div`
8
+ border: 1px solid ${e=>e.theme.color.grey2};
9
+ border-radius: 8px;
10
+ cursor: pointer;
11
+ padding: 12px;
12
+ position: relative;
13
+ opacity: ${e=>e.available?"1":".4"};
14
+ pointer-events: ${e=>e.available?"all":"none"};
15
+
16
+ .show-on-hover {
17
+ position: absolute;
18
+ inset: 0;
19
+ border-radius: 8px;
20
+ justify-content: center;
21
+ align-items: center;
22
+ display: flex;
23
+ opacity: 0;
24
+ background-color: #ffffffe6;
25
+ }
26
+
27
+ &:hover {
28
+ .show-on-hover {
29
+ opacity: 1;
30
+ }
31
+ }
32
+ `,E=g().div`
33
+ border: 2px solid ${e=>e.theme.color.primary};
34
+ height: ${e=>e.open?"320":"54"}px;
35
+ border-radius: 8px;
36
+ display: flex;
37
+ justify-content: top;
38
+ flex-direction: column;
39
+ transition: height 0.4s;
40
+ overflow: hidden;
41
+ flex-direction: column;
42
+ `,y=g().div`
43
+ display: flex;
44
+ flex-direction: row;
45
+ flex-wrap: wrap;
46
+ justify-content: center;
47
+ gap: 10px;
48
+ `,h=g().div`
49
+ min-height: 50px;
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ cursor: pointer;
54
+ color: ${e=>e.theme.color.primary};
55
+ &:hover {
56
+ background-color: ${e=>e.theme.color.grey0};
57
+ }
58
+ `,v=g().button`
59
+ height: 72px;
60
+ display: flex;
61
+ align-items: center;
62
+ padding: 0 10px;
63
+ gap: 10px;
64
+ width: 40%;
65
+ border: 1px solid ${e=>e.theme.color.grey2};
66
+ border-radius: 8px;
67
+ transition: opacity 0.4s ease ${e=>40*e.index}ms;
68
+ opacity: ${e=>e.open?1:0};
69
+ img {
70
+ width: 40px;
71
+ }
72
+ ${e=>e.full&&"flex: 1"}
73
+ `,x=g().div`
74
+ display: flex;
75
+ flex-direction: ${e=>"row"===e.direction?"row":"column"};
76
+ align-items: ${e=>"row"===e.direction?"center":"flex-start"};
77
+ justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
78
+ flex: 1;
79
+ ${e=>e.gap&&`gap:${e.gap}px`}
80
+ `,b=n.default.registry.getLazyComponent("Button"),C=n.default.registry.getLazyComponent("ModalLayout"),w=n.default.registry.getLazyComponent("ModalContent"),k=n.default.registry.getLazyComponent("Tooltip"),W=n.default.registry.getLazyComponent("IconButton"),L=({mode:e,view:t,children:i,namespace:n="default",onChange:o})=>{const[a,s]=c().useState(!1),u=function(e){switch(e){case"widget-article-image":return[l.$L.definition(r.WidgetsName.ArticleTitle),l.$L.definition(r.WidgetsName.ArticleButton)];case"comment":return[l.$L.definition(r.WidgetsName.CheckList)];default:return[l.$L.definition(r.WidgetsName.ArticleTitle),l.$L.definition(r.WidgetsName.ArticleText),l.$L.definition(r.WidgetsName.ArticleImage),l.$L.definition(r.WidgetsName.ArticleButton),l.$L.definition(r.WidgetsName.ArticleSlider),l.$L.definition(r.WidgetsName.ArticleAttachment)]}}(n),m=(0,d.useIntl)(),g={open:a,portalId:"react-modal",variant:"full-height",closeHandler:()=>s(!1)},E=e=>{o(l.$L.factory(e)),s(!1)};return c().createElement(c().Fragment,null,c().createElement(C,Object.assign({},g),c().createElement(w,{onClickIconClose:g.closeHandler,buttons:"comment"===e?[{children:c().createElement(d.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>s(!1)}]:void 0,title:m.formatMessage({id:"WIDGET_Builder"})},"comment"===e?c().createElement(y,null,u.map(((e,t)=>c().createElement(v,{key:e.name,open:!0,full:!0,index:t,onClick:()=>E(e.name)},c().createElement(x,{direction:"row",gap:12},c().createElement("img",{src:e.img}),c().createElement(x,{direction:"column"},c().createElement("h3",null,m.formatMessage({id:e.label})),c().createElement("p",null,m.formatMessage({id:e.description})))))))):c().createElement(p,null,u.map(((e,t)=>c().createElement(f,{key:t,onClick:()=>E(e.name),available:e.available},c().createElement("img",{src:e.img}),c().createElement("div",{className:"show-on-hover"},m.formatMessage({id:e.label})))))))),"custom"===e&&i?c().createElement("div",{onClick:()=>s(!0)},i):c().createElement(c().Fragment,null),"button"===e&&"edit"===t?c().createElement(b,{onClick:()=>s(!0),variant:"outlined",minWidth:"100%"},m.formatMessage({id:"WIDGET_Add_Widget"})):c().createElement(c().Fragment,null),"gallery"===e&&"edit"===t?c().createElement(p,null,u.map(((e,t)=>c().createElement(f,{key:t,onClick:()=>E(e.name),available:e.available},c().createElement("img",{src:e.img}),c().createElement("div",{className:"show-on-hover"},m.formatMessage({id:e.label})))))):c().createElement(c().Fragment,null),"article"===e&&"edit"===t?c().createElement(q,{widgets:u,onClick:E}):c().createElement(c().Fragment,null),"comment"===e&&"edit"===t?c().createElement(S,{onClick:()=>{s(!0)}}):c().createElement(c().Fragment,null))},q=({widgets:e,onClick:t})=>{const[i,n]=c().useState(!1),l=(0,d.useIntl)();return c().createElement(c().Fragment,null,c().createElement(E,{open:i},c().createElement(h,{onClick:()=>n(!i)},l.formatMessage({id:"WIDGET_Add_Widget"})),c().createElement(y,null,e.map(((e,n)=>c().createElement(v,{key:e.name,open:i,index:n,onClick:()=>t(e.name)},c().createElement("img",{src:e.img}),l.formatMessage({id:e.label})))))))},S=({onClick:e})=>{const t=(0,d.useIntl)();return c().createElement(c().Fragment,null,c().createElement(k,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},c().createElement(W,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))},A=g().div`
81
+ flex: 1;
82
+ display: flex;
83
+ flex-direction: row;
84
+ min-height: 60px;
85
+ align-items: center;
86
+ `,$=({widget:e})=>{const{url:t,keys:i,order:n,orderBy:l}=e.content,[r,a]=c().useState([]);return c().useEffect((()=>{t&&function(e){return"string"==typeof e&&0!==e.length&&e.startsWith("https://")}(t)?fetch(t,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{Array.isArray(e.result)||console.warn("resposne must be an array"),a(e.result)})):console.warn(`${t} is not a valid url`)}),[t]),c().createElement(A,null,c().createElement(o.JRCWidgetApi,{data:r,keys:null!=i?i:[],order:null!=n?n:"",orderBy:null!=l?l:"asc"}))};var T=i(5);const I=n.default.registry.getLazyComponent("WidgetTable"),M=n.default.registry.getLazyComponent("Loader"),O=(g().div``,g().div`
87
+ position: absolute;
88
+ inset: 0;
89
+ display: flex;
90
+ flex-direction: column;
91
+ justify-content: center;
92
+ align-items: center;
93
+ gap: ${e=>e.theme.space.md}px;
94
+ `),F=g().div`
95
+ position: absolute;
96
+ inset: 0;
97
+ display: flex;
98
+ flex-direction: row;
99
+ justify-content: center;
100
+ align-items: center;
101
+ gap: ${e=>e.theme.space.md}px;
102
+ color: ${e=>e.theme.color.primary};
103
+ cursor: pointer;
104
+ opacity: 0;
105
+ border: 1px solid ${e=>e.theme.color.primary};
106
+ &:hover {
107
+ background-color: ${e=>e.theme.color.grey2};
108
+ opacity: 0.9;
109
+ }
110
+ `,_=({uniqid:e,uri:t,limit:i,tableHeadColor:n,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableColumnsData:f=[],tableBorderRadius:E,tableSizedColumns:y,tableSizedColumnsWidth:h,mode:v})=>{const x=(0,d.useIntl)(),b=(0,T.TL)(),[C,w]=(0,s.useState)(!1),[k,W]=(0,s.useState)(!1),[L,q]=(0,s.useState)([]),[S,A]=(0,s.useState)([]),$=(0,s.useMemo)((()=>l.$L.definition(r.WidgetsName.DatasourceTable)),[]);(0,s.useEffect)((()=>{void 0!==t&&0!==f.length&&0===S.length&&(W(!0),a().datasource.get(t,r.Format.VIEW).then((e=>{A(e.result.model),q(e.result.data)})).finally((()=>W(!1))))}),[t,f,S]);const _=(0,s.useCallback)((()=>{b(l.Wq.slice.actions.flushAllEditor()),b(l.Wq.slice.actions.registerEditor({uniqid:e,name:r.WidgetsName.DatasourceTable}))}),[b,e]);(0,s.useEffect)((()=>{"view"!==v&&"preview"!==v||b(l.Wq.slice.actions.flushAllEditor())}),[v,b]),(0,s.useEffect)((()=>{C||t||"edit"!==v||(_(),w(!0))}),[b,e,C,t,_,v]);const j=(0,s.useMemo)((()=>((e,t)=>{const i=[];return e.filter((e=>e.isVisible)).forEach((e=>{const n=t.find((t=>t.name===e.name));n&&i.push(n)})),i})(f,S)),[f,S]);return 0!==f.length||k||"edit"!==v?k?c().createElement(O,null,c().createElement(M,null)):c().createElement(c().Fragment,null,k||0!==L.length?c().createElement(I,{rows:L,columns:j,limit:i,tableHeadColor:n,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableBorderRadius:E,tableColumnsData:f,tableSizedColumns:y,tableSizedColumnsWidth:h}):c().createElement(O,null,c().createElement("img",{src:`/img/fast-intranet/${r.WidgetsName.DatasourceTable}.png`,alt:""}),c().createElement(d.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===v?c().createElement(F,{onClick:_},c().createElement(o.JRCHtml,{__html:`${x.formatMessage({id:"WIDGET_Set_Widget"})} <b>${x.formatMessage({id:$.label})}</b>`})):c().createElement(c().Fragment,null)):c().createElement(O,{onClick:_},c().createElement("img",{src:`/img/fast-intranet/${r.WidgetsName.DatasourceTable}.png`,alt:""}),c().createElement(d.FormattedMessage,{id:$.label}),c().createElement(o.JRCButton,{label:"GLOBAL_Settings"}))},j=g().div`
111
+ width: 0;
112
+ height: 0;
113
+ overflow: hidden;
114
+ `,D=({children:e,initialFiles:t,initialClick:i,multiple:n,accept:r,onUploadStart:a,onUploadEnd:s,onUploadSuccess:d})=>{const m=c().useRef(null),g=(0,u.useSelector)(l.$L.selectors.selectToken),[p,f]=c().useState(0),[E,y]=c().useState(t);return c().useEffect((()=>{var e;i&&(null===(e=m.current)||void 0===e||e.click())}),[i]),c().useEffect((()=>{t.length!==E.length&&y(t)}),[t]),c().useEffect((()=>{d(E)}),[E]),c().useEffect((()=>{0===p&&s()}),[p]),c().createElement(c().Fragment,null,c().createElement("div",{onClick:()=>{var e;i&&(null===(e=m.current)||void 0===e||e.click())}},e),c().createElement(j,null,c().createElement(o.JRCInputFileAdvancedRaw,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:r,multiple:n,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),y((t=>n?[...t,e]:[e])))}})))},R=n.default.registry.getLazyComponent("WidgetAttachment"),z=n.default.registry.getLazyComponent("FileViewer"),B=g().div`
115
+ flex: 1;
116
+ `,G=({widget:e,inplace:t,mode:i})=>{const n=(0,d.useIntl)(),{uniqid:r}=e,{files:m}=e.content,g=(0,u.useDispatch)(),p=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,r)),u.shallowEqual),f=e=>{g(l.FN.actions.error({label:null!=e?e:n.formatMessage({id:"GLOBAL_Error"})}))};(0,s.useEffect)((()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),(0,s.useEffect)((()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,empty:!m||0===m.length}))}),[m]);const E=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"OnlyOfficeHook"))),y=[{label:n.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&a().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const i=t.result;((e,t,i)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,i)})).catch((()=>{g(l.FN.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],h=E?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:y}]:[];return void 0!==m?c().createElement(B,null,"view"!==i?c().createElement(R,{files:m,onClick:()=>{},onError:f}):c().createElement(z,{files:m,openWithOptions:h},(e=>c().createElement(R,{files:m,onClick:t=>e(t),onError:f}))),t&&"view"!==i&&c().createElement(D,{initialFiles:m,initialClick:p,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&g((0,l.O5)(r,{files:e}))},onUploadStart:()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},"edit"===i?c().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):c().createElement(c().Fragment,null))):c().createElement(c().Fragment,null)},H=g().div`
117
+ display: flex;
118
+ flex: 1;
119
+ justify-content: center;
120
+ align-items: center;
121
+ `,N=g().div`
122
+ pointer-events: ${e=>e.clickable?"all":"none"};
123
+ cursor: pointer;
124
+ display: flex;
125
+ flex: 1;
126
+ justify-content: center;
127
+ align-items: center;
128
+ `,U=({widget:e,mode:t})=>{const i=(0,u.useDispatch)(),{uniqid:n}=e,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E}=e.content;return(0,s.useEffect)((()=>{i(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!r||0===r.length}))}),[r]),c().createElement(H,{onClick:()=>{"edit"===t&&i(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}},c().createElement(N,{clickable:"edit"!==t},c().createElement(o.JRCWidgetButton,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E})))},P=n.default.registry.getLazyComponent("WidgetArticleGallery"),V=n.default.registry.getLazyComponent("FileViewer"),Q=g().button`
129
+ cursor: pointer;
130
+ `,K=({widget:e,inplace:t,mode:i})=>{var n,r;const{uniqid:a}=e,{files:s}=e.content,d=(0,u.useDispatch)(),m=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,a)),u.shallowEqual);return c().useEffect((()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),void 0!==s?c().createElement(c().Fragment,null,"edit"===i?c().createElement(P,{files:s,maxWidth:800,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(r=e.content.column)&&void 0!==r?r:"3",onClick:()=>{}}):c().createElement(V,{files:s,openWithOptions:[]},(t=>{var i,n;return c().createElement(Q,null,c().createElement(P,{files:s,maxWidth:600,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(n=e.content.column)&&void 0!==n?n:"3",onClick:e=>t(e)}))})),t&&"edit"===i?c().createElement(D,{initialFiles:s,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,l.O5)(a,{files:e}))},onUploadStart:()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},c().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):c().createElement(c().Fragment,null)):c().createElement(c().Fragment,null)},X=n.default.registry.getLazyComponent("WidgetImage"),Y=n.default.registry.getLazyComponent("FileViewer"),Z=g().div`
131
+ position: absolute;
132
+ inset: 0;
133
+ background-color: rgba(0, 0, 0, 0.4);
134
+ pointer-event: none;
135
+ display: flex;
136
+ justify-content: center;
137
+ align-items: center;
138
+ opacity: 0;
139
+ color: ${e=>e.theme.color.white};
140
+ &:hover {
141
+ opacity: 1;
142
+ }
143
+ `,ee=g().button`
144
+ cursor: pointer;
145
+ `,te={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},ie=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},ne=({widget:e,width:t,inplace:i,mode:n})=>{const{uniqid:a}=e,{file:m,useFilter:g}=e.content,p=(0,u.useDispatch)(),f=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,a)),u.shallowEqual),[E,y]=(0,s.useState)(void 0),h=(0,d.useIntl)();return(0,s.useEffect)((()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,s.useEffect)((()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,empty:!m}))}),[m]),(0,s.useEffect)((()=>{m&&y((0,r.formatImgUrl)({timestamp:m.dateModified?ie(m.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:m.uri}))}),[m]),c().createElement(c().Fragment,null,"edit"===n?void 0!==E?c().createElement(X,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g}):c().createElement(c().Fragment,null):c().createElement(Y,{files:[Object.assign(Object.assign({},te),{path:E,mimetype:"image/png"})],openWithOptions:[]},(e=>c().createElement(ee,{onClick:()=>e(0)},c().createElement(X,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g})))),i&&"edit"===n?c().createElement(D,{initialFiles:[],initialClick:f,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&p((0,l.O5)(a,{file:e[0]}))},onUploadStart:()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==m?c().createElement(Z,null,h.formatMessage({id:"ARTICLE_Widget_Image_Change"})):c().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):c().createElement(c().Fragment,null))},le=n.default.registry.getLazyComponent("FileViewer"),oe=g().div`
146
+ flex: 1;
147
+ display: flex;
148
+ flex-direction: row;
149
+ min-height: 60px;
150
+ align-items: center;
151
+ width: ${e=>e.maxWidth}px;
152
+ `,re={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},ae=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},se=({widget:e,mode:t,width:i})=>{const{uniqid:n}=e,a=(0,T.TL)(),d=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,n)),u.shallowEqual),m=null!=i?i:600,[g,p]=(0,s.useState)(void 0),f=(0,s.useRef)(null),E=(0,s.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},re),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:re.mimetype,path:(0,r.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?ae(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),y=(0,s.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,r.formatImgUrl)({timestamp:e.file.dateModified?ae(e.file.dateModified):Date.now(),size:`fitx${g&&g<m?g:m}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,g,m]);(0,s.useEffect)((()=>{d&&"edit"===t&&a(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}),[d]),(0,s.useEffect)((()=>{const e=()=>{f.current&&p(f.current?f.current.offsetWidth:m)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[f]),(0,s.useEffect)((()=>{p(f.current?f.current.offsetWidth:m)}),[f]),(0,s.useEffect)((()=>{a(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const h=(0,s.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),v=(0,s.useCallback)((()=>{a(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===g?c().createElement("div",{ref:f,style:{width:"100%"}}):c().createElement(oe,{maxWidth:g&&g<m?g:m},c().createElement(le,{files:E,openWithOptions:[]},(i=>{var r,s;return c().createElement(o.JRCWidgetSlider,{slides:y,maxWidth:g&&g<m?g:m,useDots:null===(r=e.content.useDots)||void 0===r||r,loop:null!==(s=e.content.loop)&&void 0!==s&&s,startAt:0,onClickSlide:o=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[o];t&&t.file&&i(t.file.id)}}else a(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}})})),h?c().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:v}):c().createElement(c().Fragment,null))},ce=n.default.registry.getLazyComponent("WidgetArticleText"),de=g().div`
153
+ cursor: text;
154
+ p {
155
+ word-wrap: break-word;
156
+ }
157
+ a {
158
+ word-wrap: break-word;
159
+ }
160
+ `,ue=({widget:e,mode:t})=>{const{uniqid:i}=e,o=(0,m.useTheme)(),{text:r}=e.content,a=(0,u.useDispatch)(),g=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,i)),u.shallowEqual),p=(0,u.useSelector)((e=>{var t;return null===(t=l.$L.selectors.selectWidgetState(e,i))||void 0===t?void 0:t.busy})),f=(0,u.useSelector)(l.$L.selectors.selectToken),E=(0,u.useSelector)(l.zh.selectors.selectTinyMCECommonOptions),y=(0,u.useSelector)(l.Hn.selectors.selectAll),h=(0,d.useIntl)(),v=(0,s.useCallback)((e=>{a(l.FN.actions.error({label:null!=e?e:h.formatMessage({id:"GLOBAL_Error"})}))}),[a,h]);(0,s.useEffect)((()=>{a(l.$L.slice.actions.setWidgetState({uniqid:i,empty:!r||0===r.length}))}),[r]);const x=(0,s.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(y,o,v)),[y,v,o]);return p?c().createElement(c().Fragment,null):c().createElement(de,null,c().createElement(ce,{autoFocus:g,text:null!=r?r:"",token:"edit"===t&&void 0!==f?f:"",tinyMCECommonOptions:"edit"===t&&E?{tinymceScriptSrc:"https://ecosysteme.jamespot.pro/js/tinymce/tinymce.min.js",commonOptions:E,mentionsQueries:x}:void 0,mode:t,onChange:e=>{a((0,l.O5)(i,{text:e}))}}))},me=n.default.registry.getLazyComponent("WidgetArticleTitle"),ge=g().div`
161
+ flex: 1;
162
+ display: flex;
163
+ flex-direction: row;
164
+ align-items: center;
165
+ cursor: text;
166
+ `,pe=g().div`
167
+ display: flex;
168
+ flex-direction: row;
169
+ border-radius: 8px;
170
+ overflow: hidden;
171
+ margin: 4px;
172
+ border: 1px solid ${e=>e.theme.color.grey1};
173
+ `,fe=g().button`
174
+ display: flex;
175
+ width: 40px;
176
+ height: 40px;
177
+ justify-content: center;
178
+ align-items: center;
179
+ cursor: pointer;
180
+ opacity: ${e=>e.isActive?"1.0":".8"};
181
+ background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
182
+ &:hover {
183
+ background-color: ${e=>e.theme.color.grey1};
184
+ }
185
+ `,Ee=({widget:e,inplace:t,mode:i})=>{const{uniqid:n}=e,{text:o,color:r,heading:a}=e.content,d=(0,u.useDispatch)(),m=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,n)),u.shallowEqual);return(0,s.useEffect)((()=>{d(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!o||0===o.length}))}),[o]),c().createElement(ge,null,c().createElement(me,{text:o,color:r,heading:a,autoFocus:m,inplace:t,mode:i,onChange:e=>{d((0,l.O5)(n,{text:e}))}}),m&&"edit"===i?c().createElement(ye,{heading:a,onClick:e=>{d((0,l.O5)(n,{heading:e}))}}):c().createElement(c().Fragment,null))},ye=({heading:e="h1",onClick:t})=>c().createElement(pe,null,["h1","h2","h3","h4"].map(((i,n)=>c().createElement(fe,{key:n,isActive:e===i,onClick:()=>t(i)},i)))),he=J.react.registry.getLazyComponent("WidgetCheckList"),ve=J.react.registry.getLazyComponent("WidgetCheckListEditor"),xe=J.react.registry.getLazyComponent("Typography"),be=(g().div`
186
+ display: flex;
187
+ flex-direction: row;
188
+ justify-content: space-between;
189
+ align-items: center;
190
+ border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
191
+ min-height: 24px;
192
+ border-radius: 4px;
193
+ padding: 4px 8px;
194
+ `,g().div`
195
+ display: flex;
196
+ justify-content: center;
197
+ align-items: center;
198
+ border: 1px solid ${e=>e.theme.color.grey1};
199
+ border-bottom-left-radius: 4px;
200
+ border-bottom-right-radius: 4px;
201
+ padding: 4px;
202
+ margin-bottom: 8px;
203
+
204
+ div:first-child {
205
+ margin: 0 auto;
206
+ }
207
+
208
+ div:last-child {
209
+ align-self: flex-end;
210
+ }
211
+ `),Ce=g().div`
212
+ width: 100%;
213
+ flex: 1;
214
+ display: flex;
215
+ flex-direction: column;
216
+ align-items: flex-start;
217
+ justify-content: center;
218
+ gap: 8px;
219
+ `,we=g().div`
220
+ display: flex;
221
+ gap: 14px;
222
+ padding: 10px 10px 0 10px;
223
+ border-radius: 8px;
224
+ background-color: ${({theme:e})=>e.color.white};
225
+ border: 1px solid ${e=>e.theme.color.grey2};
226
+ `,ke=g().div`
227
+ width: 100%;
228
+ padding-bottom: 12px;
229
+ border-bottom: ${e=>e.border?`1px solid ${e.theme.color.grey1}`:0};
230
+ `,We=({widget:e,commentId:t,inplace:i,mode:n,editRight:m,deleteRight:g,onRemove:p,onWidgetUpdate:f})=>{const E=(0,d.useIntl)(),{uniqid:y,content:h}=e,v=(0,u.useDispatch)(),[x,b]=(0,s.useState)(),[C,w]=(0,s.useState)(!1),[k,W]=(0,s.useState)(),[L,q]=(0,s.useState)(!1),S=(0,u.useSelector)((e=>l.$L.selectors.selectWidget(e,y))),A=(0,u.useSelector)(l.EK.selectors.get),$=(0,s.useCallback)((e=>{v(l.FN.actions.error({label:null!=e?e:E.formatMessage({id:"GLOBAL_Error"})}))}),[v,E]),T=e=>{v(l.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},I=()=>{v(l.$L.slice.actions.flushWidget({uniqid:y})),p&&p(y),w(!1)},M=t=>{v(l.Wq.slice.actions.flushAllEditor()),v(l.$L.slice.actions.setToken({token:t})),v(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:r.WidgetsName.CheckList}))};return(0,s.useEffect)((()=>{var t;const i=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,i,n;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(n=e.user)&&void 0!==n?n:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));b(i)}),[e.content.arr,h]),(0,s.useEffect)((()=>{k||L||(q(!0),a().network.token().then((e=>{W(e.result),q(!1)})).catch((e=>{$(e.errorMsg)})))}),[$,k,L]),"edit"===n&&i?c().createElement(c().Fragment,null,c().createElement(we,null,c().createElement(Ce,null,c().createElement(ke,{border:!0},c().createElement("label",null,E.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"})),c().createElement(o.JRCInputTextRaw,{id:E.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),required:!0,placeholder:E.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),type:"text",value:null==S?void 0:S.title,onChange:e=>{const{value:t}=e.target;T({uniqid:y,title:t})},margin:"2px",width:"100%"})),c().createElement(ve,{token:k,uniqid:y,content:h,onChangeContent:(e,t)=>{v((0,l.O5)(e,t))},onChangeWrapper:T,openEditorPanel:M,onRemoveWidget:I})))):c().createElement(c().Fragment,null,x&&c().createElement("div",{key:e.uniqid,style:{width:"100%"}},c().createElement(he,{title:null==S?void 0:S.title,limit:10,initialEntries:x,onFileClick:()=>{},onItemCheckListChange:(i,n)=>((e,i,n)=>{if(!t)return;const o={arr:null==n?void 0:n.map((e=>{var t,i;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({title:e.text},e.id&&{id:e.id}),e.links&&{links:e.links}),e.mimetype&&{mimetypes:e.mimetype}),A&&e.checked&&{user:{id:null!==(i=null===(t=e.user)||void 0===t?void 0:t.id)&&void 0!==i?i:A.id,mainType:"user",type:"user"}}),e.checked&&{value:e.checked})}))};v((0,l.O5)(e,o)),a().widget.checkListRespond({id:t,type:"comment",idUser:null==A?void 0:A.id,uniqid:e,index:i}).then((()=>{f&&f()})).catch((e=>{$(e.message)}))})(e.uniqid,i,n)}),m&&c().createElement(c().Fragment,null,c().createElement(be,null,c().createElement("div",{style:{cursor:"pointer"},onClick:()=>{k?M(k):$(E.formatMessage({id:"GLOBAL_Error"}))}},c().createElement(xe,{size:"s"},E.formatMessage({id:"COMMENT_WIDGET_Configure"}))),g&&c().createElement("div",null,c().createElement(o.JRCIconButton,{iconSize:14,onClick:()=>w(!0),icon:"icon-trash"})))),c().createElement(o.JRCModal,{buttons:[{color:"cancel",clickHandler:()=>w(!1),children:c().createElement(d.FormattedMessage,{id:"GLOBAL_Cancel"})},{color:"danger",clickHandler:I,children:c().createElement(d.FormattedMessage,{id:"GLOBAL_Delete"})}],open:C,closeHandler:()=>w(!1),title:E.formatMessage({id:"GLOBAL_Delete"})},E.formatMessage({id:"COMMENT_WIDGET_Delete_Widget"}))))},Le=({widget:e,commentId:t,width:i,inplace:n=!1,mode:l="view",editRight:o,deleteRight:a,onWidgetUpdate:s,onRemove:d})=>{const{name:u}=e;return(0,r.ensureWidgetArticleButtonType)(e)?c().createElement(U,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetArticleGalleryType)(e)?c().createElement(K,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetArticleAttachmentType)(e)?c().createElement(G,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetArticleImageType)(e)?c().createElement(ne,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetApiType)(e)?c().createElement($,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetArticleSliderType)(e)?c().createElement(se,{widget:e,inplace:n,mode:l,width:null!=i?i:800}):(0,r.ensureWidgetArticleTitleType)(e)?c().createElement(Ee,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetArticleTextType)(e)?c().createElement(ue,{widget:e,inplace:n,mode:l}):(0,r.ensureWidgetDatasourceTableType)(e)?c().createElement(_,Object.assign({},e.content,{uniqid:e.uniqid,mode:l})):(0,r.ensureWidgetCheckListType)(e)?c().createElement(We,{widget:e,commentId:t,inplace:n,mode:l,editRight:null!=o&&o,deleteRight:null!=a&&a,onRemove:d,onWidgetUpdate:s}):c().createElement(c().Fragment,null,"cannot display widget (",u,")")},qe=g().div`
231
+ position: absolute;
232
+ inset: 0;
233
+ opacity: ${e=>e.opacity};
234
+ background-color: ${e=>e.backgroundColor};
235
+ pointer-events: ${e=>e.pointerEvents};
236
+ `,Se=({uniqid:e,mode:t})=>{const i=(0,u.useSelector)((t=>t.widgets.ids[e].widget.layers),u.shallowEqual);return c().createElement(c().Fragment,null,null==i?void 0:i.map(((e,t)=>c().createElement(Ae,{uniqid:e,key:t,mode:"edit"}))))},Ae=({uniqid:e,mode:t})=>{const i=(0,u.useSelector)((t=>t.widgets.layers[e]));return"view"===t?c().createElement(qe,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},i.widgets.map(((e,t)=>c().createElement($e,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):c().createElement(qe,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all"},i.widgets.map(((e,t)=>c().createElement($e,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},$e=({uniqid:e,layerId:t,mode:i})=>{const n=(0,u.useDispatch)(),r=(0,u.useSelector)((t=>t.widgets.ids[e]),u.shallowEqual),a=(0,u.useSelector)((e=>e.widgets.layers[t]));return r&&a&&a.position?"view"===i?c().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},c().createElement(je,{uniqid:e,widget:r,mode:i,inplace:!0})):c().createElement(Te,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{n(l.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},c().createElement(o.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{n(l.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(r.widget.uniqid,r.widget.name)},c().createElement(je,{uniqid:e,widget:r,mode:i,inplace:!0}))):c().createElement(c().Fragment,null)},Te=({position:e,children:t,onMouseUp:i})=>{const[n,l]=c().useState(!1),[o,r]=c().useState({x:0,y:0}),[a,d]=c().useState({x:0,y:0}),[u,m]=c().useState({x:e.x,y:e.y}),g=c().useRef(null),p=(0,s.useCallback)((e=>{l(!0),g.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),f=c().useCallback((e=>{if(n&&g.current){const t=a.x+(e.clientX-o.x),i=a.y+(e.clientY-o.y);m({x:t,y:i})}}),[o.x,o.y,n,a.x,a.y]),E=(0,s.useCallback)((()=>{l(!1),i({x:u.x,y:u.y})}),[u.x,u.y,i]);return c().useEffect((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),c().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},Ie=n.default.registry.getLazyComponent("Loader"),Me=({name:e,uniqid:t,inplace:i})=>{const n=(0,u.useSelector)((e=>l.$L.selectors.selectWidgetState(e,t))),o=l.$L.definition(e);return(null==n?void 0:n.loading)?c().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},c().createElement(Ie,null)):(null==n?void 0:n.hover)?c().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==n?void 0:n.initialized)&&i||(null==n?void 0:n.initialized)||i?c().createElement(c().Fragment,null):c().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},c().createElement("img",{src:o.img}))};var Oe=i(769);g().div`
237
+ height: 0;
238
+ overflow: hidden;
239
+ `,g().div`
240
+ color: ${e=>e.theme.color.grey3};
241
+ font-style: italic;
242
+ `,g().div`
243
+ display: flex;
244
+ flex: 1;
245
+ width: 100%;
246
+ border: 0;
247
+ min-height: ${50}px;
248
+ margin: 0;
249
+ align-items: center;
250
+ border-radius: ${8}px;
251
+ padding: 8px;
252
+ cursor: pointer;
253
+ gap: 10px;
254
+ color: ${e=>e.color?e.color:e.theme.font.color};
255
+ transition: opacity 0.4s;
256
+
257
+ &:hover {
258
+ img {
259
+ filter: grayscale(0);
260
+ opacity: 1;
261
+ }
262
+ }
263
+
264
+ img {
265
+ filter: grayscale(1);
266
+ opacity: 0.4;
267
+ }
268
+ `,g().div`
269
+ position: absolute;
270
+ inset: 0;
271
+ display: flex;
272
+ flex: 1;
273
+ justify-content: center;
274
+ align-items: center;
275
+ min-height: 200px;
276
+ `;const Fe=g().div`
277
+ display: flex;
278
+ `,_e=({uniqid:e,widgetObject:t,commentId:i,widget:n,inplace:o=!0,mode:a,width:d,editRight:m,deleteRight:g,onWidgetUpdate:p,onRemove:f})=>{const E=(0,u.useDispatch)(),y=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),h=(0,u.useSelector)((t=>t.widgets.editableMap[e]),u.shallowEqual),v=(0,u.useSelector)((e=>e.widgets.currentEditableWidgetId),u.shallowEqual),x=(0,u.useSelector)((t=>t.widgets.currentEditableWidgetId===e),u.shallowEqual),{ref:b,isComponentVisible:C,setIsComponentVisible:w}=(0,Oe.I)(!1);if((0,s.useEffect)((()=>{t&&E(l.$L.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,s.useEffect)((()=>{n&&E(l.$L.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,s.useEffect)((()=>{C||e===v&&E(l.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[C]),(0,s.useEffect)((()=>{C!==x&&w(x)}),[x]),void 0===y)return c().createElement(c().Fragment,null,"This widget cannot be displayed");const k=y.widget,W=()=>{"edit"===a?L():(0,r.ensureWidgetArticleButtonType)(k)&&"link"===k.content.openingType&&k.content.openingTypeLink&&window.open(k.content.openingTypeLink.url,k.content.openingTypeLink.target)},L=()=>{if("view"===a)return;const{widget:e}=y;E(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return o&&"view"!==a?c().createElement(Fe,{ref:b,onClick:()=>{w(!0),h&&(E(l.$L.slice.actions.setEditableIndex({index:h.index})),E(l.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},c().createElement(Le,{width:d,widget:y.widget,inplace:o,mode:a,onClick:W,onRemove:f}),c().createElement(Se,{uniqid:e,mode:a}),c().createElement(Me,{name:y.widget.name,uniqid:y.widget.uniqid,inplace:o})):c().createElement(Fe,{onClick:L},c().createElement(Le,{widget:Object.assign(Object.assign({},y.widget),y.title&&{title:y.title}),commentId:i,inplace:o,mode:a,width:d,onClick:W,editRight:m,deleteRight:g,onWidgetUpdate:p,onRemove:f}),c().createElement(Se,{uniqid:e,mode:a}),c().createElement(Me,{name:y.widget.name,uniqid:y.widget.uniqid,inplace:o}))},je=_e;var De,Re=i(533),ze=new Uint8Array(16);function Be(){if(!De&&!(De="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return De(ze)}const Ge=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Je=[],He=0;He<256;++He)Je.push((He+256).toString(16).substr(1));const Ne=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&Ge.test(e)}(i))throw TypeError("Stringified UUID is invalid");return i},Ue=function(e,t,i){var n=(e=e||{}).random||(e.rng||Be)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var l=0;l<16;++l)t[i+l]=n[l];return t}return Ne(n)},Pe=J.react.registry.getLazyComponent("EditorsPortal"),Ve=J.react.registry.getLazyComponent("ThemeProvider"),Qe=()=>{const e=document.getElementById("react-portals"),t=(0,s.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=Ue(),e.appendChild(t)),t})(e)),[e]);return t?(0,Re.createPortal)(c().createElement(Ve,null,c().createElement(Pe,null)),t):null};var Ke=function(e,t,i,n){return new(i||(i=Promise))((function(l,o){function r(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}s((n=n.apply(e,t||[])).next())}))};const Xe=g().div`
279
+ display: flex;
280
+ flex-direction: column;
281
+ gap: 4px;
282
+ flex: 1;
283
+ width: 100%;
284
+ margin-top: 10px;
285
+ `,Ye=({articleId:e,variant:t="inline"})=>{var i;const r=(0,d.useIntl)(),g=(0,m.useTheme)(),p=(0,u.useDispatch)(),[f,E]=(0,s.useState)(),[y,h]=(0,s.useState)(!1),[v,x]=(0,s.useState)([]),[b,C]=(0,s.useState)(!1),w=(0,u.useSelector)(l.EK.selectors.get),k=(0,u.useSelector)(l.$L.selectors.selectWidgets),W=(0,u.useSelector)(l.zh.selectors.selectTinyMCECommonOptions),q=(0,u.useSelector)(l.Hn.selectors.selectAll),S=(0,u.useSelector)(l.t4.selectors.selectPlatformConfig),A=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"OnlyOfficeHook"))),$=(0,u.useSelector)((t=>l.sv.selectors.commentList(t,e))),T=(0,u.useSelector)((e=>l.ew.selectors.selectHook(e,"DriveHook"))),I=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"FileBankHook"))),M=(0,u.useSelector)((e=>l.ew.selectors.selectHook(e,"WidgetHook")));(e=>{const t=(0,u.useDispatch)(),i=(0,s.useMemo)((()=>n.default.socket),[]),o=(0,s.useMemo)((()=>l.sv.getCommentRTHandlers(t,e)),[t,e]);(0,s.useEffect)((()=>(o.forEach((e=>{i.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{i.offMessage(e.namespace,e.function,e.handler)}))})),[o,i])})(e),((e,t)=>{const i=(0,u.useDispatch)(),o=(0,s.useMemo)((()=>n.default.socket),[]),r=(0,s.useMemo)((()=>l.sv.getCommentsLikeRTHandlers(i,e,t)),[i,e,t]);(0,s.useEffect)((()=>(r.forEach((e=>{o.onMessage(e.namespace,e.function,e.handler)})),()=>{r.forEach((e=>{o.offMessage(e.namespace,e.function,e.handler)}))})),[r,o])})(null==$?void 0:$.list.map((e=>e.id)),e);const O=(0,s.useCallback)((e=>{p(l.FN.actions.error({label:null!=e?e:r.formatMessage({id:"GLOBAL_Error"})}))}),[p,r]),F=()=>{p(l.sv.actions.fetchComments({idArticle:e})),_()},_=(0,s.useCallback)((()=>{f||b||(C(!0),a().network.token().then((e=>{E(e.result),C(!1)})).catch((e=>{O(e.errorMsg)})))}),[O,f,b]),j=(0,s.useCallback)((t=>Ke(void 0,void 0,void 0,(function*(){if(f){h(!0);const i=Object.keys(k).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?k[e]:null)).filter((e=>null!==e));try{yield a().article.addComment(Object.assign(Object.assign({},t),{widgets:i,token:f,idArticle:e})).then((()=>{v.forEach((e=>{p(l.$L.slice.actions.flushWidget({uniqid:e.widget.uniqid}))})),x([])})),_()}catch(e){O(e.errorMsg)}finally{h(!1)}}}))),[e,p,_,O,f,k,v]);return(0,s.useEffect)((()=>{_()}),[_]),(0,s.useEffect)((()=>(p(l.sv.actions.fetchComments({idArticle:e})),()=>{p(l.sv.actions.discardComments({idArticle:e}))})),[]),c().createElement(c().Fragment,null,W&&c().createElement(c().Fragment,null,c().createElement(Xe,null,c().createElement(o.JRCCommentsBloc,{loading:y,token:f,comments:null==$?void 0:$.list,onComment:j,onCommentUpdate:t=>Ke(void 0,void 0,void 0,(function*(){var i,n;const o=null==$?void 0:$.list.find((e=>e.id===t.idComment));if(o)return a().article.updateComment({idComment:t.idComment,description:null!==(n=null!==(i=t.description)&&void 0!==i?i:o.description)&&void 0!==n?n:void 0,token:t.token,widgets:t.widgets}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),_()})).catch((e=>{O(e.errorMsg)}))})),onCommentDelete:e=>Ke(void 0,void 0,void 0,(function*(){a().article.deleteComment(e).catch(O)})),isWidgetActive:!!((null==M?void 0:M.isActive)&&(null==M?void 0:M.create)&&(null===(i=null==M?void 0:M.autorize)||void 0===i?void 0:i.includes("comment"))),widgetListComponent:c().createElement(L,{mode:"comment",namespace:"comment",onChange:e=>{x([...v,e]),p(l.$L.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e}))},view:"edit"}),newWidgetsWrapperComponent:c().createElement(c().Fragment,null,v.map((e=>e&&e.widget&&c().createElement("div",{key:e.widget.uniqid},c().createElement(je,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",onRemove:e=>x(v.filter((t=>t.widget.uniqid!==e)))}))))),existingWidgetsWrapperComponent:(t,i,n,o=!0,r,s=!1,d=!1)=>c().createElement(c().Fragment,null,null==i?void 0:i.map((i=>i&&c().createElement("div",{key:i.widget.uniqid},c().createElement(je,{uniqid:i.widget.uniqid,widgetObject:t,commentId:r,widget:i,inplace:o,mode:n,editRight:s,deleteRight:d,onWidgetUpdate:F,onRemove:t=>{a().widget.removeWidget({id:r,type:"comment",uniqid:t}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),_()})).catch((e=>{O(e.errorMsg)}))}}))))),currentUser:w,tinyMCEConfig:{commonOptions:W,mentionsQueries:(0,n.getTinyMCEMentionsQueries)(q,g,O)},onError:O,highlightFields:S.userHighlightFields,userAccountStatus:S.userAccountStatus,userModel:q.find((e=>"user"===e.type)),isWedocActive:!!A,onGetHashError:e=>p(l.FN.actions.error({label:null!=e?e:r.formatMessage({id:"GLOBAL_Error"})})),activeDrives:J.debug.UploadFromDrives?[...I&&T?["fileBank"]:[],...l.ew.utils.buildDrivesArrayFromObject(null==T?void 0:T.drives)]:[],socialActionAdd:({targetId:e,targetType:t,type:i})=>a().socialAction.add({targetType:t,targetId:e,type:i}),deleteFile:e=>Ke(void 0,void 0,void 0,(function*(){f&&(yield a().file.deleteFile(e,"attachment",f))})),fetchUser:e=>a().user.get(e),fetchUserFields:(e,t)=>a().user.getFields(e,t),fetchSocialActionUserList:({targetId:e,targetType:t,type:i})=>a().socialAction.getUsers({targetType:t,targetId:e,type:i}),removeLike:({targetId:e,targetType:t,type:i})=>a().socialAction.remove({targetType:t,targetId:e,type:i}),variant:t}),c().createElement(Qe,null))))},Ze=()=>s.createElement(s.Fragment,null);var et=i(248);const tt=n.default.registry.getLazyComponent("Container"),it=n.default.registry.getLazyComponent("AppColumn"),nt=n.default.registry.getLazyComponent("MainColumn");function lt({extensionRoute:e,routes:t,description:i,mode:n="center"}){var l;const o=(0,d.useIntl)(),{pathname:r}=(0,et.useLocation)(),a=(0,s.useMemo)((()=>Object.values(t)),[t]),[c,u]=s.useState(null===(l=null==a?void 0:a[0])||void 0===l?void 0:l.key),m=a.map((t=>Object.assign(Object.assign({},t),{label:o.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?o.formatMessage({id:t.group}):void 0})));return s.useEffect((()=>{const t=a.find((t=>{var i;return`/ng/rr/${e}/${t.path}`===r||(null===(i=t.paths)||void 0===i?void 0:i.reduce(((t,i)=>{const n=`/ng/rr/${e}/${i}`,l=null!==(0,et.matchPath)(n,r);return t||l}),!1))}));t&&u(t.key)}),[r,a,e]),s.createElement(s.Suspense,{fallback:s.createElement(s.Fragment,null)},s.createElement(tt,{mode:n},s.createElement(it,{mode:n,description:i,tabs:m,activeTab:c||""}),s.createElement(nt,{mode:n},s.createElement(et.Outlet,null))))}g().div`
286
+ margin-bottom: 24px;
287
+ `,g().div`
288
+ margin-bottom: 4px;
289
+ `;const ot=g().div`
290
+ position: absolute;
291
+ background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
292
+ inset: 0;
293
+ pointer-events: ${e=>e.isActive?"all":"none"};
294
+ flex: 1;
295
+ display: flex;
296
+ overflow: hidden;
297
+ `,rt=g().div`
298
+ flex-direction: row;
299
+ display: flex;
300
+ min-height: 60px;
301
+ border-bottom: 1px solid ${e=>e.theme.color.grey2};
302
+ `,at=g().div`
303
+ width: 60px;
304
+ display: flex;
305
+ align-items: center;
306
+ justify-content: center;
307
+ `,st=g().div`
308
+ flex: 1;
309
+ display: flex;
310
+ align-items: center;
311
+ justify-content: center;
312
+ `,ct=g().div`
313
+ position: relative;
314
+ overflow: hidden;
315
+ top: 91px;
316
+ width: ${460}px;
317
+ `,dt=g().div`
318
+ position: absolute;
319
+ top: 0;
320
+ ${e=>"left"===e.position?"left: 0px":""}
321
+ right: ${e=>e.visible?"0":"-1000"}px;
322
+ width: ${440}px;
323
+ bottom: 90px;
324
+ display: flex;
325
+ background-color: ${e=>e.theme.color.white};
326
+ flex-direction: row;
327
+ transition: all 0.4s;
328
+ box-shadow: -4px 0px 20px 0px #00000017;
329
+ `,ut=g().div`
330
+ flex: 1;
331
+ display: flex;
332
+ flex-direction: row;
333
+ padding: 12px;
334
+ overflow: auto;
335
+ margin-bottom: 12px;
336
+ `,mt=g().div`
337
+ width: ${50}px;
338
+ padding-top: 60px;
339
+ display: flex;
340
+ flex-direction: column;
341
+ border-right: 1px solid ${e=>e.theme.color.grey2};
342
+ `,gt=g().button`
343
+ border-radius: 4px;
344
+ cursor: pointer;
345
+ height: 42px;
346
+ margin: 4px;
347
+ width: 42px;
348
+ display: flex;
349
+ align-items: center;
350
+ justify-content: center;
351
+ background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
352
+ &:hover {
353
+ background-color: ${e=>e.theme.color.grey1};
354
+ }
355
+ `,pt=(g().div`
356
+ display: flex;
357
+ border: 1px solid ${e=>e.theme.color.grey1};
358
+ border-radius: ${8}px;
359
+ margin-bottom: 24px;
360
+ input {
361
+ width: 100%;
362
+ border: 0;
363
+ height: ${50}px;
364
+ margin: 0;
365
+ }
366
+ `,g().div`
367
+ display: flex;
368
+ flex-direction: row;
369
+ padding: 12px;
370
+ background-color: ${e=>e.theme.color.grey0};
371
+ border-radius: 8px;
372
+ margin-bottom: 4px;
373
+ `),ft=g().div`
374
+ display: flex;
375
+ flex: 1;
376
+ align-items: center;
377
+ `,Et=g().div`
378
+ width: 40px;
379
+ display: flex;
380
+ justify-content: center;
381
+ align-items: center;
382
+ `,yt=(g().div`
383
+ flex-direction: row;
384
+ display: flex;
385
+ align-items: center;
386
+ `,g().div`
387
+ flex: 1;
388
+ display: flex;
389
+ align-items: center;
390
+ `,({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e)));return i&&i.popup&&i.view?c().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},c().createElement(rt,null,c().createElement(at,null),c().createElement(st,null,"Popup"),c().createElement(at,null,c().createElement(gt,{onClick:()=>{t(l.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},c().createElement(o.JRCIcon,{name:"icon-times",color:"grey2"})))),c().createElement("div",{style:{flex:1,display:"flex"}},i.view),c().createElement(rt,null,c().createElement(o.JRCButton,{onClick:()=>{t(l.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):c().createElement(c().Fragment,null)});const ht=n.default.registry.getLazyComponent("WidgetArticleTitleEditor"),vt=n.default.registry.getLazyComponent("WidgetArticleTextEditor"),xt=n.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),bt=n.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),Ct=n.default.registry.getLazyComponent("WidgetArticleSliderEditor"),wt=n.default.registry.getLazyComponent("WidgetArticleImageEditor"),kt=n.default.registry.getLazyComponent("WidgetButtonEditor"),Wt=n.default.registry.getLazyComponent("WidgetApiEditor"),Lt=n.default.registry.getLazyComponent("WidgetCheckListEditor"),qt=n.default.registry.getLazyComponent("WidgetDatasourceTableEditor"),St=({uniqid:e})=>{var t,i,o,s,m,g,p;const f=(0,d.useIntl)(),E=(0,u.useDispatch)(),y=(0,u.useSelector)(l.$L.selectors.selectToken),h=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),v=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetObject(t,e))),x=t=>{h&&E(l.$L.slice.actions.updateWidget({uniqid:e,content:t})),E(l.Wq.slice.actions.flushEditor({uniqid:e}))},b=(t,i)=>{E(void 0!==i?l.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},t)):l.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},C=t=>{E(l.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))},w=null==h?void 0:h.widget;if(!w)return null;if((0,r.ensureWidgetArticleButtonType)(w))return c().createElement(kt,Object.assign({},w.content,{onChange:t=>{E((0,l.O5)(e,t,!1))},onSave:()=>x({})}));if((0,r.ensureWidgetArticleGalleryType)(w))return c().createElement(xt,{token:y,content:w.content,onChange:t=>E((0,l.O5)(e,t,!1)),onSave:x,onStateChange:b});if((0,r.ensureWidgetArticleAttachmentType)(w))return c().createElement(bt,{token:y,content:w.content,onChange:t=>{E((0,l.O5)(e,t,!1))},onSave:x,onStateChange:b,onOpen:C});if((0,r.ensureWidgetArticleImageType)(w))return c().createElement(wt,{content:w.content,token:y,onChange:t=>{E((0,l.O5)(e,t,!1))},onSave:x,onStateChange:b});if((0,r.ensureWidgetApiType)(w))return c().createElement(Wt,{onChange:t=>E((0,l.O5)(e,t,!1)),provider:e=>{return t=void 0,i=void 0,l=function*(){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>e.result))},new((n=void 0)||(n=Promise))((function(e,o){function r(e){try{s(l.next(e))}catch(e){o(e)}}function a(e){try{s(l.throw(e))}catch(e){o(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(r,a)}s((l=l.apply(t,i||[])).next())}));var t,i,n,l},initialUrl:null!==(t=w.content.url)&&void 0!==t?t:"",order:null!==(i=w.content.order)&&void 0!==i?i:"",orderBy:null!==(o=w.content.orderBy)&&void 0!==o?o:"asc"});if((0,r.ensureWidgetArticleSliderType)(w))return void 0!==y?c().createElement(Ct,{slides:null!==(s=w.content.slides)&&void 0!==s?s:[],loop:null!==(m=w.content.loop)&&void 0!==m&&m,useDots:null===(g=w.content.useDots)||void 0===g||g,onChange:t=>{E((0,l.O5)(e,t,!1))},token:y,onSave:x}):c().createElement(c().Fragment,null,"Token is mandatory");if((0,r.ensureWidgetArticleTitleType)(w))return c().createElement(ht,{onChange:t=>{E((0,l.O5)(e,t,!1))},onSave:x,content:w.content,onOpen:C});if((0,r.ensureWidgetArticleTextType)(w))return c().createElement(vt,{onChange:t=>{E((0,l.O5)(e,t,!1))},onSave:x,content:w.content});if((0,r.ensureWidgetCheckListType)(w))return c().createElement(Lt,{token:y,uniqid:w.uniqid,content:w.content,onChangeContent:(e,t)=>{E((0,l.O5)(e,t,!1))},onChangeWrapper:e=>{E(l.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},onSave:(e,t)=>{var i;void 0!==(i=v)&&void 0!==i.id&&void 0!==i.type?a().widget.updateWidget({id:v.id,uniqid:e,type:v.type,title:h.title,content:t}).then((()=>{x(t)})).catch((e=>{var t;E(l.FN.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:f.formatMessage({id:"GLOBAL_Error"})}))})):x(t)}});if((0,r.ensureWidgetDatasourceTableType)(w)){const t=l.Mx.selectors.selectById(n.default.store.getState(),"StudioHook"),i=l.Mx.selectors.selectById(n.default.store.getState(),"FileBankHook");return c().createElement(qt,Object.assign({},w.content,{uri:w.content.uri,limit:null!==(p=w.content.limit)&&void 0!==p?p:20,editorAppDependencies:{useStudio:!!t,useFileBank:!!i},onSave:x,onChange:(t,i)=>E((0,l.O5)(e,t,null!=i&&i)),onError:e=>{E(l.FN.actions.error({label:e}))}}))}return c().createElement(c().Fragment,null,"cannot display editor")},At=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,d.useIntl)(),n=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetContent(t,e)));return c().createElement("div",{style:{flex:1}},c().createElement($t,{uniqid:e}),n&&n.widgets?n.widgets.map(((r,a)=>{const s=l.$L.definition(r.widget.name);return c().createElement("div",{key:a},c().createElement(pt,null,c().createElement(ft,{onClick:()=>((e,i)=>{t(l.Wq.slice.actions.registerEditor({uniqid:e,name:i}))})(r.widget.uniqid,r.widget.name)},i.formatMessage({id:s.label})),c().createElement(Et,{onClick:()=>{n.widgets&&t(l.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},n),{widgets:[...n.widgets.filter(((e,t)=>t!==a))]})}))}},c().createElement(o.JRCIcon,{name:"icon-trash"}))))})):c().createElement(c().Fragment,null))},$t=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.ids[e].widget.layers),u.shallowEqual);return c().createElement(c().Fragment,null,c().createElement(o.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>c().createElement(Ot,{uniqid:e,key:t}),elms:i||[]}),c().createElement(L,{namespace:"default",onChange:i=>{t(l.$L.slice.actions.registerLayer({uniqid:e,widget:i}))},mode:"button"}))},Tt=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!i.locked}}))}},c().createElement(o.JRCIcon,{name:i.locked?"icon-lock":"icon-unlock"}))},It=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!i.visible}}))}},c().createElement(o.JRCIcon,{name:i.visible?"icon-eye":"icon-eye-slash"}))},Mt=({uniqid:e,layerId:t})=>{const i=(0,u.useDispatch)();return c().createElement("div",{onClick:()=>{i(l.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},c().createElement(o.JRCIcon,{name:"icon-trash"}))},Ot=({uniqid:e})=>{const t=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement(c().Fragment,null,t.title,t.widgets.map(((i,n)=>{const o=l.$L.definition(i.widget.name);return c().createElement("div",{style:{flexDirection:"row",display:"flex"},key:n},c().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),c().createElement(Tt,{uniqid:e}),c().createElement(It,{uniqid:e}),c().createElement(Mt,{uniqid:i.widget.uniqid,layerId:t.uniqid}))})))};var Ft=i(230);const _t=n.default.registry.getLazyComponent("Button"),jt=({uniqid:e})=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),[r,a]=c().useState(null==n?void 0:n.title),{control:s,watch:m}=(0,Ft.useForm)({defaultValues:{text:null!=r?r:""},criteriaMode:"all"});return c().useEffect((()=>{const e=m((e=>{a(e.text)}));return()=>e.unsubscribe()}),[m]),n?c().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}},c().createElement(o.JRCInputText,{name:"text",control:s,placeholder:t.formatMessage({id:"WIDGET_Title"})}),c().createElement(_t,{onClick:()=>{void 0!==r&&(i(l.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:r})),i(l.Wq.slice.actions.flushEditor({uniqid:e})))},minWidth:"100%"},t.formatMessage({id:"GLOBAL_Save"}))):c().createElement(c().Fragment,null,"No wrapper")},Dt=n.default.registry.getLazyComponent("Icon"),Rt=({uniqid:e,position:t})=>{const i=(0,d.useIntl)(),n=(0,u.useDispatch)(),o=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e))),r=l.$L.definition(null==o?void 0:o.name),[a,s]=c().useState(!1),[m,g]=c().useState("default");return c().useEffect((()=>{setTimeout((()=>{s(!0)}),0)})),o?c().createElement(ct,null,c().createElement(dt,{visible:a,position:t},(r.panel.useWrapper||r.panel.useEditor||r.panel.useWidgets)&&c().createElement(mt,null,r.panel.useWrapper?c().createElement(gt,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},c().createElement(Dt,{name:"icon-font",color:"grey2"})):c().createElement(c().Fragment,null),r.panel.useEditor?c().createElement(gt,{isActive:"default"===m,onClick:()=>g("default")},c().createElement(Dt,{name:"icon-pen",color:"grey2"})):c().createElement(c().Fragment,null),r.panel.useWidgets?c().createElement(Bt,{uniqid:e},c().createElement(gt,{isActive:"widgets"===m,onClick:()=>g("widgets")},c().createElement(Dt,{name:"icon-sliders",color:"grey2"}))):c().createElement(c().Fragment,null)),c().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},c().createElement(rt,null,c().createElement(zt,{uniqid:e,position:o.position}),c().createElement(st,null,i.formatMessage({id:r.label})),c().createElement(at,null,c().createElement(gt,{onClick:()=>{n(l.Wq.slice.actions.flushEditor({uniqid:e}))}},c().createElement(Dt,{name:"icon-times",color:"grey2"})))),c().createElement(ut,null,"default"===m&&r.panel.useEditor?c().createElement(St,{uniqid:o.uniqid}):c().createElement(c().Fragment,null),"wrapper"===m&&r.panel.useWrapper?c().createElement(jt,{uniqid:o.uniqid}):c().createElement(c().Fragment,null),"widgets"===m&&r.panel.useWidgets?c().createElement(At,{uniqid:e,namespace:r.name}):c().createElement(c().Fragment,null)))),(null==o?void 0:o.popup)?c().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):c().createElement(c().Fragment,null)):c().createElement(c().Fragment,null)},zt=({uniqid:e,position:t})=>{const i=(0,u.useDispatch)();return c().createElement(at,null,c().createElement(gt,{onClick:()=>{i(l.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},c().createElement(Dt,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Bt=({uniqid:e,children:t})=>{const i=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetState(t,e)));return(null==i?void 0:i.initialized)?t:c().createElement(c().Fragment,null)},Gt=g().div`
391
+ position: absolute;
392
+ inset: 0;
393
+ pointer-events: none;
394
+ z-index: 1;
395
+ `,Jt=g().div`
396
+ flex: 1;
397
+ display: flex;
398
+ margintop: ${90}px;
399
+ pointer-events: ${e=>e.isActive?"all":"none"};
400
+ `,Ht=g().div`
401
+ flex: 1;
402
+ display: flex;
403
+ flex-direction: row;
404
+ pointer-events: none;
405
+ `,Nt=g().div`
406
+ width: ${440}px;
407
+ pointer-events: none;
408
+ `,Ut=()=>{const e=(0,u.useSelector)(l.Wq.selectors.selectEditors);return c().createElement(Gt,null,e.map(((e,t)=>"left"===e.position?c().createElement(ot,{isActive:!1,key:t},c().createElement(Ht,null,c().createElement(Rt,{uniqid:e.uniqid,position:e.position}),c().createElement(Jt,{isActive:void 0!==e.popup},c().createElement(yt,{uniqid:e.uniqid})),c().createElement(Nt,null))):c().createElement(ot,{isActive:!1,key:t},c().createElement(Ht,null,c().createElement(Nt,null),c().createElement(Jt,{isActive:void 0!==e.popup},c().createElement(yt,{uniqid:e.uniqid})),c().createElement(Rt,{uniqid:e.uniqid,position:e.position}))))))},Pt=()=>{const[e,t]=(0,s.useState)(),i=(0,d.useIntl)(),n=(0,s.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}}))}),[]),l=(0,s.useCallback)(((e,t)=>new Promise(((i,l)=>{n({reject:l,resolve:i,text:e,capability:t})}))),[n]),r=(0,s.useMemo)((()=>({develop:e=>l(e,"develop"),summarize:e=>l(e,"summarize"),tldr:e=>l(e,"tldr"),en:e=>l(e,"en"),es:e=>l(e,"es"),formal:e=>l(e,"formal"),funny:e=>l(e,"funny")})),[l]);return[e,(0,s.useMemo)((()=>o.JTinyMCEExtensionsBuilders.jia(r,i)),[i,r])]},Vt=g().div`
409
+ padding: ${e=>e.theme.space.md}px;
410
+ `,Qt={response:void 0,loading:!0,error:void 0},Kt=({query:e})=>{const t=(0,d.useIntl)(),[i,n]=(0,s.useState)(Qt),l=(0,m.useTheme)(),r=(0,s.useCallback)((e=>{n(Qt),a().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void n({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const i=e.result.text;n({error:void 0,loading:!1,response:i})})).catch((e=>{n({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,s.useEffect)((()=>{e&&e.text.trim().length>0&&r(e)}),[e,r]),c().createElement(o.JRCModalLayout,{zIndex:l.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},c().createElement(o.JRCModalContent,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&r(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>i.response&&(null==e?void 0:e.resolve(i.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},c().createElement(Vt,null,i.loading&&c().createElement(c().Fragment,null,c().createElement(o.JRCLoader,null),c().createElement(o.JRCTypography,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!i.loading&&i.error&&c().createElement("p",null,i.error),!i.loading&&i.response&&c().createElement("p",null,i.response))))},Xt=e=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=Pt(),f=(0,s.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),E=(0,s.useMemo)((()=>f?[p]:[]),[p,f]),y=(0,s.useCallback)((e=>{i(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[i,t]),h=(0,s.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),v=(0,s.useMemo)((()=>n.default.tinymceCommonOptions),[]);return c().createElement(c().Fragment,null,v&&c().createElement(o.JRCInputTinyMCE,Object.assign({commonOptions:v,additionalExtensions:E,mentionsQueries:h},e)),c().createElement(Kt,{query:g}))},Yt=e=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=Pt(),f=(0,s.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),E=(0,s.useMemo)((()=>f?[p]:[]),[p,f]),y=(0,s.useCallback)((e=>{i(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[i,t]),h=(0,s.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),v=(0,s.useMemo)((()=>n.default.tinymceCommonOptions),[]);return c().createElement(c().Fragment,null,v&&c().createElement(o.JRCInputTinyMCERaw,Object.assign({commonOptions:v,additionalExtensions:E,mentionsQueries:h},e)),c().createElement(Kt,{query:g}))};var Zt=i(603),ei=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]])}return i};const ti=m.css`
411
+ height: 100%;
412
+ display: flex;
413
+ flex-direction: column;
414
+ justify-content: space-between;
415
+ `,ii=g().div`
416
+ ${({stretch:e})=>e&&ti}
417
+ `,ni=g().form`
418
+ ${({stretch:e})=>e&&ti}
419
+ `,li=s.forwardRef(((e,t)=>e.onSubmit?s.createElement(ni,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):s.createElement(ii,{stretch:e.stretch,ref:t},e.children))),oi=g().div`
420
+ ${e=>e.stretch&&"\n flex: 1;\n"}
421
+ `,ri=s.forwardRef(((e,t)=>{const i=s.useRef(null),[n,l]=(0,Zt.GF)(e.fields,e.type),o=(0,Ft.useForm)({defaultValues:Object.assign(Object.assign({},l),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:a,reset:c}=o,d=ei(o,["handleSubmit","control","reset"]);return s.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:r,control:a,reset:()=>{var e;null===(e=null==i?void 0:i.current)||void 0===e||e.scrollTo(0,0),c()}})),[]),s.createElement(li,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:i},s.createElement(oi,{stretch:e.stretch},n.map((t=>{var{Input:i}=t,n=ei(t,["Input"]);return s.createElement(i,Object.assign({key:n.name,control:a},n,{dataCy:`${e.dataCy}-${n.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(a)),e.buttons)}))}}]);
422
+ //# sourceMappingURL=560.bundle.js.map