jamespot-react-core 1.1.154 → 1.1.155

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