jamespot-react-core 1.1.152 → 1.1.154

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([[833],{833:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>sn,CommentsBloc:()=>lt,DisplayForm:()=>hn,EditorsPortal:()=>ln,Empty:()=>ot,JRCInputTinyMCEWithExt:()=>cn,JRCInputTinyMCEWithExtRaw:()=>dn,TwoColLayout:()=>dt,WidgetList:()=>L,WidgetWrapperCore:()=>Ge});var i=n(291),l=n(54),o=n(725),r=n(6),a=n.n(r),s=n(363),c=n.n(s),d=n(181),u=n(855),m=n(754),g=n.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
+ `,b=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
+ `,C=i.default.registry.getLazyComponent("Button"),x=i.default.registry.getLazyComponent("ModalLayout"),w=i.default.registry.getLazyComponent("ModalContent"),W=i.default.registry.getLazyComponent("Tooltip"),k=i.default.registry.getLazyComponent("IconButton"),L=({mode:e,view:t,children:n,namespace:i="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)]}}(i),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(x,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(b,{direction:"row",gap:12},c().createElement("img",{src:e.img}),c().createElement(b,{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&&n?c().createElement("div",{onClick:()=>s(!0)},n):c().createElement(c().Fragment,null),"button"===e&&"edit"===t?c().createElement(C,{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[n,i]=c().useState(!1),l=(0,d.useIntl)();return c().createElement(c().Fragment,null,c().createElement(E,{open:n},c().createElement(h,{onClick:()=>i(!n)},l.formatMessage({id:"WIDGET_Add_Widget"})),c().createElement(y,null,e.map(((e,i)=>c().createElement(v,{key:e.name,open:n,index:i,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(W,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},c().createElement(k,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))},$=g().div`
81
+ flex: 1;
82
+ display: flex;
83
+ flex-direction: row;
84
+ min-height: 60px;
85
+ align-items: center;
86
+ `,T=({widget:e})=>{const{url:t,keys:n,order:i,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($,null,c().createElement(o.JRCWidgetApi,{data:r,keys:null!=n?n:[],order:null!=i?i:"",orderBy:null!=l?l:"asc"}))};var A=n(5);const I=(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},M=i.default.registry.getLazyComponent("WidgetTable"),O=i.default.registry.getLazyComponent("Loader"),_=(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
+ `,D=({uniqid:e,uri:t,limit:n,tableHeadColor:i,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableColumnsData:f=[],tableBorderRadius:E,tableSizedColumns:y,tableSizedColumnsWidth:h,mode:v})=>{const b=(0,d.useIntl)(),C=(0,A.TL)(),[x,w]=(0,s.useState)(!1),[W,k]=(0,s.useState)(!1),[L,q]=(0,s.useState)([]),[S,$]=(0,s.useState)([]),[T,D]=(0,s.useState)({order:"ascending",name:"unknown"}),j=(0,s.useMemo)((()=>l.$L.definition(r.WidgetsName.DatasourceTable)),[]);(0,s.useEffect)((()=>{void 0!==t&&0!==f.length&&0===S.length&&(k(!0),a().datasource.get(t,r.Format.VIEW).then((e=>{$(e.result.model),q(e.result.data),D(e.result.sort)})).finally((()=>k(!1))))}),[t,f,S]),(0,s.useEffect)((()=>{t||$([])}),[t]);const R=(0,s.useCallback)((()=>{C(l.Wq.slice.actions.flushAllEditor()),C(l.Wq.slice.actions.registerEditor({uniqid:e,name:r.WidgetsName.DatasourceTable}))}),[C,e]);(0,s.useEffect)((()=>{"view"!==v&&"preview"!==v||C(l.Wq.slice.actions.flushAllEditor())}),[v,C]),(0,s.useEffect)((()=>{x||t||"edit"!==v||(R(),w(!0))}),[C,e,x,t,R,v]);const z=(0,s.useMemo)((()=>I(f,S)),[f,S]);return 0!==f.length||W||"edit"!==v?W?c().createElement(_,null,c().createElement(O,null)):c().createElement(c().Fragment,null,W||0!==L.length?c().createElement(M,{rows:L,columns:z,limit:n,tableHeadColor:i,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableBorderRadius:E,tableColumnsData:f,tableSizedColumns:y,tableSizedColumnsWidth:h,tableDefaultSortOrder:T.order,tableDefaultSortName:T.name}):c().createElement(_,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:R},c().createElement(o.JRCHtml,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:j.label})}</b>`})):c().createElement(c().Fragment,null)):c().createElement(c().Fragment,null,c().createElement(_,{onClick:R},c().createElement("img",{src:`/img/fast-intranet/${r.WidgetsName.DatasourceTable}.png`,alt:""}),c().createElement(d.FormattedMessage,{id:j.label}),c().createElement(o.JRCButton,{label:"GLOBAL_Settings"})),c().createElement(F,{onClick:R},c().createElement(o.JRCHtml,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:j.label})}</b>`})))},j=g().div`
111
+ width: 0;
112
+ height: 0;
113
+ overflow: hidden;
114
+ `,R=({children:e,initialFiles:t,initialClick:n,multiple:i,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;n&&(null===(e=m.current)||void 0===e||e.click())}),[n]),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;n&&(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:i,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=>i?[...t,e]:[e])))}})))},z=i.default.registry.getLazyComponent("WidgetAttachment"),B=i.default.registry.getLazyComponent("FileViewer"),G=g().div`
115
+ flex: 1;
116
+ `,H=({widget:e,inplace:t,mode:n})=>{const i=(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:i.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:i.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 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((()=>{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(G,null,"view"!==n?c().createElement(z,{files:m,onClick:()=>{},onError:f}):c().createElement(B,{files:m,openWithOptions:h},(e=>c().createElement(z,{files:m,onClick:t=>e(t),onError:f}))),t&&"view"!==n&&c().createElement(R,{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"===n?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)},N=g().div`
117
+ display: flex;
118
+ flex: 1;
119
+ justify-content: center;
120
+ align-items: center;
121
+ `,U=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
+ `,P=({widget:e,mode:t})=>{const n=(0,u.useDispatch)(),{uniqid:i}=e,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E}=e.content;return(0,s.useEffect)((()=>{n(l.$L.slice.actions.setWidgetState({uniqid:i,empty:!r||0===r.length}))}),[r]),c().createElement(N,{onClick:()=>{"edit"===t&&n(l.Wq.slice.actions.registerEditor({uniqid:i,name:e.name}))}},c().createElement(U,{clickable:"edit"!==t},c().createElement(o.JRCWidgetButton,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E})))},V=i.default.registry.getLazyComponent("WidgetArticleGallery"),Q=i.default.registry.getLazyComponent("FileViewer"),K=g().button`
129
+ cursor: pointer;
130
+ `,X=({widget:e,inplace:t,mode:n})=>{var i,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"===n?c().createElement(V,{files:s,maxWidth:800,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(r=e.content.column)&&void 0!==r?r:"3",onClick:()=>{}}):c().createElement(Q,{files:s,openWithOptions:[]},(t=>{var n,i;return c().createElement(K,null,c().createElement(V,{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?c().createElement(R,{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)},Y=i.default.registry.getLazyComponent("WidgetImage"),Z=i.default.registry.getLazyComponent("FileViewer"),ee=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
+ `,te=g().button`
144
+ cursor: pointer;
145
+ `,ne={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}},le=({widget:e,width:t,inplace:n,mode:i})=>{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"===i?void 0!==E?c().createElement(Y,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g}):c().createElement(c().Fragment,null):c().createElement(Z,{files:[Object.assign(Object.assign({},ne),{path:E,mimetype:"image/png"})],openWithOptions:[]},(e=>c().createElement(te,{onClick:()=>e(0)},c().createElement(Y,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g})))),n&&"edit"===i?c().createElement(R,{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(ee,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))},oe=i.default.registry.getLazyComponent("FileViewer"),re=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
+ `,ae={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},se=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},ce=({widget:e,mode:t,width:n})=>{const{uniqid:i}=e,a=(0,A.TL)(),d=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,i)),u.shallowEqual),m=null!=n?n: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({},ae),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:ae.mimetype,path:(0,r.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?se(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?se(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:i,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:i,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(re,{maxWidth:g&&g<m?g:m},c().createElement(oe,{files:E,openWithOptions:[]},(n=>{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&&n(t.file.id)}}else a(l.Wq.slice.actions.registerEditor({uniqid:i,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))},de=i.default.registry.getLazyComponent("WidgetArticleText"),ue=g().div`
153
+ cursor: text;
154
+ p {
155
+ word-wrap: break-word;
156
+ }
157
+ a {
158
+ word-wrap: break-word;
159
+ }
160
+ `,me=({widget:e,mode:t})=>{const{uniqid:n}=e,o=(0,m.useTheme)(),{text:r}=e.content,a=(0,u.useDispatch)(),g=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,n)),u.shallowEqual),p=(0,u.useSelector)((e=>{var t;return null===(t=l.$L.selectors.selectWidgetState(e,n))||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:n,empty:!r||0===r.length}))}),[r]);const b=(0,s.useMemo)((()=>(0,i.getTinyMCEMentionsQueries)(y,o,v)),[y,v,o]);return p?c().createElement(c().Fragment,null):c().createElement(ue,null,c().createElement(de,{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:b}:void 0,mode:t,onChange:e=>{a((0,l.O5)(n,{text:e}))}}))},ge=i.default.registry.getLazyComponent("WidgetArticleTitle"),pe=g().div`
161
+ flex: 1;
162
+ display: flex;
163
+ flex-direction: row;
164
+ align-items: center;
165
+ cursor: text;
166
+ `,fe=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
+ `,Ee=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
+ `,ye=({widget:e,inplace:t,mode:n})=>{const{uniqid:i}=e,{text:o,color:r,heading:a}=e.content,d=(0,u.useDispatch)(),m=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,i)),u.shallowEqual);return(0,s.useEffect)((()=>{d(l.$L.slice.actions.setWidgetState({uniqid:i,empty:!o||0===o.length}))}),[o]),c().createElement(pe,null,c().createElement(ge,{text:o,color:r,heading:a,autoFocus:m,inplace:t,mode:n,onChange:e=>{d((0,l.O5)(i,{text:e}))}}),m&&"edit"===n?c().createElement(he,{heading:a,onClick:e=>{d((0,l.O5)(i,{heading:e}))}}):c().createElement(c().Fragment,null))},he=({heading:e="h1",onClick:t})=>c().createElement(fe,null,["h1","h2","h3","h4"].map(((n,i)=>c().createElement(Ee,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),ve=J.react.registry.getLazyComponent("WidgetCheckList"),be=J.react.registry.getLazyComponent("WidgetCheckListEditor"),Ce=J.react.registry.getLazyComponent("Typography"),xe=(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
+ `),we=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
+ `,Le=({widget:e,commentId:t,inplace:n,mode:i,editRight:m,deleteRight:g,onRemove:p,onWidgetUpdate:f})=>{const E=(0,d.useIntl)(),{uniqid:y,content:h}=e,v=(0,u.useDispatch)(),[b,C]=(0,s.useState)(),[x,w]=(0,s.useState)(!1),[W,k]=(0,s.useState)(),[L,q]=(0,s.useState)(!1),S=(0,u.useSelector)((e=>l.$L.selectors.selectWidget(e,y))),$=(0,u.useSelector)(l.EK.selectors.get),T=(0,s.useCallback)((e=>{v(l.FN.actions.error({label:null!=e?e:E.formatMessage({id:"GLOBAL_Error"})}))}),[v,E]),A=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 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,s.useEffect)((()=>{W||L||(q(!0),a().network.token().then((e=>{k(e.result),q(!1)})).catch((e=>{T(e.errorMsg)})))}),[T,W,L]),"edit"===i&&n?c().createElement(c().Fragment,null,c().createElement(We,null,c().createElement(we,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;A({uniqid:y,title:t})},margin:"2px",width:"100%"})),c().createElement(be,{token:W,uniqid:y,content:h,onChangeContent:(e,t)=>{v((0,l.O5)(e,t))},onChangeWrapper:A,openEditorPanel:M,onRemoveWidget:I})))):c().createElement(c().Fragment,null,b&&c().createElement("div",{key:e.uniqid,style:{width:"100%"}},c().createElement(ve,{title:null==S?void 0:S.title,limit:10,initialEntries:b,onFileClick:()=>{},onItemCheckListChange:(n,i)=>((e,n,i)=>{if(!t)return;const o={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}),$&&e.checked&&{user:{id:null!==(n=null===(t=e.user)||void 0===t?void 0:t.id)&&void 0!==n?n:$.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==$?void 0:$.id,uniqid:e,index:n}).then((()=>{f&&f()})).catch((e=>{T(e.message)}))})(e.uniqid,n,i)}),m&&c().createElement(c().Fragment,null,c().createElement(xe,null,c().createElement("div",{style:{cursor:"pointer"},onClick:()=>{W?M(W):T(E.formatMessage({id:"GLOBAL_Error"}))}},c().createElement(Ce,{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:x,closeHandler:()=>w(!1),title:E.formatMessage({id:"GLOBAL_Delete"})},E.formatMessage({id:"COMMENT_WIDGET_Delete_Widget"}))))},qe=i.default.registry.getLazyComponent("WidgetTable"),Se=i.default.registry.getLazyComponent("Loader"),$e=(g().div``,g().div`
231
+ position: absolute;
232
+ inset: 0;
233
+ display: flex;
234
+ flex-direction: column;
235
+ justify-content: center;
236
+ align-items: center;
237
+ gap: ${e=>e.theme.space.md}px;
238
+ `),Te=g().div`
239
+ position: absolute;
240
+ inset: 0;
241
+ display: flex;
242
+ flex-direction: row;
243
+ justify-content: center;
244
+ align-items: center;
245
+ gap: ${e=>e.theme.space.md}px;
246
+ color: ${e=>e.theme.color.primary};
247
+ cursor: pointer;
248
+ opacity: 0;
249
+ border: 1px solid ${e=>e.theme.color.primary};
250
+ &:hover {
251
+ background-color: ${e=>e.theme.color.grey2};
252
+ opacity: 0.9;
253
+ }
254
+ `,Ae=({uniqid:e,uri:t,limit:n,tableHeadColor:i,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableColumnsData:f=[],tableBorderRadius:E,tableSizedColumns:y,tableSizedColumnsWidth:h,mode:v})=>{const b=(0,d.useIntl)(),C=(0,A.TL)(),[x,w]=(0,s.useState)(!1),[W,k]=(0,s.useState)(!1),[L,q]=(0,s.useState)([]),[S,$]=(0,s.useState)([]),T=(0,s.useMemo)((()=>l.$L.definition(r.WidgetsName.ExcelDatasourceTable)),[]);(0,s.useEffect)((()=>{void 0!==t&&0!==f.length&&0===S.length&&(k(!0),a().datasource.get(t,r.Format.VIEW).then((e=>{$(e.result.model),q(e.result.data)})).finally((()=>k(!1))))}),[t,f,S]),(0,s.useEffect)((()=>{t||$([])}),[t]);const M=(0,s.useCallback)((()=>{C(l.Wq.slice.actions.flushAllEditor()),C(l.Wq.slice.actions.registerEditor({uniqid:e,name:r.WidgetsName.ExcelDatasourceTable}))}),[C,e]);(0,s.useEffect)((()=>{"view"!==v&&"preview"!==v||C(l.Wq.slice.actions.flushAllEditor())}),[v,C]),(0,s.useEffect)((()=>{x||t||"edit"!==v||(M(),w(!0))}),[C,e,x,t,M,v]);const O=(0,s.useMemo)((()=>I(f,S)),[f,S]);return 0!==f.length||W||"edit"!==v?W?c().createElement($e,null,c().createElement(Se,null)):c().createElement(c().Fragment,null,W||0!==L.length?c().createElement(qe,{rows:L,columns:O,limit:n,tableHeadColor:i,tableHeadTextColor:u,tableHeadIconColor:m,tableRowColor:g,tableRowTextColor:p,tableBorderRadius:E,tableColumnsData:f,tableSizedColumns:y,tableSizedColumnsWidth:h}):c().createElement($e,null,c().createElement("img",{src:`/img/fast-intranet/${r.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),c().createElement(d.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===v?c().createElement(Te,{onClick:M},c().createElement(o.JRCHtml,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:T.label})}</b>`})):c().createElement(c().Fragment,null)):c().createElement(c().Fragment,null,c().createElement($e,{onClick:M},c().createElement("img",{src:`/img/fast-intranet/${r.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),c().createElement(d.FormattedMessage,{id:T.label}),c().createElement(o.JRCButton,{label:"GLOBAL_Settings"})),c().createElement(Te,{onClick:M},c().createElement(o.JRCHtml,{__html:`${b.formatMessage({id:"WIDGET_Set_Widget"})} <b>${b.formatMessage({id:T.label})}</b>`})))},Ie=({widget:e,commentId:t,width:n,inplace:i=!1,mode:l="view",editRight:o,deleteRight:a,onWidgetUpdate:s,onRemove:d})=>{const{name:u}=e;return(0,r.ensureWidgetArticleButtonType)(e)?c().createElement(P,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetArticleGalleryType)(e)?c().createElement(X,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetArticleAttachmentType)(e)?c().createElement(H,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetArticleImageType)(e)?c().createElement(le,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetApiType)(e)?c().createElement(T,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetArticleSliderType)(e)?c().createElement(ce,{widget:e,inplace:i,mode:l,width:null!=n?n:800}):(0,r.ensureWidgetArticleTitleType)(e)?c().createElement(ye,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetArticleTextType)(e)?c().createElement(me,{widget:e,inplace:i,mode:l}):(0,r.ensureWidgetExcelDatasourceTableType)(e)?c().createElement(Ae,Object.assign({},e.content,{uniqid:e.uniqid,mode:l})):(0,r.ensureWidgetDatasourceTableType)(e)?c().createElement(D,Object.assign({},e.content,{uniqid:e.uniqid,mode:l})):(0,r.ensureWidgetCheckListType)(e)?c().createElement(Le,{widget:e,commentId:t,inplace:i,mode:l,editRight:null!=o&&o,deleteRight:null!=a&&a,onRemove:d,onWidgetUpdate:s}):c().createElement(c().Fragment,null,"cannot display widget (",u,")")},Me=g().div`
255
+ position: absolute;
256
+ inset: 0;
257
+ opacity: ${e=>e.opacity};
258
+ background-color: ${e=>e.backgroundColor};
259
+ pointer-events: ${e=>e.pointerEvents};
260
+ `,Oe=({uniqid:e,mode:t})=>{const n=(0,u.useSelector)((t=>t.widgets.ids[e].widget.layers),u.shallowEqual);return c().createElement(c().Fragment,null,null==n?void 0:n.map(((e,t)=>c().createElement(_e,{uniqid:e,key:t,mode:"edit"}))))},_e=({uniqid:e,mode:t})=>{const n=(0,u.useSelector)((t=>t.widgets.layers[e]));return"view"===t?c().createElement(Me,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>c().createElement(Fe,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):c().createElement(Me,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>c().createElement(Fe,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Fe=({uniqid:e,layerId:t,mode:n})=>{const i=(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"===n?c().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},c().createElement(Je,{uniqid:e,widget:r,mode:n,inplace:!0})):c().createElement(De,{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=>{i(l.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},c().createElement(o.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{i(l.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(r.widget.uniqid,r.widget.name)},c().createElement(Je,{uniqid:e,widget:r,mode:n,inplace:!0}))):c().createElement(c().Fragment,null)},De=({position:e,children:t,onMouseUp:n})=>{const[i,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(i&&g.current){const t=a.x+(e.clientX-o.x),n=a.y+(e.clientY-o.y);m({x:t,y:n})}}),[o.x,o.y,i,a.x,a.y]),E=(0,s.useCallback)((()=>{l(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);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)},je=i.default.registry.getLazyComponent("Loader"),Re=({name:e,uniqid:t,inplace:n})=>{const i=(0,u.useSelector)((e=>l.$L.selectors.selectWidgetState(e,t))),o=l.$L.definition(e);return(null==i?void 0:i.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(je,null)):(null==i?void 0:i.hover)?c().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?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 ze=n(769);g().div`
261
+ height: 0;
262
+ overflow: hidden;
263
+ `,g().div`
264
+ color: ${e=>e.theme.color.grey3};
265
+ font-style: italic;
266
+ `,g().div`
267
+ display: flex;
268
+ flex: 1;
269
+ width: 100%;
270
+ border: 0;
271
+ min-height: ${50}px;
272
+ margin: 0;
273
+ align-items: center;
274
+ border-radius: ${8}px;
275
+ padding: 8px;
276
+ cursor: pointer;
277
+ gap: 10px;
278
+ color: ${e=>e.color?e.color:e.theme.font.color};
279
+ transition: opacity 0.4s;
280
+
281
+ &:hover {
282
+ img {
283
+ filter: grayscale(0);
284
+ opacity: 1;
285
+ }
286
+ }
287
+
288
+ img {
289
+ filter: grayscale(1);
290
+ opacity: 0.4;
291
+ }
292
+ `,g().div`
293
+ position: absolute;
294
+ inset: 0;
295
+ display: flex;
296
+ flex: 1;
297
+ justify-content: center;
298
+ align-items: center;
299
+ min-height: 200px;
300
+ `;const Be=g().div`
301
+ display: flex;
302
+ `,Ge=({uniqid:e,widgetObject:t,commentId:n,widget:i,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),b=(0,u.useSelector)((t=>t.widgets.currentEditableWidgetId===e),u.shallowEqual),{ref:C,isComponentVisible:x,setIsComponentVisible:w}=(0,ze.I)(!1);if((0,s.useEffect)((()=>{t&&E(l.$L.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,s.useEffect)((()=>{i&&E(l.$L.slice.actions.registerWidget({uniqid:e,widget:i}))}),[]),(0,s.useEffect)((()=>{x||e===v&&E(l.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[x]),(0,s.useEffect)((()=>{x!==b&&w(b)}),[b]),void 0===y)return c().createElement(c().Fragment,null,"This widget cannot be displayed");const W=y.widget,k=()=>{"edit"===a?L():(0,r.ensureWidgetArticleButtonType)(W)&&"link"===W.content.openingType&&W.content.openingTypeLink&&window.open(W.content.openingTypeLink.url,W.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(Be,{ref:C,onClick:()=>{w(!0),h&&(E(l.$L.slice.actions.setEditableIndex({index:h.index})),E(l.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},c().createElement(Ie,{width:d,widget:y.widget,inplace:o,mode:a,onClick:k,onRemove:f}),c().createElement(Oe,{uniqid:e,mode:a}),c().createElement(Re,{name:y.widget.name,uniqid:y.widget.uniqid,inplace:o})):c().createElement(Be,{onClick:L},c().createElement(Ie,{widget:Object.assign(Object.assign({},y.widget),y.title&&{title:y.title}),commentId:n,inplace:o,mode:a,width:d,onClick:k,editRight:m,deleteRight:g,onWidgetUpdate:p,onRemove:f}),c().createElement(Oe,{uniqid:e,mode:a}),c().createElement(Re,{name:y.widget.name,uniqid:y.widget.uniqid,inplace:o}))},Je=Ge;var He,Ne=n(533),Ue=new Uint8Array(16);function Pe(){if(!He&&!(He="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 He(Ue)}const Ve=/^(?:[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 Qe=[],Ke=0;Ke<256;++Ke)Qe.push((Ke+256).toString(16).substr(1));const Xe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Qe[e[t+0]]+Qe[e[t+1]]+Qe[e[t+2]]+Qe[e[t+3]]+"-"+Qe[e[t+4]]+Qe[e[t+5]]+"-"+Qe[e[t+6]]+Qe[e[t+7]]+"-"+Qe[e[t+8]]+Qe[e[t+9]]+"-"+Qe[e[t+10]]+Qe[e[t+11]]+Qe[e[t+12]]+Qe[e[t+13]]+Qe[e[t+14]]+Qe[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&Ve.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},Ye=function(e,t,n){var i=(e=e||{}).random||(e.rng||Pe)();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 Xe(i)},Ze=J.react.registry.getLazyComponent("EditorsPortal"),et=J.react.registry.getLazyComponent("ThemeProvider"),tt=()=>{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=Ye(),e.appendChild(t)),t})(e)),[e]);return t?(0,Ne.createPortal)(c().createElement(et,null,c().createElement(Ze,null)),t):null};var nt=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 it=g().div`
303
+ display: flex;
304
+ flex-direction: column;
305
+ gap: 4px;
306
+ flex: 1;
307
+ width: 100%;
308
+ margin-top: 10px;
309
+ `,lt=({articleId:e,variant:t="inline"})=>{var n;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,b]=(0,s.useState)([]),[C,x]=(0,s.useState)(!1),w=(0,u.useSelector)(l.EK.selectors.get),W=(0,u.useSelector)(l.$L.selectors.selectWidgets),k=(0,u.useSelector)(l.zh.selectors.selectTinyMCECommonOptions),q=(0,u.useSelector)(l.Hn.selectors.selectAll),S=(0,u.useSelector)(l.t4.selectors.selectPlatformConfig),$=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"OnlyOfficeHook"))),T=(0,u.useSelector)((t=>l.sv.selectors.commentList(t,e))),A=(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)(),n=(0,s.useMemo)((()=>i.default.socket),[]),o=(0,s.useMemo)((()=>l.sv.getCommentRTHandlers(t,e)),[t,e]);(0,s.useEffect)((()=>(o.forEach((e=>{n.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{n.offMessage(e.namespace,e.function,e.handler)}))})),[o,n])})(e),((e,t)=>{const n=(0,u.useDispatch)(),o=(0,s.useMemo)((()=>i.default.socket),[]),r=(0,s.useMemo)((()=>l.sv.getCommentsLikeRTHandlers(n,e,t)),[n,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==T?void 0:T.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]),_=()=>{p(l.sv.actions.fetchComments({idArticle:e})),F()},F=(0,s.useCallback)((()=>{f||C||(x(!0),a().network.token().then((e=>{E(e.result),x(!1)})).catch((e=>{O(e.errorMsg)})))}),[O,f,C]),D=(0,s.useCallback)((t=>nt(void 0,void 0,void 0,(function*(){if(f){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 a().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:f,idArticle:e})).then((()=>{v.forEach((e=>{p(l.$L.slice.actions.flushWidget({uniqid:e.widget.uniqid}))})),b([])})),F()}catch(e){O(e.errorMsg)}finally{h(!1)}}}))),[e,p,F,O,f,W,v]);return(0,s.useEffect)((()=>{F()}),[F]),(0,s.useEffect)((()=>(p(l.sv.actions.fetchComments({idArticle:e})),()=>{p(l.sv.actions.discardComments({idArticle:e}))})),[]),c().createElement(c().Fragment,null,k&&c().createElement(c().Fragment,null,c().createElement(it,null,c().createElement(o.JRCCommentsBloc,{loading:y,token:f,comments:null==T?void 0:T.list,onComment:D,onCommentUpdate:t=>nt(void 0,void 0,void 0,(function*(){var n,i;const o=null==T?void 0:T.list.find((e=>e.id===t.idComment));if(o)return a().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:o.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),F()})).catch((e=>{O(e.errorMsg)}))})),onCommentDelete:e=>nt(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===(n=null==M?void 0:M.autorize)||void 0===n?void 0:n.includes("comment"))),widgetListComponent:c().createElement(L,{mode:"comment",namespace:"comment",onChange:e=>{b([...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=>b(v.filter((t=>t.widget.uniqid!==e)))}))))),existingWidgetsWrapperComponent:(t,n,i,o=!0,r,s=!1,d=!1)=>c().createElement(c().Fragment,null,null==n?void 0:n.map((n=>n&&c().createElement("div",{key:n.widget.uniqid},c().createElement(Je,{uniqid:n.widget.uniqid,widgetObject:t,commentId:r,widget:n,inplace:o,mode:i,editRight:s,deleteRight:d,onWidgetUpdate:_,onRemove:t=>{a().widget.removeWidget({id:r,type:"comment",uniqid:t}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),F()})).catch((e=>{O(e.errorMsg)}))}}))))),currentUser:w,tinyMCEConfig:{commonOptions:k,mentionsQueries:(0,i.getTinyMCEMentionsQueries)(q,g,O)},onError:O,highlightFields:S.userHighlightFields,userAccountStatus:S.userAccountStatus,userModel:q.find((e=>"user"===e.type)),isWedocActive:!!$,onGetHashError:e=>p(l.FN.actions.error({label:null!=e?e:r.formatMessage({id:"GLOBAL_Error"})})),activeDrives:J.debug.UploadFromDrives?[...I&&A?["fileBank"]:[],...l.ew.utils.buildDrivesArrayFromObject(null==A?void 0:A.drives)]:[],socialActionAdd:({targetId:e,targetType:t,type:n})=>a().socialAction.add({targetType:t,targetId:e,type:n}),deleteFile:e=>nt(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:n})=>a().socialAction.getUsers({targetType:t,targetId:e,type:n}),removeLike:({targetId:e,targetType:t,type:n})=>a().socialAction.remove({targetType:t,targetId:e,type:n}),variant:t}),c().createElement(tt,null))))},ot=()=>s.createElement(s.Fragment,null);var rt=n(248);const at=i.default.registry.getLazyComponent("Container"),st=i.default.registry.getLazyComponent("AppColumn"),ct=i.default.registry.getLazyComponent("MainColumn");function dt({extensionRoute:e,routes:t,description:n,mode:i="center"}){var l;const o=(0,d.useIntl)(),{pathname:r}=(0,rt.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 n;return`/ng/rr/${e}/${t.path}`===r||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,rt.matchPath)(i,r);return t||l}),!1))}));t&&u(t.key)}),[r,a,e]),s.createElement(s.Suspense,{fallback:s.createElement(s.Fragment,null)},s.createElement(at,{mode:i},s.createElement(st,{mode:i,description:n,tabs:m,activeTab:c||""}),s.createElement(ct,{mode:i},s.createElement(rt.Outlet,null))))}g().div`
310
+ margin-bottom: 24px;
311
+ `,g().div`
312
+ margin-bottom: 4px;
313
+ `;const ut=g().div`
314
+ position: absolute;
315
+ background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
316
+ inset: 0;
317
+ pointer-events: ${e=>e.isActive?"all":"none"};
318
+ flex: 1;
319
+ display: flex;
320
+ overflow: hidden;
321
+ `,mt=g().div`
322
+ flex-direction: row;
323
+ display: flex;
324
+ min-height: 60px;
325
+ border-bottom: 1px solid ${e=>e.theme.color.grey2};
326
+ `,gt=g().div`
327
+ width: 60px;
328
+ display: flex;
329
+ align-items: center;
330
+ justify-content: center;
331
+ `,pt=g().div`
332
+ flex: 1;
333
+ display: flex;
334
+ align-items: center;
335
+ justify-content: center;
336
+ `,ft=g().div`
337
+ position: relative;
338
+ overflow: hidden;
339
+ top: 91px;
340
+ width: ${460}px;
341
+ `,Et=g().div`
342
+ position: absolute;
343
+ top: 0;
344
+ ${e=>"left"===e.position?"left: 0px;":""}
345
+ ${e=>"right"===e.position?"right: -1000px;":""}
346
+ width: ${440}px;
347
+ bottom: 90px;
348
+ display: flex;
349
+ background-color: ${e=>e.theme.color.white};
350
+ flex-direction: row;
351
+ transition: all 0.4s;
352
+ box-shadow: -4px 0px 20px 0px #00000017;
353
+
354
+ &.animate {
355
+ right: 0px;
356
+ }
357
+ `,yt=g().div`
358
+ flex: 1;
359
+ display: flex;
360
+ flex-direction: row;
361
+ padding: 12px;
362
+ overflow: auto;
363
+ margin-bottom: 12px;
364
+ `,ht=g().div`
365
+ position: absolute;
366
+ inset: 0;
367
+ background-color: rgba(255, 255, 255, 0.8);
368
+ display: flex;
369
+ align-items: center;
370
+ justify-content: center;
371
+ `,vt=g().div`
372
+ width: ${50}px;
373
+ padding-top: 60px;
374
+ display: flex;
375
+ flex-direction: column;
376
+ border-right: 1px solid ${e=>e.theme.color.grey2};
377
+ `,bt=g().button`
378
+ border-radius: 4px;
379
+ cursor: pointer;
380
+ height: 42px;
381
+ margin: 4px;
382
+ width: 42px;
383
+ display: flex;
384
+ align-items: center;
385
+ justify-content: center;
386
+ background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
387
+ &:hover {
388
+ background-color: ${e=>e.theme.color.grey1};
389
+ }
390
+ `,Ct=(g().div`
391
+ display: flex;
392
+ border: 1px solid ${e=>e.theme.color.grey1};
393
+ border-radius: ${8}px;
394
+ margin-bottom: 24px;
395
+ input {
396
+ width: 100%;
397
+ border: 0;
398
+ height: ${50}px;
399
+ margin: 0;
400
+ }
401
+ `,g().div`
402
+ display: flex;
403
+ flex-direction: row;
404
+ padding: 12px;
405
+ background-color: ${e=>e.theme.color.grey0};
406
+ border-radius: 8px;
407
+ margin-bottom: 4px;
408
+ `),xt=g().div`
409
+ display: flex;
410
+ flex: 1;
411
+ align-items: center;
412
+ `,wt=g().div`
413
+ width: 40px;
414
+ display: flex;
415
+ justify-content: center;
416
+ align-items: center;
417
+ `,Wt=(g().div`
418
+ flex-direction: row;
419
+ display: flex;
420
+ align-items: center;
421
+ `,g().div`
422
+ flex: 1;
423
+ display: flex;
424
+ align-items: center;
425
+ `,({uniqid:e})=>{const t=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?c().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},c().createElement(mt,null,c().createElement(gt,null),c().createElement(pt,null,"Popup"),c().createElement(gt,null,c().createElement(bt,{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"}},n.view),c().createElement(mt,null,c().createElement(o.JRCButton,{onClick:()=>{t(l.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):c().createElement(c().Fragment,null)});const kt=i.default.registry.getLazyComponent("WidgetArticleTitleEditor"),Lt=i.default.registry.getLazyComponent("WidgetArticleTextEditor"),qt=i.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),St=i.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),$t=i.default.registry.getLazyComponent("WidgetArticleSliderEditor"),Tt=i.default.registry.getLazyComponent("WidgetArticleImageEditor"),At=i.default.registry.getLazyComponent("WidgetButtonEditor"),It=i.default.registry.getLazyComponent("WidgetApiEditor"),Mt=i.default.registry.getLazyComponent("WidgetCheckListEditor"),Ot=i.default.registry.getLazyComponent("WidgetDatasourceTableEditor"),_t=i.default.registry.getLazyComponent("WidgetExcelDatasourceTableEditor"),Ft=({uniqid:e})=>{var t,n,o,s,m,g,p,f;const E=(0,d.useIntl)(),y=(0,u.useDispatch)(),h=(0,u.useSelector)(l.$L.selectors.selectToken),v=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e)),u.shallowEqual),b=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetObject(t,e)),u.shallowEqual),C=t=>{v&&y(l.$L.slice.actions.updateWidget({uniqid:e,content:t})),y(l.Wq.slice.actions.flushEditor({uniqid:e}))},x=(t,n)=>{y(void 0!==n?l.$L.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):l.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},w=t=>{y(l.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))},W=null==v?void 0:v.widget;if(!W)return null;if((0,r.ensureWidgetArticleButtonType)(W))return c().createElement(At,Object.assign({},W.content,{onChange:t=>{y((0,l.O5)(e,t,!1))},onSave:()=>C({})}));if((0,r.ensureWidgetArticleGalleryType)(W))return c().createElement(qt,{token:h,content:W.content,onChange:t=>y((0,l.O5)(e,t,!1)),onSave:C,onStateChange:x});if((0,r.ensureWidgetArticleAttachmentType)(W))return c().createElement(St,{token:h,content:W.content,onChange:t=>{y((0,l.O5)(e,t,!1))},onSave:C,onStateChange:x,onOpen:w});if((0,r.ensureWidgetArticleImageType)(W))return c().createElement(Tt,{content:W.content,token:h,onChange:t=>{y((0,l.O5)(e,t,!1))},onSave:C,onStateChange:x});if((0,r.ensureWidgetApiType)(W))return c().createElement(It,{onChange:t=>y((0,l.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!==(o=W.content.orderBy)&&void 0!==o?o:"asc"});if((0,r.ensureWidgetArticleSliderType)(W))return void 0!==h?c().createElement($t,{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=>{y((0,l.O5)(e,t,!1))},token:h,onSave:C}):c().createElement(c().Fragment,null,"Token is mandatory");if((0,r.ensureWidgetArticleTitleType)(W))return c().createElement(kt,{onChange:t=>{y((0,l.O5)(e,t,!1))},onSave:C,content:W.content,onOpen:w});if((0,r.ensureWidgetArticleTextType)(W))return c().createElement(Lt,{onChange:t=>{y((0,l.O5)(e,t,!1))},onSave:C,content:W.content});if((0,r.ensureWidgetCheckListType)(W))return c().createElement(Mt,{token:h,uniqid:W.uniqid,content:W.content,onChangeContent:(e,t)=>{y((0,l.O5)(e,t,!1))},onChangeWrapper:e=>{y(l.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},onSave:(e,t)=>{var n;void 0!==(n=b)&&void 0!==n.id&&void 0!==n.type?a().widget.updateWidget({id:b.id,uniqid:e,type:b.type,title:v.title,content:t}).then((()=>{C(t)})).catch((e=>{var t;y(l.FN.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:E.formatMessage({id:"GLOBAL_Error"})}))})):C(t)}});if((0,r.ensureWidgetExcelDatasourceTableType)(W))return c().createElement(_t,Object.assign({},W.content,{uri:W.content.uri,limit:null!==(p=W.content.limit)&&void 0!==p?p:20,onSave:C,onChange:(t,n)=>y((0,l.O5)(e,t,null!=n&&n)),onStateChange:x,onError:e=>{y(l.FN.actions.error({label:e}))}}));if((0,r.ensureWidgetDatasourceTableType)(W)){const t=l.Mx.selectors.selectById(i.default.store.getState(),"StudioHook"),n=l.Mx.selectors.selectById(i.default.store.getState(),"FileBankHook");return c().createElement(Ot,Object.assign({},W.content,{uri:W.content.uri,limit:null!==(f=W.content.limit)&&void 0!==f?f:20,editorAppDependencies:{useStudio:!!t,useFileBank:!!n},onSave:C,onChange:(t,n)=>y((0,l.O5)(e,t,null!=n&&n)),onStateChange:x,onError:e=>{y(l.FN.actions.error({label:e}))}}))}return c().createElement(c().Fragment,null,"cannot display editor")},Dt=({uniqid:e})=>{var t;const n=(0,u.useDispatch)(),i=(0,d.useIntl)(),a=null===(t=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,s=(null==a?void 0:a.content)&&"widgets"in a.content&&a.content.widgets?a.content.widgets:[];return c().createElement("div",{style:{flex:1}},c().createElement(jt,{uniqid:e}),a?s.map(((t,d)=>{const u=l.$L.definition(t.widget.name);return c().createElement("div",{key:d},c().createElement(Ct,null,c().createElement(xt,{onClick:()=>((e,t)=>{n(l.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:u.label})),c().createElement(wt,{onClick:()=>{n(l.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},a.content),{widgets:[...s.filter(((e,t)=>t!==d)).map((e=>((0,r.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},c().createElement(o.JRCIcon,{name:"icon-trash"}))))})):c().createElement(c().Fragment,null))},jt=({uniqid:e})=>{const t=(0,u.useDispatch)(),n=(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(Gt,{uniqid:e,key:t}),elms:n||[]}),c().createElement(L,{namespace:"default",onChange:n=>{t(l.$L.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},Rt=({uniqid:e})=>{const t=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},c().createElement(o.JRCIcon,{name:n.locked?"icon-lock":"icon-unlock"}))},zt=({uniqid:e})=>{const t=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},c().createElement(o.JRCIcon,{name:n.visible?"icon-eye":"icon-eye-slash"}))},Bt=({uniqid:e,layerId:t})=>{const n=(0,u.useDispatch)();return c().createElement("div",{onClick:()=>{n(l.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},c().createElement(o.JRCIcon,{name:"icon-trash"}))},Gt=({uniqid:e})=>{const t=(0,u.useSelector)((t=>t.widgets.layers[e]));return c().createElement(c().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=l.$L.definition(n.widget.name);return c().createElement("div",{style:{flexDirection:"row",display:"flex"},key:i},c().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),c().createElement(Rt,{uniqid:e}),c().createElement(zt,{uniqid:e}),c().createElement(Bt,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))};var Jt=n(230);const Ht=i.default.registry.getLazyComponent("Button"),Nt=({uniqid:e})=>{const t=(0,d.useIntl)(),n=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),[r,a]=c().useState(null==i?void 0:i.title),{control:s,watch:m}=(0,Jt.useForm)({defaultValues:{text:null!=r?r:""},criteriaMode:"all"});return c().useEffect((()=>{const e=m((e=>{a(e.text)}));return()=>e.unsubscribe()}),[m]),i?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(Ht,{onClick:()=>{void 0!==r&&(n(l.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:r})),n(l.Wq.slice.actions.flushEditor({uniqid:e})))},minWidth:"100%"},t.formatMessage({id:"GLOBAL_Save"}))):c().createElement(c().Fragment,null,"No wrapper")},Ut=i.default.registry.getLazyComponent("Loader"),Pt=({uniqid:e})=>{var t;const n=null===(t=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetState(t,e))))||void 0===t?void 0:t.busy;return c().createElement(c().Fragment,null,n&&c().createElement(ht,null,c().createElement(Ut,{size:"l"})))},Vt=i.default.registry.getLazyComponent("Icon"),Qt=({uniqid:e,position:t})=>{const n=(0,u.useDispatch)();return c().createElement(gt,null,c().createElement(bt,{onClick:()=>{n(l.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},c().createElement(Vt,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Kt=({uniqid:e,children:t})=>{var n;return(null===(n=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetState(t,e))))||void 0===n?void 0:n.initialized)?t:c().createElement(c().Fragment,null)},Xt=i.default.registry.getLazyComponent("Icon"),Yt=({uniqid:e,position:t})=>{const n=(0,d.useIntl)(),i=(0,u.useDispatch)(),o=(0,s.useRef)(null),r=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e)),u.shallowEqual),a=l.$L.definition(null==r?void 0:r.name),[m,g]=c().useState("default");return(0,s.useEffect)((()=>{setTimeout((()=>{o&&o.current&&(o.current.className=o.current.className+" animate")}),0)}),[]),r?c().createElement(ft,null,c().createElement(Et,{ref:o,position:t},(a.panel.useWrapper||a.panel.useEditor||a.panel.useWidgets)&&c().createElement(vt,null,a.panel.useWrapper?c().createElement(bt,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},c().createElement(Xt,{name:"icon-font",color:"grey2"})):c().createElement(c().Fragment,null),a.panel.useEditor?c().createElement(bt,{isActive:"default"===m,onClick:()=>g("default")},c().createElement(Xt,{name:"icon-pen",color:"grey2"})):c().createElement(c().Fragment,null),a.panel.useWidgets?c().createElement(Kt,{uniqid:e},c().createElement(bt,{isActive:"widgets"===m,onClick:()=>g("widgets")},c().createElement(Xt,{name:"icon-sliders",color:"grey2"}))):c().createElement(c().Fragment,null)),c().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},c().createElement(mt,null,c().createElement(Qt,{uniqid:e,position:r.position}),c().createElement(pt,null,n.formatMessage({id:a.label})),c().createElement(gt,null,c().createElement(bt,{onClick:()=>{i(l.Wq.slice.actions.flushEditor({uniqid:e}))}},c().createElement(Xt,{name:"icon-times",color:"grey2"})))),c().createElement(yt,null,"default"===m&&a.panel.useEditor?c().createElement(Ft,{uniqid:r.uniqid}):c().createElement(c().Fragment,null),"wrapper"===m&&a.panel.useWrapper?c().createElement(Nt,{uniqid:r.uniqid}):c().createElement(c().Fragment,null),"widgets"===m&&a.panel.useWidgets?c().createElement(Dt,{uniqid:e,namespace:a.name}):c().createElement(c().Fragment,null),c().createElement(Pt,{uniqid:e})))),(null==r?void 0:r.popup)?c().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):c().createElement(c().Fragment,null)):c().createElement(c().Fragment,null)},Zt=g().div`
426
+ position: absolute;
427
+ inset: 0;
428
+ pointer-events: none;
429
+ z-index: 1;
430
+ `,en=g().div`
431
+ flex: 1;
432
+ display: flex;
433
+ margintop: ${90}px;
434
+ pointer-events: ${e=>e.isActive?"all":"none"};
435
+ `,tn=g().div`
436
+ flex: 1;
437
+ display: flex;
438
+ flex-direction: row;
439
+ pointer-events: none;
440
+ `,nn=g().div`
441
+ width: ${440}px;
442
+ pointer-events: none;
443
+ `,ln=()=>{const e=(0,u.useSelector)(l.Wq.selectors.selectEditors,u.shallowEqual);return c().createElement(Zt,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?c().createElement(ut,{isActive:!1,key:t},c().createElement(tn,null,c().createElement(Yt,{uniqid:e.uniqid,position:e.position}),c().createElement(en,{isActive:void 0!==e.popup},c().createElement(Wt,{uniqid:e.uniqid})),c().createElement(nn,null))):c().createElement(ut,{isActive:!1,key:t},c().createElement(tn,null,c().createElement(nn,null),c().createElement(en,{isActive:void 0!==e.popup},c().createElement(Wt,{uniqid:e.uniqid})),c().createElement(Yt,{uniqid:e.uniqid,position:e.position}))))))},on=()=>{const[e,t]=(0,s.useState)(),n=(0,d.useIntl)(),i=(0,s.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),l=(0,s.useCallback)(((e,t)=>new Promise(((n,l)=>{i({reject:l,resolve:n,text:e,capability:t})}))),[i]),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,n)),[n,r])]},rn=g().div`
444
+ padding: ${e=>e.theme.space.md}px;
445
+ `,an={response:void 0,loading:!0,error:void 0},sn=({query:e})=>{const t=(0,d.useIntl)(),[n,i]=(0,s.useState)(an),l=(0,m.useTheme)(),r=(0,s.useCallback)((e=>{i(an),a().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void i({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const n=e.result.text;i({error:void 0,loading:!1,response:n})})).catch((e=>{i({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:()=>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},c().createElement(rn,null,n.loading&&c().createElement(c().Fragment,null,c().createElement(o.JRCLoader,null),c().createElement(o.JRCTypography,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!n.loading&&n.error&&c().createElement("p",null,n.error),!n.loading&&n.response&&c().createElement("p",null,n.response))))},cn=e=>{const t=(0,d.useIntl)(),n=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=on(),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=>{n(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),h=(0,s.useMemo)((()=>(0,i.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),v=(0,s.useMemo)((()=>i.default.tinymceCommonOptions),[]);return c().createElement(c().Fragment,null,v&&c().createElement(o.JRCInputTinyMCE,Object.assign({commonOptions:v,additionalExtensions:E,mentionsQueries:h},e)),c().createElement(sn,{query:g}))},dn=e=>{const t=(0,d.useIntl)(),n=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=on(),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=>{n(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),h=(0,s.useMemo)((()=>(0,i.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),v=(0,s.useMemo)((()=>i.default.tinymceCommonOptions),[]);return c().createElement(c().Fragment,null,v&&c().createElement(o.JRCInputTinyMCERaw,Object.assign({commonOptions:v,additionalExtensions:E,mentionsQueries:h},e)),c().createElement(sn,{query:g}))};var un=n(603),mn=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 gn=m.css`
446
+ height: 100%;
447
+ display: flex;
448
+ flex-direction: column;
449
+ justify-content: space-between;
450
+ `,pn=g().div`
451
+ ${({stretch:e})=>e&&gn}
452
+ `,fn=g().form`
453
+ ${({stretch:e})=>e&&gn}
454
+ `,En=s.forwardRef(((e,t)=>e.onSubmit?s.createElement(fn,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):s.createElement(pn,{stretch:e.stretch,ref:t},e.children))),yn=g().div`
455
+ ${e=>e.stretch&&"\n flex: 1;\n"}
456
+ `,hn=s.forwardRef(((e,t)=>{const n=s.useRef(null),[i,l]=(0,un.GF)(e.fields,e.type),o=(0,Jt.useForm)({defaultValues:Object.assign(Object.assign({},l),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:a,reset:c}=o,d=mn(o,["handleSubmit","control","reset"]);return s.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:r,control:a,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),c()}})),[]),s.createElement(En,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:n},s.createElement(yn,{stretch:e.stretch},i.map((t=>{var{Input:n}=t,i=mn(t,["Input"]);return s.createElement(n,Object.assign({key:i.name,control:a},i,{dataCy:`${e.dataCy}-${i.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(a)),e.buttons)}))}}]);
457
+ //# sourceMappingURL=833.bundle.js.map