/*! For license information please see 98594.c87ce8e151e5ac682403.js.LICENSE.txt */
"use strict";(self.webpackChunkuniweb_builder=self.webpackChunkuniweb_builder||[]).push([[98594,66686],{66686:(e,t,r)=>{r.r(t),r.d(t,{FlexHtml:()=>k,PlainHtml:()=>N,RichHtml:()=>I,SafeHtml:()=>b,SmartHtml:()=>C,withOnReady:()=>A});var n=r(11129),a=r.n(n),o=r(4955),i=r.n(o),l=r(6394);function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i().sanitize(e,t.sanitize);return(0,l.ZP)(r,t.parse)}var s=(0,n.lazy)((function(){return Promise.all([r.e(51177),r.e(22692),r.e(46139)]).then(r.bind(r,84210))}));function u(e){return a().createElement(n.Suspense,{fallback:null},a().createElement(s,e))}var f=["value","as","makeLinksExternal","relAttribute","replaceFn","onReady"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.apply(this,arguments)}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=a().lazy((function(){return Promise.all([r.e(51177),r.e(22692),r.e(46139)]).then(r.bind(r,84210))}));function b(e){var t=e.value,r=e.as,o=void 0===r?"div":r,c=e.makeLinksExternal,s=void 0===c?"auto":c,u=e.relAttribute,d=void 0===u?"noopener noreferrer":u,h=e.replaceFn,b=void 0===h?null:h,g=e.onReady,y=void 0===g?null:g,w=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,f),x=(0,n.useRef)(null);if((0,n.useEffect)((function(){y&&x.current&&y(x.current)}),[x.current,y]),null==t)return null;Array.isArray(t)&&(t=t.map((function(e){return'<p style="color:inherit">'.concat(e,"</p>")})).join(""));var E=i().sanitize(t,{CUSTOM_ELEMENT_HANDLING:{tagNameCheck:/^u-/,attributeNameCheck:/^.*/,allowCustomizedBuiltInElements:!0}}),O={replace:function(e){if(e.attribs&&"a"===e.name){var t,r=(0,l.e_)(e.attribs),n=e.attribs.href;t="auto"===s?n&&function(e){var t=document.createElement("a");t.href=e;var r=t.hostname!==window.location.hostname;return t.remove(),r}(n)?"_blank":"_self":s?"_blank":"_self",r.target=t;var o=m(m({rel:d},r),{},{target:t});return r.download&&(o.onClick=function(e){return e.preventDefault(),uniweb.downloadFile(n),!1}),a().createElement("a",o,(0,l.du)(e.children,O))}if("u-cite"===e.name){var i=(0,l.e_)(e.attribs),c=e.children.map((function(e){return e.data||""})).join("");return a().createElement(a().Suspense,{fallback:null},a().createElement(v,p({},i,{data:c?JSON.parse(c):""})))}if(b)return b(e,l.e_,l.du)}},j=(0,l.ZP)(E,O);return a().createElement(o,p({ref:x},w),j)}var g=["makeLinksExternal","externalLinkProps","replaceFn"],y=["html","customElements"],w=["onReady"];function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},x.apply(this,arguments)}function E(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e){var t=e.html,r=e.sanitizeOptions,o=e.parseOptions,i=(0,n.useMemo)((function(){return c(t,{sanitize:r,parse:o})}),[t,r,o]);return a().createElement(a().Fragment,null,i)}function k(e){var t=e.html,r=e.sanitizeOptions,o=e.parseOptions,i=e.customElements,l=void 0===i?{}:i,s=e.replaceFn,u=(0,n.useMemo)((function(){var e=j(j({},o),{},{replace:function(e){var t;if(s){var r=s(e);if(void 0!==r)return r}return"tag"===e.type&&l[e.name]?l[e.name](e):null==o||null===(t=o.replace)||void 0===t?void 0:t.call(o,e)}});return c(t,{sanitize:j(j({},r),{},{CUSTOM_ELEMENT_HANDLING:{tagNameCheck:new RegExp("^(".concat(Object.keys(l).join("|"),")$")),attributeNameCheck:/.*/,allowCustomizedBuiltInElements:!0}}),parse:e})}),[t,r,o,l,s]);return a().createElement(a().Fragment,null,u)}function P(e){return function(t){var r=t.makeLinksExternal,n=void 0===r?"auto":r,o=t.externalLinkProps,i=void 0===o?{target:"_blank",rel:"noopener noreferrer"}:o,l=t.replaceFn,c=E(t,g);return a().createElement(e,x({},c,{replaceFn:function(e){if(l){var t=l(e);if(void 0!==t)return t}if("tag"===e.type&&"a"===e.name){var r=e.attribs.href,o=!1,c=!1;if("auto"===n){var s=function(e){if(!e)return!1;if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return!1;if(e.startsWith("#"))return!1;if(e.startsWith("//"))return"possibly-external";try{var t=new URL(e,window.location.origin);return t.protocol!==window.location.protocol&&"https:"!==t.protocol||t.hostname!==window.location.hostname}catch(e){return"possibly-external"}}(r);c=o=!0===s||"possibly-external"===s}else o=n,c=n;if(o||c){var u=c?i:{};return a().createElement("a",j(j(j({},e.attribs),o?{target:"_blank"}:{}),u),e.children.map((function(e){return"text"===e.type?e.data:a().createElement(e.name,e.attribs)})))}}}}))}}var C=P(N),I=P((function(e){var t=e.html,r=e.customElements,n=void 0===r?{}:r,o=E(e,y);return a().createElement(k,x({html:t,customElements:j({"u-cite":function(e){var t=e.attribs,r=e.children.map((function(e){return"text"===e.type?e.data:""})).join("");return a().createElement(u,x({},t,{data:r?JSON.parse(r):""}))}},n)},o))}));function A(e){return a().forwardRef((function(t,r){var o=t.onReady,i=E(t,w),l=(0,n.useRef)(null),c=r||l;return(0,n.useEffect)((function(){o&&c.current&&o(c.current)}),[o,c]),a().createElement(e,x({ref:c},i))}))}},55283:(e,t,r)=>{r.d(t,{Z:()=>$e});var n,a=r(11129),o=r.n(a),i=r(74644),l=r(93621),c=r(8053),s=r(88834),u=r(67900);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t,r,a=e.cards,i=e.histograms,l=e.filters,c=e.setFilters,f=e.extraMarkup;return o().createElement("div",{className:(0,u.tw)(n||(t=["w-full flex items-center gap-x-1 sm:gap-x-2 md:gap-x-3"],r||(r=t.slice(0)),n=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))))},o().createElement(s.Z,{cards:a,histograms:i,handleSelect:function(e,t){var r=p({},l);t?r[e]=t:delete r[e],c(r)},handleSearch:function(e){c(p(p({},l),{},{searchText:e}))},filters:l}),f)}var h=r(91341),v=r(17710),b=r(68713);function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||x(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||x(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var O=function(e,t,r){var n=w(e),a=function e(n){n.contentId===t?n.open=r:n.subCards.length&&n.subCards.forEach((function(t){e(t)}))};return n.forEach((function(e){a(e)})),n},j=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.length&&t.forEach((function(t){var r=t.open,n=t.subCards;r&&(t.open=!1),e(n)}))},S=function(e,t,r){var n={},a=function(e,n){var a={};return n&&Object.entries(n).forEach((function(n){var o,i=y(n,2),l=i[0],c=i[1];"root"===l&&null!==(o=r.histogram[t])&&void 0!==o&&o["".concat(e,"_root")]?a[r.histogram[t]["".concat(e,"_root")]]=c:a[l]=c})),a};return e&&Object.entries(e).forEach((function(e){var o,i=y(e,2),l=i[0],c=i[1];null!==(o=r.histogram[t])&&void 0!==o&&o[l]?n[r.histogram[t][l]]=a(l,c):n[l]=a(l,c)})),n},N=r(71578),k=r(61988),P={namespace:"Topics",keys:["selection","collapseAll","histogram","createProfile"],loader:{en:function(){return r.e(87563).then(r.t.bind(r,87563,19))},fr:function(){return r.e(64642).then(r.t.bind(r,64642,19))}},dictionary:{en:{selection:"Selection",collapseAll:"Collapse all",histogram:{"topic/profile":{parent_topic:"Parent topic",visibility:"Visibility",parent_topic_root:"No parent topic"},"groups/profile":{type:"Group type",visibility:"Visibility"}},createProfile:"Create {{profile}}"},fr:{selection:"Sélection",collapseAll:"Réduire tout",histogram:{"topic/profile":{parent_topic:"Sujet parent",visibility:"Visibilité",parent_topic_root:"Pas de sujet parent"},"groups/profile":{type:"Type de groupe",visibility:"Visibilité"}},createProfile:"Créer {{profile}}"}}};(0,k.ak)(P);var C,I,A,T,z,L,_,F,M,D,H,Z,G,U,R,W,B,$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(0,k.FC)(P,e)},V=r(54354);function J(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Y(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function K(e){var t=e.cards,r=e.setCards,n=e.filters,a=e.histograms,i=e.selections,l=e.setSelections,s=e.profileType,f=void 0===s?{}:s,p=e.profileExtendable,d=void 0!==p&&p,m=e.openCreationModal,g=e.specialTitle;(0,b.b5)(t);var y=!!f.hierarchicalField,w=g||(0,c.NC)(f.label_plural)||"",x=$().collapseAll,E=n&&Object.values(n).filter((function(e){return e})).length;return o().createElement(o().Fragment,null,o().createElement("div",{className:(0,u.tw)(U||(U=J(["flex items-center justify-start space-x-2 sm:(justify-between)"])))},o().createElement("p",{className:(0,u.tw)(R||(R=J(["text-base font-semibold"])))},w),y?o().createElement(N.An5,{className:(0,u.tw)(W||(W=J(["w-5 h-5 cursor-pointer ",""])),E?"cursor-not-allowed text-gray-300":"cursor-pointer"),title:x,onClick:function(){if(!E){var e=Y(t);j(e),r(e)}}}):null),o().createElement("div",{className:(0,u.tw)(B||(B=J(["border border-gray-300 !shadow rounded-md px-1 py-1.5 mt-1 w-full"])))},o().createElement(h.tX,{cards:t,filters:n,histograms:a,hierarchical:y,ItemMarkup:function e(n){var a=n.item,s=n.rowHeight,f=a.title,p=a.contentId,h=a.subCards,b=a.open,g=a.itemPath,w=!y||E?0:g?g.split("/").length-1:0,x=!(null==i||!i.find((function(e){return e.contentId===p}))),j=function(){var e=Y(i);if(x){var t=e.findIndex((function(e){return e.contentId===p}));e.splice(t,1)}else e.push(a);l(e)},S=g?g.split("/"):[],N=S.length>1?S.slice(0,-1).join(" / "):"",k=N?"".concat(N," / ").concat(f):f;return o().createElement(o().Fragment,null,o().createElement("div",{className:(0,u.tw)(C||(C=J(["flex items-center justify-between pr-1 hover:bg-gray-100 bg-opacity-50 group ",""])),null!=h&&h.length?"":"cursor-pointer"),style:{height:s,paddingLeft:5+(y?20*w:0)},onClick:function(){if(null!=h&&h.length){var e=O(t,p,!b);r(e)}else j()}},o().createElement("div",{className:(0,u.tw)(I||(I=J(["flex items-center space-x-2 overflow-hidden"])))},o().createElement("input",{type:"checkbox",className:(0,u.tw)(A||(A=J(["w-3.5 h-3.5 flex-shrink-0"]))),checked:x,onChange:j,onClick:function(e){e.stopPropagation()}}),o().createElement("p",{className:(0,u.tw)(T||(T=J(["truncate"])))},f),null!=h&&h.length?o().createElement("span",{className:(0,u.tw)(z||(z=J(["invisible group-hover:visible inline-flex max-w-full items-center px-1.5 py-0.5 rounded-sm text-xs font-medium bg-gray-200 text-gray-500"])))},h.length):o().createElement(v.frK,{className:(0,u.tw)(L||(L=J(["flex-shrink-0 text-gray-500 w-5 h-5 cursor-pointer invisible group-hover:visible"]))),"data-tooltip-content":k,"data-delay-show":400,"data-tooltip-id":"topic-tips"}),d?o().createElement("div",{className:(0,u.tw)(_||(_=J(["rounded-full bg-transparent hover:bg-gray-50 cursor-pointer group-hover:visible invisible hover:text-gray-900 text-gray-500 flex items-center"]))),onClick:function(e){e.stopPropagation(),m(p)}},o().createElement(v.b9W,{className:(0,u.tw)(F||(F=J(["h-[14px] w-[14px]"])))}),o().createElement("span",{className:(0,u.tw)(M||(M=J(["text-xs ml-px mt-px"])))},(0,c.NC)({en:"Add",fr:"Ajouter"}))):null),o().createElement("div",{className:(0,u.tw)(D||(D=J(["flex items-center space-x-1.5 flex-shrink-0"])))},o().createElement("div",{className:(0,u.tw)(H||(H=J(["h-4 w-4 ",""])),null!=h&&h.length?"visible":"invisible")},b?o().createElement(v.lVW,{className:(0,u.tw)(Z||(Z=J(["w-full h-full"])))}):o().createElement(v.kzR,{className:(0,u.tw)(G||(G=J(["w-full h-full"])))})))),b&&null!=h&&h.length?h.map((function(t,r){return o().createElement(e,{key:r,item:t,rowHeight:s})})):null)},listMaxHeight:250,listMinHeight:100,itemHeight:30})),o().createElement(V.u,{place:"bottom",offset:5,id:"topic-tips"}))}var Q,X,ee,te,re,ne,ae,oe,ie,le,ce=r(37585);function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ue(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function fe(e){var t=e.selections,r=e.setSelections,n=e.hasOrder,a=$().selection;return o().createElement(o().Fragment,null,o().createElement("div",{className:(0,u.tw)(ae||(ae=ue(["flex space-x-2 items-center"])))},o().createElement("p",{className:(0,u.tw)(oe||(oe=ue(["text-base font-semibold"])))},a),o().createElement("span",{className:(0,u.tw)(ie||(ie=ue(["inline-flex max-w-full items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-200 text-blue-800"])))},t.length)),o().createElement("div",{className:(0,u.tw)(le||(le=ue(["border border-gray-300 !shadow rounded-md px-2.5 py-2 mt-1 w-full "," "])),t.length?"bg-white":"bg-gray-50 cursor-not-allowed")},o().createElement(h.YZ,{cards:t,ItemMarkup:function(e){var n=e.item,a=e.isDragging,i=n.title,l=n.contentId,c=n.itemPath,s=c?c.split("/"):[];return o().createElement("div",{className:(0,u.tw)(Q||(Q=ue(["flex items-center border-2 rounded-md h-full !shadow-sm px-2 group ",""])),a?"bg-white !shadow-lg":"bg-gray-100 hover:bg-gray-200")},o().createElement("div",{className:(0,u.tw)(X||(X=ue(["overflow-hidden"])))},s.length>1?o().createElement("p",{className:(0,u.tw)(ee||(ee=ue(["truncate text-gray-500 group-hover:text-gray-600"]))),style:{fontSize:"0.8rem",lineHeight:"1.15rem"},title:s},s.slice(0,-1).join(" / ")):null,o().createElement("p",{className:(0,u.tw)(te||(te=ue(["truncate text-gray-700 group-hover:text-gray-900"]))),style:{fontSize:"1rem",lineHeight:"1.25rem"},title:i},i)),o().createElement("div",{className:(0,u.tw)(re||(re=ue(["rounded-full bg-transparent hover:bg-gray-50 cursor-pointer flex-shrink-0 ml-auto"]))),style:{width:"18px",height:"18px"},onClick:function(){var e,n=function(e){if(Array.isArray(e))return se(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?se(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=n.findIndex((function(e){return e.contentId===l}));n.splice(a,1),r(n)}},o().createElement(ce.eSQ,{className:(0,u.tw)(ne||(ne=ue(["w-full h-full hover:text-gray-900 text-gray-500"])))})))},listMaxHeight:246,listMinHeight:100,variableItemsHeight:!0,itemsHeight:t.map((function(e){var t,r;return(null===(t=e.itemPath)||void 0===t||null===(r=t.split("/"))||void 0===r?void 0:r.length)>1?55:40})),onReorder:function(e){r(e)},orderable:n})))}var pe,de,me,he,ve,be,ge,ye,we,xe,Ee,Oe,je,Se,Ne,ke,Pe,Ce,Ie,Ae=r(84226);function Te(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ze(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,u.tw)(pe||(pe=Te(["",""])),t.filter(Boolean).join(" "))}function Le(e){var t=e.enabled,r=e.setEnabled,n=e.label,a=void 0===n?"Multiselect":n,i=e.reverse,l=void 0!==i&&i;return o().createElement(Ae.r.Group,{as:"div",className:(0,u.tw)(de||(de=Te(["flex items-center justify-end space-x-3 ",""])),l?"flex-row-reverse space-x-reverse":"")},o().createElement(Ae.r.Label,{as:"span",className:(0,u.tw)(me||(me=Te(["cursor-pointer"])))},o().createElement("span",{className:(0,u.tw)(he||(he=Te(["font-medium text-gray-900"])))},a)),o().createElement(Ae.r,{checked:t,onChange:r,className:ze(t?"bg-green-600":"bg-gray-200","relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2")},o().createElement("span",{className:(0,u.tw)(ve||(ve=Te(["sr-only"])))},"Use setting"),o().createElement("span",{className:ze(t?"translate-x-5":"translate-x-0","pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")},o().createElement("span",{className:ze(t?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},o().createElement("svg",{className:(0,u.tw)(be||(be=Te(["h-3 w-3 text-gray-400"]))),fill:"none",viewBox:"0 0 12 12"},o().createElement("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}))),o().createElement("span",{className:ze(t?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},o().createElement("svg",{className:(0,u.tw)(ge||(ge=Te(["h-3 w-3 text-green-600"]))),fill:"currentColor",viewBox:"0 0 12 12"},o().createElement("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"}))))))}function _e(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Fe(e){var t=e.tab,r=e.setTab,n=e.selections,a=e.profileLabel,i=[{label:void 0===a?"":a,type:"list"},{label:$().selection,type:"selection"}];return o().createElement("div",{className:(0,u.tw)(ye||(ye=_e(["flex space-x-2.5 font-medium text-base"])))},i.map((function(e,a){var i=t===e.type;return o().createElement("div",{key:a,className:(0,u.tw)(we||(we=_e(["px-2 py-2 border-b-2 space-x-1.5 flex items-center cursor-pointer group ",""])),i?"border-blue-600":"border-transparent"),onClick:function(){i||r(e.type)}},o().createElement("p",{className:(0,u.tw)(xe||(xe=_e(["",""])),i?"text-blue-600":"text-gray-600 group-hover:text-blue-500")},e.label),"selection"===t||i?null:o().createElement("div",{className:(0,u.tw)(Ee||(Ee=_e(["flex items-center justify-center w-6 h-6 rounded-md text-sm font-medium ",""])),"bg-gray-100 text-gray-600 group-hover:(bg-blue-50 text-blue-500)")},o().createElement("p",null,n.length)))})))}function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Me.apply(this,arguments)}function De(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function He(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?He(Object(r),!0).forEach((function(t){Ge(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||Re(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Re(e,t){if(e){if("string"==typeof e)return We(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?We(e,t):void 0}}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Be(e){var t=e.open,r=e.setOpen,n=e.selections,s=e.contentType,f=e.cards,p=void 0===f?[]:f,d=e.viewType,h=void 0===d?"profile":d,v=e.hasOrder,x=void 0===v||v,E=e.saveCallback,O=e.cardsArgs,j=void 0===O?{}:O,N=(null==j?void 0:j.label)||"",k=Ue((0,a.useState)(!1),2),P=k[0],C=k[1],I=Ue((0,a.useState)({}),2),A=I[0],T=I[1],z=Ue((0,a.useState)({}),2),L=z[0],_=z[1],F=Ue((0,a.useState)([]),2),M=F[0],D=F[1],H=Ue((0,a.useState)([]),2),Z=H[0],G=H[1],U=Ue((0,a.useState)("list"),2),R=U[0],W=U[1],B=Ue((0,a.useState)(!1),2),V=B[0],J=B[1],Y=Ue((0,a.useState)({}),2),q=Y[0],Q=Y[1],X=$(),ee=Ue((0,a.useState)({}),2),te=ee[0],re=ee[1],ne="topic/profile",ae=Ue(ne.split("/"),2),oe=ae[0],ie=ae[1],le=(0,c.pe)(oe,ie),ce=le.hierarchicalField;(0,a.useEffect)((function(){C(!1),D([]),G([]),(0,b.VI)(s,h,"topics","topic").then((function(e){var t=e.cards,r=e.hierarchicalCards,n=e.filters,a=e.sectionId,o=e.fieldId,i=t;r.length&&(i=r),n=S(n,ne,X);var l=function(e,t){var r=[];return null!=e&&e.length&&null!=t&&t.length&&e.forEach((function(e){var n=e.contentId,a=(0,b._7)(t,n);a&&r.push(a)})),r}(p,i);re({sectionId:a,fieldId:o}),"topic"===oe&&"members"!==s?(0,c.j0)("profiles.php",{action:"getLinkedProfiles",contentIds:[uniweb.activeUserId()],tgtSection:"topics",tgtField:"topic"}).then((function(e){var t,r=((null===(t=e.data)||void 0===t?void 0:t[uniweb.activeUserId()])||[]).map((function(e){return e[0]}));n=Ze({"Filter by Group":Ge({},"Current interests",r)},n),_(n),T(Ge({},"Filter by Group","Current interests")),D(i),G(l),C(!0)})):(_(n),T({}),D(i),G(l),C(!0))}))}),[s,h,oe]);var se=!(null==le||!le.extendable),ue="Current interests"!==(null==A?void 0:A["Filter by Group"]),pe=o().createElement(o().Fragment,null,o().createElement(m,{cards:M,histograms:L,filters:A,setFilters:T,extraMarkup:"topic"===oe&&"members"!==s&&o().createElement(Le,{reverse:!1,label:(0,c.NC)({en:"Show all topics",fr:"Afficher tous les sujets"}),enabled:ue,setEnabled:function(){var e=Ze({},A);null!=A&&A["Filter by Group"]?delete e["Filter by Group"]:e=Ze({"Filter by Group":"Current interests"},e),T(e)}})})),de="topic"===oe&&"members"!==s?ue?(0,c.NC)({en:"Full Topic Hierarchy",fr:"Hiérarchie complète des sujets"}):(0,c.NC)({en:"Current interests",fr:"Intérêts actuels"}):"",me=o().createElement(K,{specialTitle:de,cards:M,setCards:D,filters:A,histograms:L,selections:Z,setSelections:G,profileType:le,profileExtendable:!!ue&&se,openCreationModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";ce&&e&&Q(Ge({},ce,e)),J(!0)}}),he=o().createElement(fe,{selections:Z,setSelections:G,hasOrder:x}),ve=(0,c.NC)({en:"Create new topic",fr:"Créer un nouveau sujet"}),be=(ue&&se&&P&&(0,u.tw)(Oe||(Oe=De(["rounded bg-white px-4 py-2 h-[38px] text-sm font-medium text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"]))),o().createElement(l.Z,{contentType:oe,saveCallback:function(e){J(!1),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"profiles",r=arguments.length>2?arguments[2]:void 0;return(0,b.qI)(e,t,{contentId:r})}(oe,ie,e).then((function(e){var t,r=e.cards,n=e.filters,a=function(e){if(Array.isArray(e))return We(e)}(t=M)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Re(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();!function(e,t,r){if(r){e.open=!1,e.subCards=[];var n=e.head,a=n[r];if(a){var o=a[0],i=(0,b._7)(t,o);i&&(e.itemPath="".concat(i.itemPath,"/").concat(n.title),i.subCards.push(e))}else e.itemPath=n.title,t.push(e)}else t.push(e)}(r[0],a,ce),D(a);var o=Ze({},L);(function(e,t){Object.entries(t).forEach((function(t){var r=y(t,2),n=r[0],a=r[1];n in e?Object.entries(a).forEach((function(t){var r=y(t,2),a=r[0],o=r[1],i=e[n];i[a]=a in i?w(new Set([].concat(w(i[a]),w(o)))):o})):e[n]=a}))})(o,n=S(n,ne,X)),_(o)}))},ajaxConfig:{url:"profiles.php",action:"create",contentType:oe},info:{modalTitle:ve},open:V,setOpen:J,preselectInfo:q})),ge={open:t,setOpen:r,hideTrigger:!0,title:N||(0,c.NC)({en:"Add topics to ".concat(n.length," selected profiles"),fr:"Ajouter des sujets à ".concat(n.length," profils sélectionnés")}),size:"2xl",closeOnClickOutside:!1,handleSave:function(){var e=function(e,t,r){var n=[],a=[],o=[],i=function(e,t){return t.find((function(t){return t.contentId==e}))};return e.length||null!=t&&t.length?(!e.length&&null!=t&&t.length?n.push.apply(n,w(t)):!e.length||null!=t&&t.length?(e.forEach((function(e,n){var l=e.contentId,c=i(l,t);if(c){if(r){var s=n+1;c.order!=s&&(e.order=s,e.itemId=c.itemId,o.push(e))}}else e.order=n+1,a.push(e)})),t.forEach((function(t){var r=t.contentId;i(r,e)||n.push(t)}))):a.push.apply(a,w(e)),n.length||a.length||o.length?{insert:a,delete:n,update:o}:null):null}(Z,p,x);return!e||function(e,t,r,n,a,o,i,l){var s=e.insert,u=e.delete,f=e.update,p={action:"bulkUpdateSectionItems",contentType:t,contentIds:r,viewType:n,sectionId:a};if(u.length&&(p.delete=JSON.stringify(u.map((function(e){return{itemId:e.itemId}})))),s.length||f.length){var d=o;d&&(s.length&&(p.insert=JSON.stringify(s.map((function(e){return{data:g({},d,e.contentId),itemId:e.itemId}})))),f.length&&(p.update=JSON.stringify(f.map((function(e){return{data:g({},d,e.contentId),itemId:e.itemId}})))))}return(0,c.j0)("profiles.php",p)}(e,s,n,h,te.sectionId,te.fieldId).then((function(e){return r(!1),E&&E(),!0})).catch((function(e){r(!1)}))},handleCancel:function(){return r(!1)}};return t&&o().createElement(i.Z,Me({},ge,{contentPaddingX:"12",contentPaddingY:"8",tabs:o().createElement("div",{className:(0,u.tw)(je||(je=De(["md:hidden block"])))},o().createElement(Fe,{tab:R,setTab:W,selections:Z,profileLabel:(0,c.NC)(null==le?void 0:le.label_plural)}))}),P?o().createElement(o().Fragment,null,o().createElement("div",{className:(0,u.tw)(Se||(Se=De(["hidden md:block"])))},pe,o().createElement("div",{className:(0,u.tw)(Ne||(Ne=De(["flex justify-between space-x-4 sm:space-x-8 md:space-x-12 lg:space-x-16 xl:space-x-20 mt-6"])))},o().createElement("div",{className:(0,u.tw)(ke||(ke=De(["flex-1"])))},me),o().createElement("div",{className:(0,u.tw)(Pe||(Pe=De(["flex-1"])))},he)),be),o().createElement("div",{className:(0,u.tw)(Ce||(Ce=De(["md:hidden block"])))},"list"===R?o().createElement(o().Fragment,null,pe,o().createElement("div",{className:(0,u.tw)(Ie||(Ie=De(["w-full mt-4"])))},me)):o().createElement(o().Fragment,null,he),be)):null)}function $e(e){return e.open&&o().createElement(Be,e)}},95004:(e,t,r)=>{r.d(t,{Z:()=>T});var n,a,o,i,l,c,s,u,f,p,d,m,h,v,b,g,y,w,x=r(74644),E=r(67900),O=r(19377),j=r.n(O),S=r(17710),N=r(11129),k=r.n(N),P=r(61988),C={namespace:"UploadProgressModal",keys:["updateProfile","uploading","uploadWarning","uploadSucceed","goAndFix","ignore"],loader:{en:function(){return r.e(63484).then(r.t.bind(r,63484,19))},fr:function(){return r.e(50308).then(r.t.bind(r,50308,19))}},dictionary:{en:{updateProfile:"Updating the profile data",uploading:"Uploading the file(s)",uploadWarning:"Files uploading failed. You can only upload files smaller than 50 MB. Other profile data updated correctly.",uploadSucceed:"The profile is updated.",goAndFix:"Go and fix",ignore:"Ignore"},fr:{updateProfile:"Mise à jour des données du profil",uploading:"Télécharger le(s) fichier(s)",uploadWarning:"Le téléchargement des fichiers a échoué. Vous ne pouvez télécharger que des fichiers de moins de 50 Mo. Les autres données de profil ont été mises à jour correctement.",uploadSucceed:"Le profil est mis à jour.",goAndFix:"Aller et réparer",ignore:"Ignorer"}}};function I(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e){var t,r,O=(t=(0,N.useState)("updating"),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(t,r)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),T=O[0],z=O[1],L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(0,P.FC)(C,e)}(),_=L.updateProfile,F=L.uploading,M=L.uploadWarning,D=L.uploadSucceed,H=L.goAndFix,Z=L.ignore,G=e.handleSave,U=void 0===G?null:G,R=e.handleCancel,W=void 0===R?null:R;(0,N.useEffect)((function(){e.progress&&z(e.progress)}),[e.progress]);var B="",$=!0;if("updating"===T||"uploading"===T){var V="updating"===T?_:F;B=k().createElement("div",{className:(0,E.tw)(n||(n=I(["bg-blue-50 border-l-4 border-blue-400 p-4 mx-2"])))},k().createElement("div",{className:(0,E.tw)(a||(a=I(["flex"])))},k().createElement("div",{className:(0,E.tw)(o||(o=I(["flex-shrink-0"])))},k().createElement(S.frK,{className:(0,E.tw)(i||(i=I(["h-5 w-5 text-blue-400"]))),"aria-hidden":"true"})),k().createElement("div",{className:(0,E.tw)(l||(l=I(["ml-3"])))},k().createElement("p",{className:(0,E.tw)(c||(c=I(["text-blue-700"])))},V)),k().createElement(j(),{cssOverride:{display:"block",marginLeft:"6px"},color:"#444",size:6,margin:2})))}else"failed"===T?(B=k().createElement("div",{className:(0,E.tw)(s||(s=I(["bg-yellow-50 border-l-4 border-yellow-400 p-4 mx-2"])))},k().createElement("div",{className:(0,E.tw)(u||(u=I(["flex"])))},k().createElement("div",{className:(0,E.tw)(f||(f=I(["flex-shrink-0"])))},k().createElement(S.fd$,{className:(0,E.tw)(p||(p=I(["h-5 w-5 text-yellow-400"]))),"aria-hidden":"true"})),k().createElement("div",{className:(0,E.tw)(d||(d=I(["ml-3"])))},k().createElement("p",{className:(0,E.tw)(m||(m=I(["text-sm text-yellow-700"])))},M)))),$=!1):B=k().createElement("div",{className:(0,E.tw)(h||(h=I(["bg-green-50 border-l-4 border-green-400 p-4 mx-2"])))},k().createElement("div",{className:(0,E.tw)(v||(v=I(["flex"])))},k().createElement("div",{className:(0,E.tw)(b||(b=I(["flex-shrink-0"])))},k().createElement(S.fd$,{className:(0,E.tw)(g||(g=I(["h-5 w-5 text-green-400"]))),"aria-hidden":"true"})),k().createElement("div",{className:(0,E.tw)(y||(y=I(["ml-3"])))},k().createElement("p",{className:(0,E.tw)(w||(w=I(["text-sm text-green-700"])))},D))));return k().createElement(x.Z,{open:!0,title:"Updating the profile",handleSave:function(){U&&U()},handleCancel:function(){W&&W()},saveBtnText:H,cancelBtnText:Z,closeOnClickOutside:!1,hideTrigger:!0,children:B,hideFooter:$,zIndex:"z-[101]"})}(0,P.ak)(C)},93621:(e,t,r)=>{r.d(t,{Z:()=>C});var n,a,o,i,l,c,s,u=r(11129),f=r.n(u),p=r(8053),d=r(49394),m=r(30591),h=r(67900),v=r(74644),b=r(95004);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}var y=["action","subaction","url"];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function x(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function E(){E=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,a){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),l=new k(a||[]);return n(i,"_invoke",{value:O(e,r,l)}),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f={};function p(){}function d(){}function m(){}var h={};c(h,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(P([])));b&&b!==t&&r.call(b,o)&&(h=b);var y=m.prototype=p.prototype=Object.create(h);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(n,o,i,l){var c=u(e[n],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==g(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,l)}),(function(e){a("throw",e,i,l)})):t.resolve(f).then((function(e){s.value=e,i(s)}),(function(e){return a("throw",e,i,l)}))}l(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){a(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function O(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var l=j(i,r);if(l){if(l===f)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function j(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,j(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function P(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=m,n(y,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:d,configurable:!0}),d.displayName=c(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},w(x.prototype),c(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new x(s(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(y),c(y,l,"Generator"),c(y,o,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=P,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),N(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;N(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function O(e,t,r,n,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,a)}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const C=(0,u.memo)((function(e){var t=e.contentType,r=e.viewType,g=void 0===r?"profile":r,j=e.saveCallback,P=e.ajaxConfig,C=e.info,I=e.open,A=e.setOpen,T=e.preselectInfo,z=e.refresh,L=P.action,_=(P.subaction,P.url),F=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(P,y),M=C.triggerText,D=C.modalTitle,H=C.triggerElement,Z=k((0,u.useState)(null),2),G=Z[0],U=Z[1],R=k((0,u.useState)([]),2),W=R[0],B=R[1],$=k((0,u.useState)([]),2),V=$[0],J=$[1],Y=k((0,u.useState)(!1),2),q=Y[0],K=Y[1],Q=k((0,u.useState)(!1),2),X=Q[0],ee=Q[1],te=k((0,u.useState)({}),2),re=te[0],ne=te[1],ae=k((0,u.useState)(""),2),oe=ae[0],ie=ae[1],le=(0,u.useRef)(),ce=(0,u.useCallback)((function(e){B(e)}),[]),se=(0,u.useCallback)((function(e){B(e)}),[]),ue=(0,u.useCallback)((function(e){J(e)}),[]),fe=function(e){ne(e)},pe=k((0,u.useState)(null),2),de=pe[0],me=pe[1],he=(0,u.useCallback)((function(){de&&de.contentType===t&&de.viewType===g||(0,p.dr)(t,g).then((function(e){me(S(S({},e),{},{contentType:t,viewType:g}))}))}),[t,g]),ve=function(){var e,r=(e=E().mark((function e(){var r,n,a,o,i,l,c;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!V.length){e.next=5;break}return K(!0),e.abrupt("return",Promise.resolve(!1));case 5:if(r={},Object.entries(re).forEach((function(e){var t=k(e,2),n=t[0],a=t[1];a&&(r[n]=a)})),Object.keys(r).length&&ie(f().createElement(b.Z,null)),(n=new FormData).append("action",L),W.forEach((function(e){for(var t=0,r=Object.entries(e);t<r.length;t++){var a=k(r[t],2),o=a[0],i=a[1];"data[visibility]"===o?n.append("options[visibility]",i):n.append(o,i)}})),F)for(a=0,o=Object.entries(F);a<o.length;a++)i=k(o[a],2),l=i[0],c=i[1],n.append(l,c);return e.abrupt("return",p.jt.post(null!=_?_:"".concat(t,".php"),n).then((function(e){var n=e.data;if(Object.keys(r).length){var a={};return Object.entries(r).forEach((function(e){var t=k(e,2),r=t[0];if(t[1],isNaN(r)){var n=k(r.split("_"),3),o=n[0];n[1],n[2],[o]in a?a[o].push(r):a[o]=[r]}})),Object.entries(a).forEach((function(t){var n=k(t,2),a=n[0],o=n[1],i=e.data.items[0].values[a].map((function(e){return e.id})),l=o.map((function(e){return isNaN(e.split("_")[1])?null:e.split("_")[1]})).filter(Boolean),c=o.filter((function(e){return isNaN(e.split("_")[1])})),s=i.filter((function(e){return!l.includes(e)}));s.length<c.length?console.error("new file fields item are more than available item id"):c.forEach((function(e,t){var n=k(e.split("_"),3),a=n[0],o=n[2],i="".concat(a,"_").concat(s[t],"_").concat(o);delete Object.assign(r,N({},i,r[e]))[e]}))})),ie(f().createElement(b.Z,{progress:"uploading"})),(0,p.Cp)({contentType:t,contentId:n,viewType:g},r).then((function(e){e.error?ie(f().createElement(b.Z,{handleCancel:function(){j&&j(n)},handleSave:function(){j&&j(n)},progress:"failed"})):(ie(f().createElement(b.Z,{progress:"succeed"})),j&&j(n))}))}j&&j(n)})).catch((function(e){var t,r,n=null==e||null===(t=e.response)||void 0===t||null===(r=t.data)||void 0===r?void 0:r.error;return J([n]),K(!0),!1})));case 13:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){O(o,n,a,i,l,"next",e)}function l(e){O(o,n,a,i,l,"throw",e)}i(void 0)}))});return function(){return r.apply(this,arguments)}}(),be=de&&Object.keys(de).length,ge=(0,u.useCallback)((function(){if(be){var e=de.section,t=de.stringCards,r=de.lovOptions;U(f().createElement(m.Z,{formRef:le,section:e,sectionFiles:re,stringCards:t,lovOptions:r,initSectionData:ce,updateSectionData:se,updateFormError:ue,showError:q,updateFileFieldData:fe}))}}),[be,re,q,ce,se,ue,fe]);(0,u.useEffect)((function(){(I||void 0===I)&&he()}),[I,t,g]),(0,u.useEffect)((function(){be&&ge()}),[be,z,re]),(0,u.useEffect)((function(){I&&(U(null),K(!1),J([]),ee(!1),ne({}))}),[I]),(0,u.useEffect)((function(){U(null)}),[t,g]),(0,u.useEffect)((function(){T&&Object.keys(T).length&&!X&&le.current&&(le.current.setFieldsData(T),ee(!0))}),[T,le.current,X]);var ye=H||f().createElement("button",{type:"button",className:(0,h.tw)(n||(n=x(["inline-flex items-center md:px-3 px-2 py-2 border border-transparent shadow-sm text-sm leading-4 font-medium rounded-md text-white bg-blue-500 hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"])))},f().createElement(d.Z,{className:(0,h.tw)(a||(a=x(["md:(-ml-0.5 mr-2) h-4 w-4 mr-0"]))),"aria-hidden":"true"}),f().createElement("span",{className:(0,h.tw)(o||(o=x(["md:(block visible) hidden"])))},null!=M?M:(0,p.NC)({en:"Add",fr:"Ajouter"}))),we=f().createElement("div",{className:(0,h.tw)(i||(i=x(["flex-1 overflow-auto"])))},G,q&&V.length?f().createElement("div",{className:(0,h.tw)(l||(l=x(["flex items-center mt-5"])))},f().createElement("div",{className:(0,h.tw)(c||(c=x(["flex flex-col  w-[58.333%] max-w-[22rem]"])))},V.map((function(e,t){return f().createElement("span",{key:t,className:(0,h.tw)(s||(s=x(["text-red-500"])))},e)})))):null,oe),xe={title:null!=D?D:(0,p.NC)({en:"Add",fr:"Ajouter"}),children:we,handleSave:ve,closeOnClickOutside:!1,size:"lg",contentPaddingY:"2",errors:q?V:[],saveBtnText:(0,p.NC)({en:"Create",fr:"Créer"}),zIndex:"z-[100]"};return uniweb.activeUserId()?void 0===I?f().createElement(v.Z,w({triggerElement:ye},xe,{handleCancel:function(){K(!1),J([])}})):f().createElement(v.Z,w({open:I,hideTrigger:!0,handleCancel:function(){A(!1)}},xe)):null}))},88834:(e,t,r)=>{r.d(t,{Z:()=>T});var n,a,o,i,l,c,s,u,f,p,d,m,h,v,b,g=r(11129),y=r.n(g),w=r(8591),x=r(17710),E=r(37585),O=r(8053),j=r(68713),S=r(67900);function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var C=function(e){var t=e.filters,r=e.handleSearch,c=e.size,s=t.searchText?y().createElement(x.apv,{className:(0,S.tw)(n||(n=P(["flex-shrink-0 w-5 h-5 cursor-pointer opacity-[80%] hover:opacity-100"]))),onClick:function(){p(""),r("")}}):y().createElement(E.t2h,{className:(0,S.tw)(a||(a=P(["w-5 h-5 text-gray-500"])))}),u=N((0,g.useState)(t.searchText||""),2),f=u[0],p=u[1],d=y().createElement("input",{type:"text",value:f,onChange:function(e){p(e.target.value||""),(0,g.startTransition)((function(){r(e.target.value||"")}))},placeholder:(0,O.NC)({en:"Search...",fr:"Rechercher..."}),className:(0,S.tw)(o||(o=P(["w-full h-full bg-transparent resize-none focus:ring-0 outline-none text-sm truncate placeholder-gray-500"])))}),m={sm:"w-28 sm:w-32",md:"w-28 sm:w-32 md:w-36 lg:w-40",lg:"w-28 sm:w-32 md:w-36 lg:w-40 xl:w-44"}[c],h={sm:"h-8",md:"h-8",lg:"h-9"}[c];return y().createElement("div",{className:(0,S.tw)(i||(i=P([""," "," h-9 pl-2.5 pr-2 py-0.5 flex items-center justify-between border border-gray-300 rounded-lg hover:!shadow bg-white text-gray-900"])),m,h)},y().createElement("div",{className:(0,S.tw)(l||(l=P(["h-full flex-grow pr-1"])))},d),s)},I=function(e){var t=e.title,r=e.options,n=e.handleSelect,a=e.activeValue,o=e.icon,i=e.size,l={sm:"px-[5px] h-8",md:"px-[5px] lg:pl-[8px] h-8",lg:"px-[6px] lg:pl-[8px] h-9"}[i],b={sm:"block",md:"block lg:hidden",lg:"block lg:hidden"}[i],g={sm:"hidden",md:"hidden lg:block",lg:"hidden lg:block"}[i],E={sm:"mt-0 ml-0",md:"mt-0 mr-0",lg:"mt-1 mr-0"}[i],O={sm:"w-44",md:"w-44 md:w-48",lg:"w-44 md:w-48 lg:w-56"}[i],j={sm:"text-sm",md:"text-sm lg:text-base",lg:"text-sm lg:text-base"}[i];return y().createElement(w.ZP,{trigger:y().createElement("div",{className:(0,S.tw)(c||(c=P(["flex items-center border border-gray-300 rounded-lg hover:!shadow group "," ",""])),l,a?"bg-gray-900 text-white":"bg-white text-gray-900"),title:t},a&&y().createElement(o,{className:(0,S.tw)(s||(s=P([""," h-5 w-5 mr-1"])),b)}),a?y().createElement(x.apv,{className:(0,S.tw)(u||(u=P(["h-5 w-5 opacity-[80%] hover:opacity-100"]))),onClick:function(e){e.preventDefault(),e.stopPropagation(),n(t,"")}}):y().createElement(o,{className:(0,S.tw)(f||(f=P(["h-5 w-5 opacity-[60%]"])))}),y().createElement("span",{className:(0,S.tw)(p||(p=P([""," text-sm font-medium ml-2 mr-1.5 truncate"])),g)},null!=a?a:t),y().createElement(x.kWQ,{className:(0,S.tw)(d||(d=P([""," h-6 w-6 opacity-[80%] group-hover:opacity-100"])),g),"aria-hidden":"true"})),options:Object.entries(r).sort((function(e,t){return e[0].localeCompare(t[0])})).map((function(e){var r=N(e,2),o=r[0],i=r[1];return y().createElement(w.J2.Button,{as:"div",key:o},y().createElement("div",{className:(0,S.tw)(m||(m=P(["flex text-base justify-between "," hover:bg-gray-200 px-3.5 py-2 gap-x-2 cursor-pointer items-center text-gray-700 hover:text-gray-900"])),a===o?"bg-blue-200":""),onClick:function(){n(t,a===o?"":o)}},y().createElement("span",{className:(0,S.tw)(h||(h=P([""," truncate"])),j),title:o},o),y().createElement("span",{className:(0,S.tw)(v||(v=P(["font-semibold text-sm opacity-60"])))},i.length)))})),width:O,menuClassName:"".concat(E," overflow-auto max-h-[60vh] overscroll-contain"),attachToDocumentBody:!0})},A=function(e){var t=e.histograms,r=e.handleSelect,n=e.filters,a=e.size,o=e.contentType;return t&&Object.keys(t).length?Object.entries(t).map((function(e){var t=N(e,2),i=t[0],l=t[1];return y().createElement(I,{key:i,title:i,options:l,handleSelect:r,activeValue:n[i],size:a,icon:o?(0,O.IJ)(o,i):x.Iit})})):null};function T(e){var t=e.cards,r=e.histograms,n=e.handleSelect,a=e.handleSearch,o=e.filters,i=e.containerClassName,l=void 0===i?"":i,c=e.contentType,s=e.size||"md",u=(0,j.Mn)(t,r,o,!0),f=y().createElement(C,{filters:o,handleSearch:a,size:s}),p=y().createElement(A,{histograms:u,handleSelect:n,filters:o,contentType:c,size:s}),d={sm:"gap-x-1",md:"gap-x-1 sm:gap-x-2 md:gap-x-3",lg:"gap-x-1 sm:gap-x-2 md:gap-x-3 lg:gap-x-4"}[s];return y().createElement("div",{className:(0,S.tw)(b||(b=P(["",""])),l||"flex items-center ".concat(d))},f,p)}}}]);