@beam3_dev/api_module 0.0.278 → 0.0.280

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.
@@ -1,9 +1,9 @@
1
- (function(p,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon","@widget-lab/3ddashboard-utils"],I):(p=typeof globalThis<"u"?globalThis:p||self,I(p["@beam3_dev/api_module"]={},p.uuid,p.luxon,p["@widget-lab/3ddashboard-utils"]))})(this,function(p,I,$,D){"use strict";function J(){return I.v4()}const G={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function te(e,t=void 0,s=void 0){const n=parseInt(e);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+n,{method:"GET",headers:{Accept:"application/json"}}).then(a=>a.json()).then(a=>{t&&t(a)}).catch(a=>{s&&s(a),console.error("Erreur : "+a)})}async function ne(e,t=void 0,s=void 0){e=encodeURIComponent(e),await fetch("https://api-adresse.data.gouv.fr/search/?q="+e+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(n=>n.json()).then(n=>{t&&t(n)}).catch(n=>{s&&s(n),console.error("Erreur : "+n)})}async function se(e,t=G){let s=$.DateTime.now().year;const n=e,a=[],r=i=>{for(let c in i)a.push({date:c,comment:i[c]})};for(let i=s;i<=s+1;i++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+i+".json",{method:"GET",headers:{Accept:"application/json"}}).then(c=>c.json()).then(c=>{r(c)}).catch(c=>console.error("Erreur : "+c));return(()=>{const i=n.length===0?{events:[]}:n;for(let c of a)i.events.findIndex(l=>l.start===$.DateTime.fromISO(c.date).toISODate()&&l.name==="Férié : "+c.comment)===-1&&i.events.push({name:"Férié : "+c.comment,start:$.DateTime.fromISO(c.date).toISODate(),end:$.DateTime.fromISO(c.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return i})()}function x(e,t,s){const{credentials:n,myArray:a,chunk:r,fn_to_call:o}=e,i=[];for(let c=0;c<a.length;c+=r){const d=a.slice(c,c+r);i.push(d)}ae({credentials:n,chunks:i,initLoop:0,fn:o},c=>{t&&t(c)},c=>{s&&s(c)})}function ae(e,t,s){const{credentials:n,chunks:a,initLoop:r,fn:o}=e,i=c=>{o(n,a[c],()=>{c++,c<a.length&&i(c)},d=>{t&&t(d)},d=>{s&&s(d)})};i(r)}async function ie(e,t,s=!0){const n=e.events.findIndex(a=>a.uuid===t.uuid);return n===-1?e.events.push(t):s?e.events[n]=t:e.events.splice(n,1),e.length>0&&e.sort((a,r)=>a.start-r.start),e}function _(e,t){D.requirejs(["DS/WAFData/WAFData"],s=>{s.authenticatedRequest(e,t)})}function oe(e,t,s){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function re(e,t=void 0){D.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],s=>{let n;n===void 0&&(n=s.createProxy({widgetId:D.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&n.addEvent("onFilterSubjectsChange",t)),n.setSubjectsTags(e)})}function ce(e,t){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.droppable(e,{drop:t})})}async function de(e,t=void 0,s=void 0){await D.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],n=>{(!e||e==="")&&(e=D.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(n.getPlatformServices({platformId:e,onComplete:t,onFailure:s}))})}function E(){let e={};return D.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const s=t.getTenant(),n=t.getUser(),a=t.getAllApplicationConfigurations(),r=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:s,user:n,appsConfiguration:a,appConf:r}}),console.log("%cRETOUR API :","color:blue",e),e}function k(e,t=void 0,s=void 0){if(e.tenant){const n=`https://${e.tenant}-eu1-apps.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?tenant=${e.tenant}&cors=true&xrequestedwith=xmlhttprequest`;_(n,{onComplete(a){const r=typeof a=="string"?JSON.parse(a):a;if(r&&"platforms"in r){const o=r.platforms.find(i=>i.id===e.tenant.toUpperCase());t&&o?t(o):s&&s("_getServiceUrl return listServiceUrl = undefined")}else s&&s("_getServiceUrl return oResponse = undefined")},onFailure(a){s&&s(a)}})}}function ue(e,t=void 0,s=void 0){if(e.tenant){const n=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dpassport&platformId=${e.tenant}`;_(n,{onComplete(a){const r=JSON.parse(a);if(console.log("serviceId=3dpassport",r),Array.isArray(r)&&r.length>0){const o=`${r[0].services[0].url}`;t&&t(o)}},onFailure(a){s&&s(a)}})}}function le(e,t,s){const n={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},a=`${n.base}${n.uri}${n.option}`;_(a,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(r,o,i){const c=JSON.parse(r),d=c.data.map(l=>{const u=l.attributes.name,m=l.id;return{name:u,id:m}});t&&t(d,c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,s&&s(i)}})}function pe(e,t=void 0,s=void 0){let n=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;_(n,{onComplete(a,r,o){const i=JSON.parse(a);console.log("_AppMngt_get_users => ",i),t&&t(i)},onFailure(a,r){const o=a;o.msg=r.errormsg,o.errCode=r.errorcode,s&&s(o)}})}function fe(e,t,s=void 0,n=void 0){let a=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;_(a,{onComplete(r,o,i){const c=JSON.parse(r);s&&s(c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,n&&n(i)}})}const j={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function me(e,t,s=void 0,n=void 0){const{space:a,currentUser:r}=e,i=`${a}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,c={groups:[{title:t.title,description:t.description,members:t.members||[r.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};_(i,{method:"POST",headers:j,data:JSON.stringify(c),onComplete(d){s&&s(JSON.parse(d))},onFailure(d,l){console.log(d);const u=d;u.msg=l.errormsg,u.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",u),n&&n(u)}})}function _e(e,t,s=void 0,n=void 0){const{space:a,tenant:r}=e,o=a,i=`/3drdfpersist/v1/resources/${t}`,c=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${r}`,d=`${o}${i}${c}`;_(d,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(m){s&&s(JSON.parse(m))},onFailure(m,f){const g=m;g.msg=f.errormsg,g.errCode=f.errorcode,n&&n(g)}})}function B(e,t=void 0,s=void 0){const{space:n,tenant:a}=e,r=n,o="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",i=`?tenant=dstenant:${a}`,c={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${r}${o}${i}`;_(d,{OPTsH:c,onComplete(l){t&&t(JSON.parse(l))},onFailure(l,u){const m=l;m.msg=u.errormsg,m.errCode=u.errorcode,s&&s(m)}})}function ge(e,t=void 0,s=void 0){const{space:n,currentUser:a}=e,i=`${n}/3drdfpersist/resources/v1/usersgroup?select=uri,title,description,owner,members,pending_members,creation_date,modification_date,visibility`,d={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}};try{_(i,{opts:d,onComplete(l){const u=JSON.parse(l),m={},f=u.groups.filter(g=>g.uri.startsWith("uuid:"));if(a&&Object.keys(a).length>0){const g=f.filter(y=>y.owner===a.email),h=f.filter(y=>y.members.includes(a.email)),S=g.concat(h);m.iam=S,m.UG=f,m.iamMember=h,B(e,y=>{m.rules=y,t&&t(m)},y=>{s&&s(y)})}},onFailure(l){s&&s(l)}})}catch(l){console.log(l)}}function he(e,t){const{space:s}=e,a=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;_(a,{method:"DELETE"})}function Se(e,t,s,n=void 0,a=void 0){const{space:r,tenant:o}=e,i={URITI:"/3drdfpersist/resources/v1/template-instances",URIUGr:"/3drdfpersist/resources/v1/usersgroup",nextURICh:"/characteristics",nextURIGr:"/group",nexURImem:"/members",OPTsTI:"?$mask=dsaccess:Mask.GroupUI.Properties",OPTsTenant:`tenant=dstenant:${o}`},c=s,d=`${r}${i.URIUGr}/${t}`,l=JSON.stringify(c);_(d,{headers:j,method:"PATCH",data:l,type:"json",onComplete(u){n&&n(u)},onFailure(u){a&&a(u)}})}function ye(e,t,s,n=void 0,a=void 0){const{space:r}=e,i=`${r}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(i,{method:"PATCH",headers:j,data:JSON.stringify(s),type:"json",onComplete(d){n&&n(d)},onFailure(d){a&&a(d)}})}function we(e,t,s=void 0,n=void 0){const{space:a}=e,o=`${a}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(o,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(d){s&&s(JSON.parse(d))},onFailure(d){n&&n(d)}})}async function K(e,t,s){if(e.space){const n=`${e.space}/resources/v1/application/CSRF`;_(n,{onComplete(a){a=JSON.parse(a),t&&t(a.csrf)},onFailure(a,r,o){s&&s({error:a,headers:r,xhr:o})}})}}var N={};function Te(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ce=function(e,t,s,n){t=t||"&",s=s||"=";var a={};if(typeof e!="string"||e.length===0)return a;var r=/\+/g;e=e.split(t);var o=1e3;n&&typeof n.maxKeys=="number"&&(o=n.maxKeys);var i=e.length;o>0&&i>o&&(i=o);for(var c=0;c<i;++c){var d=e[c].replace(r,"%20"),l=d.indexOf(s),u,m,f,g;l>=0?(u=d.substr(0,l),m=d.substr(l+1)):(u=d,m=""),f=decodeURIComponent(u),g=decodeURIComponent(m),Te(a,f)?Array.isArray(a[f])?a[f].push(g):a[f]=[a[f],g]:a[f]=g}return a},U=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},be=function(e,t,s,n){return t=t||"&",s=s||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(a){var r=encodeURIComponent(U(a))+s;return Array.isArray(e[a])?e[a].map(function(o){return r+encodeURIComponent(U(o))}).join(t):r+encodeURIComponent(U(e[a]))}).filter(Boolean).join(t):n?encodeURIComponent(U(n))+s+encodeURIComponent(U(e)):""};N.decode=N.parse=Ce,N.encode=N.stringify=be;async function v(e,t=void 0,s=void 0,n=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const r=a+`/resources/v1/modeler/documents/${t}`;_(r,{onComplete(o,i,c){const d=JSON.parse(o);s&&s(d)},onFailure(o){n&&n(o)}})}async function Oe(e,t=void 0,s=void 0,n=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let r=`${a}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,o=N.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});_(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:o,onComplete(i,c,d){const l=JSON.parse(i);s&&s(l)},onFailure(i){n&&n(i)}})}function R(e,t=void 0,s=void 0){if(e.objID&&e.objID!==""){let n=`${e.space}/resources/v1/modeler/documents/${e.objID}`;_(n,{onComplete(a,r,o){const i=JSON.parse(a);e.success=!0,e.token=i?.csrf?.value,e.datas=i?.data[0],t&&t(e)},onFailure(a){s&&s(a)}})}else O(e,n=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",n),t&&t(n)},n=>{s&&s(n)})}function O(e,t=void 0,s=void 0){if(e.space){const n=e.space+"/resources/v1/application/CSRF";_(n,{onComplete(a,r,o){const i=JSON.parse(a);t&&t(i.csrf.value)},onFailure(a,r,o){s&&s({response:a,headers:r,xhr:o})}})}else s&&s("ERROR : url du 3DSpace non défini.")}function A(e,t=void 0,s=void 0){let n=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;R(e,a=>{_(n,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(r,o){const c=JSON.parse(r).data[0].dataelements.ticketURL;t&&t(c,o)},onFailure(r,o){console.warn("☠️ error => ",r,o),s&&s(r,o)}})},a=>{console.warn("_3DSpace_get_ticket / error => ",a),s&&s(a)})}function De(e,t,s=void 0,n=void 0,a=void 0){const r=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;s||(s=e.token),_(r,{method:"PUT",headers:{ENO_CSRF_TOKEN:s},onComplete(o){let i=JSON.parse(o);if(console.log("☠️ info => ",i),i.success===!0)try{const c=i.data[0].dataelements.ticketURL;n&&n(c)}catch(c){a&&a(c)}},onFailure(o){a&&a(o)}})}function P(e,t,s,n,a,r=void 0,o=void 0){const i=()=>q(e,t,s,n,a,e.token,r,o);e.token?i():R(e,t,c=>{e.token=c.csrf.value,i()})}function q(e,t,s,n,a,r,o=void 0,i=void 0){const c=e.space+`/resources/v1/modeler/documents/${t}/files/CheckinTicket`;_(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(d,l,u){const m=JSON.parse(d).csrf,f=JSON.parse(d).data[0].dataelements,g=new FormData;let h;n instanceof Blob?h=n:h=new Blob([n],{type:"text/plain"}),g.append("__fcs__jobTicket",f.ticket),g.append("file_0",h,a);const S={};S.method="POST",S.data=g,S.onComplete=function(y){let w={method:"PUT",headers:{SecurityContext:"ctx::"+e.ctx},data:JSON.stringify({csrf:m,data:[{relateddata:{files:[{dataelements:{title:a,receipt:y},updateAction:"REVISE"}]},id:t,updateAction:"NONE"}]}),type:"json",onComplete(b){o&&o(b)},onFailure(b){i&&i(b)}},C=e.tenant.toUpperCase();_(e.space+`/resources/v1/modeler/documents/?$include=versions&tenant=${C}&e6w-lang=en&e6w-timezone=-120&xrequestedwith=xmlhttprequest`,w)},S.onFailure=function(y){i&&i(y)},S.timeout=0,_(f.ticketURL,S)}})}async function $e(e,t,s=void 0,n=void 0){e.space,e.token,e.ctx;const a=e?.description,r=e?.title;let o=`${e.space}/resources/v1/modeler/documents/${t}`;const i=JSON.stringify({data:[{dataelements:{description:a,title:r}}]});_(o,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},data:i,type:"json",onComplete(c){s&&s(c)},onFailure(c){n&&n(c)}})}async function Ie(e,t,s,n=void 0,a=void 0){e.space,e.token,e.ctx,v(e,t,r=>{const o=r.data[0].relateddata.files[0].id,i=r.data[0].dataelements.secondaryTitle&&r.data[0].dataelements.secondaryTitle!==""?r.data[0].dataelements.secondaryTitle:r.data[0].dataelements.title;P(e,t,o,s,i,c=>{n&&n(c)},c=>{a&&a(c)})},r=>{a&&a(r)})}async function Ne(e,t,s,n,a=void 0,r=void 0){Ue(e,o=>{o?.items>=1&&o.data.forEach(i=>{Re(i,t,s,c=>{Fe(e,c,s,n,d=>{d?.data.length?a&&a(d):r&&r({success:!1,msg:"Erreur lors de la mise en ralation entre la document et le fichier"})},d=>console.warn(d))},c=>console.warn(c))})},o=>console.warn(o))}function Ue(e,t=void 0,s=void 0){if(e?.space&&e.token&&e.ctx){let n=`${e.space}/resources/v1/modeler/documents/files/CheckinTicket`;_(n,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx},onComplete(a,r,o){try{a=JSON.parse(a)}catch{}t&&t(a)},onFailure(a){s&&s(a)}})}else console.log("Error de credentials",e)}function Re(e,t,s,n=void 0,a=void 0){let r=new FormData;t instanceof Blob||(t=new Blob([t],{type:"text/plain"})),r.append("__fcs__jobTicket",e.dataelements.ticket),r.append("file_0",t,s);let o=e.dataelements.ticketURL;_(o,{method:"POST",data:r,onComplete(i){n&&n(i.replace(/[\n\r]/g,""))},onFailure(i){a&&a(i)}})}function Fe(e,t,s,n=void 0,a=void 0,r=void 0){console.log("relatedDocAndFile",{credentials:e,receipt:t,filename:s});const o=d=>d.indexOf(".")===-1?d:d.split(".").slice(0,-1).join(".");let i="temp_"+$.DateTime.now().ts,c=e.space+"/resources/v1/modeler/documents/?e6w-lang=fr&e6w-timezone=-120&xrequestedwith=xmlhttprequest";_(c,{method:"POST",headers:{ENO_CSRF_TOKEN:e.token,SecurityContext:encodeURIComponent("ctx::")+e.ctx,"Content-Type":"application/json"},data:JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Document",dataelements:{title:o(s),description:n},relateddata:{files:[{dataelements:{title:s,receipt:`${t}
2
- `}}]},tempId:i}]}),onComplete(d){try{d=JSON.parse(d)}catch{}a&&a(d)},onFailure(d){r&&r(d)}})}function F(e,t=void 0,s=void 0,n=void 0,a=void 0,r=void 0,o=!1){const i=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;_(i,{method:"GET",onComplete(c){const d=JSON.parse(c);let l="",u,m,f;if(t){let g=d.collabspaces.find(h=>h.title===t);if(g){u=t;let h=g.couples;h=h.filter((S,y,w)=>y===w.findIndex(C=>C.organization.pid===S.organization.pid&&C.role.pid===S.role.pid)),s&&(Array.isArray(s)?s.forEach(S=>{f||h.forEach(y=>{if(S===y.role.name&&n===y.organization.title)f=S,m=n;else if(S===y.role.name){let w=h.filter(C=>C.role.name===S);w.length===1?(f=w[0].role.name,m=w[0].organization.title):r(w)}})}):h.forEach(S=>{if(s===S.role.name&&n===S.organization.title)f=s,m=n;else if(s===S.role.name){let y=h.filter(w=>w.role.name===s);y.length===1?(f=y[0].role.name,m=y[0].organization.title):r(y)}}))}}u&&m&&f?(l=f+"."+m+"."+u,a(l)):d.preferredcredentials&&o?(l=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,a(l)):r&&(l=f+"."+m+"."+u,r(l))},onFailure(c,d){console.warn("Erreur de récupération du contexte de sécurité. => ",{err:c,headers:d})}})}async function L(e,t=void 0,s=void 0){return(!e.objID||e.objID==="")&&(console.warn("_3DSpace_download_doc() / Le paramètre objectId est obligatoire"),s&&s("_3DSpace_download_doc() / Le paramètre objectId est obligatoire")),(e.space===""||!e.space)&&(console.warn("_3DSpace_download_doc() / Le paramètre space est obligatoire"),s&&s("_3DSpace_download_doc() / Le paramètre space est obligatoire")),(e.token===""||!e.token)&&K(e,n=>{e.token=n},n=>{console.log("☠️ error => ",n)}),new Promise((n,a)=>{A(e,r=>{e?.returnType==="blob"?(console.log("ticketURL blob",r),fetch(r).then(o=>o.blob()).then(o=>{t&&t(o)}).catch(o=>{s&&s(o)})):_(r,{onComplete(o){let i;try{i=JSON.parse(o)}catch{i=o}t&&typeof t=="function"&&t(i),n(i)},onFailure(o,i,c){s&&(console.log("error http",o),s({msg:JSON.parse(o),headers:i,xhr:c}),a({msg:JSON.parse(o),headers:i,xhr:c}))}})},r=>{s&&s(r),console.log("*_3dspace_download_doc / error file URL *",r),a(r)})})}async function W(e,t,s=void 0,n=void 0){typeof t<"u"&&Array.isArray(t)&&t?.length>0?x({credentials:e,myArray:t,chunk:80,fn_to_call:X},r=>{s&&s(r)}):(console.warn("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."),n&&n("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."))}function X(e,t,s=void 0,n=void 0,a=void 0){const r=[];t.forEach(c=>{r.push({id:c})});let o=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:r});const i=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;_(i,{method:"PUT",data:o,type:"json",onComplete(c){const d=c.data;c.success===!0&&(s&&s(),d.forEach(l=>{try{const u=l.dataelements.fileName,m=l.dataelements.ticketURL;_(m,{onComplete:(f,g)=>{let h;try{h=JSON.parse(f)}catch{h=f.blob()}n&&n({objectId:l.id,headers:g,fileName:u,data:h})},onFailure:f=>{console.log("error http",f)}})}catch(u){console.log(u),a&&a(u)}}))},onFailure(c){console.log(c),a&&a(c)}})}function Ae(e,t,s=void 0,n=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t}]}),type:"json",onComplete(i){s&&s(i)},onFailure(i){n&&n(i)}};_(r,o)}})}function ke(e,t,s,n=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;let i={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t,nextState:s}]}),type:"json",onComplete(c){n&&n(c)},onFailure(c){a&&a(c)}};_(o,i)}})}function je(e,t,s=void 0,n=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t}]}),type:"json",onComplete(i){s&&s(i)},onFailure(i){n&&n(i)}};_(r,o)}})}function ve(e,t,s=void 0,n=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{"attribute[PLMReference.V_versionComment]":null,physicalid:t,type:"Document",tenant:e.tenant,objectId:t,policy:"Document Release",availableSemantic:["E","LAST","NEW","DUP"]}]}),type:"json",onComplete(i){s&&s(i)},onFailure(i){n&&n(i)}};_(r,o)}})}function Pe(e,t,s,n=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let i={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{physicalid:t,proposedRevision:s,modifiedAttributes:{revision:s}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(c){n&&n(c)},onFailure(c){a&&a(c)}};_(o,i)}})}function Le(e,t,s,n,a=void 0,r=void 0){return new Promise(o=>{const i=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let c={attributes:{title:s,description:n,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(c);let l={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx,ENO_CSRF_TOKEN:e.token},data:JSON.stringify(d),type:"json",onComplete(u){a&&a(u)},onFailure(u){r&&r(u)}};_(i,l)})}function Me(e,t,s,n,a=void 0,r=void 0){return console.log("credentials",e),new Promise(o=>{`${e.space}`,JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Workspace",cestamp:"businessobject",relId:t,id:t,dataelements:{personList:s,eventsList:n},tenant:e.tenant}]})})}//!SECTION
3
- function Je(e,t=void 0,s=void 0){const n={base:`${e.space}`,uri:"/resources/bps/cspaces",optTenant:`tenant=${e.tenant}`},a=`${n.base}${n.uri}?${n.optTenant}`;_(a,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","Content-Type":"application/ds-json"},onComplete(r,o){const i=JSON.parse(r);t&&t(i,o)},onFailure(r,o,i){s&&s({response:r,headers:o,xhr:i})}})}function Ge(e,t,s,n){A(e.space,t,a=>{_(a,{header:{ENO_CSRF_TOKEN:e.token},onComplete:r=>{s&&s(r)},onFailure:r=>{console.log("error http",r),n&&n(r)}})})}async function xe(e,t,s=void 0,n=void 0){return new Promise(a=>{A(e,t,r=>{_(r,{onComplete:(o,i,c)=>(a(JSON.parse(o)),s&&s(JSON.parse(o),i,c),a),onFailure:(o,i,c)=>{n&&n(o,i,c),console.log(o,i?.errormsg)}})})})}function Ee(e,t,s,n=void 0,a=void 0){const r=new Blob([JSON.stringify(t)],{type:"text/plain"});R(e,s,o=>{const i=o.data[0].relateddata.files[0].id,c=o.data[0].dataelements.secondaryTitle!==""?o.data[0].dataelements.secondaryTitle:o.data[0].dataelements.title;P(e,s,i,r,c,d=>{n&&n(d)},d=>{a&&a(d)})})}let V,Y;const H=[];async function Be(e,t=void 0,s=void 0){e.objID&&e.objID!==""?R(e,n=>{t&&t(n)},n=>{s&&s(n)}):(e.objID===null||e.objID==="")&&O(e,n=>{t&&t({rep:n,msg:"Pas d'objID, ou invalide"})},n=>{s&&s({msg:"Pas d'objID et erreur sur le Space",err:n})})}async function Ke(e,t=void 0,s=void 0){console.log("getDatasByTenant (getDocuments)",e),await L(e,n=>{const a={};a.obj=n,console.log("getDatasByTenant (getDocuments) _datas",a),t&&t?.(a)},n=>{s&&s?.(n)})}function qe(e,t=void 0,s=void 0){const n=[];if(!e.objIds&&!Array.isArray(e.objIds)&&e.objIds.length===0){console.warn("la liste est vide ou n'est pas un tableau");return}e.objIds.forEach((a,r)=>{L(e,a.objID,o=>{n.push({[a.name]:o}),a.name==="dbProjets"&&(V=o.affaires.map(i=>i.objectID),z(e,Y)),r===e.objIds.length-1&&(t&&t(n),delete e.objIds,delete e.datas)})})}function z(e,t,s=void 0,n=void 0){W(e,V,a=>{const r=[...t];r.find(o=>o.objectID===a.objectId).data=a.data,Y=r,H.push(a.data),s&&s(H)},a=>{n&&(n(a),console.log(a))})}const We="FA35FB9B177A280065800EA0000F599C",Xe=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],Q={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},Ve={objId:We,pred:"who",order_by:"desc",tag:"testTag"};function Ye(e,t,s=void 0,n=void 0){const{space:a,tenant:r}=e,{objId:o,pred:i,tag:c}=t,d={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${r}`},l=`${a}${d.uri}?${d.otpCTX}&${d.optTenant}`,u={tag:[{subject:[{uri:`pid://${o}`}],predicate:Q[i],object:{literal:c}}]};_(l,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(u),onComplete(m){JSON.parse(m);const f={};setTimeout(()=>{v(e,o,g=>{const h=g.data[0].dataelements.title,S=g.data[0].dataelements.fileExtension!==void 0?g.data[0].dataelements.fileExtension:"",y=g.data[0].relateddata.ownerInfo[0].dataelements.name;f.name=h,f.ext=S,f.createBy=y,t.info={...f},He(e,t,w=>{s&&s(w)},w=>{n&&n(w)})},(g,h)=>{const S=g;S.msg=h.errormsg,S.errCode=h.errorcode,console.log("❌ sendDirectMessage => ",S),n&&n(S)})},2e3)},onFailure(m,f){const g=m;g.msg=f.errormsg,g.errCode=f.errorcode,console.log("❌ sendDirectMessage => ",g),n&&n(g)}})}function He(e,t,s=void 0,n=void 0){console.log("obj ",t);const a=t.info.name,r={baseUrl:`https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,uri:"/federated/search"},o=`${r.baseUrl}${r.uri}`,i={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},c=J(),d={with_indexing_date:!0,with_synthesis:!0,with_nls:!1,label:`3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${c}`,locale:"fr",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:modified","ds6w:created","ds6wg:revision","ds6w:status","ds6w:responsible","owner","ds6w:responsibleUid","ds6wg:filesize","ds6w:project","ds6w:dataSource","ds6w:community","ds6w:originator","dsgeo:referential","ds6w:lastModifiedBy","ds6w:repository","dcterms:title","dcterms:description","ds6w:containerUid"],with_synthesis_hierarchical:!0,select_file:["icon","thumbnail_2d"],query:a,specific_source_parameter:{"3dspace":{additional_query:' AND NOT (owner:"ENOVIA_CLOUD" OR owner:"Service Creator" OR owner:"Corporate" OR owner:"User Agent" OR owner:"SLMInstallerAdmin" OR owner:"Creator" OR owner:"VPLMAdminUser") AND (ds6w_58_islastrevisionperstate:true OR NOT listoffields:ds6w_58_islastrevisionperstate)'},drive:{additional_query:' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'}},select_exclude_synthesis:["ds6w:what/ds6w:topic"],order_by:Ve.order_by,order_field:"relevance",select_snippets:["ds6w:snippet","ds6w:label:snippet","ds6w:responsible:snippet","ds6w:community:snippet","swym:message_text:snippet"],nresults:40,start:"0",source:Xe,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),_(o,{method:"POST",headers:i,data:JSON.stringify(d),onComplete(l){const u=JSON.parse(l);s(u)},onFailure(l,u){const m=l;m.msg=u.errormsg,m.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",m),n&&n(m),console.log("Erreur de recuperation d'id du doc et des tags",l)}})}function ze(e,t,s=void 0,n=void 0){const{objId:a,pred:r,tag:o}=t,i={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${e.tenant}`},c=`${e.space}${i.uri}?${i.otpCTX}&${i.optTenant}`,d={tag:[{subject:[{uri:`pid://${a}`}],predicate:Q[r],object:{literal:o}}]};_(c,{method:"DELETE",data:JSON.stringify(d),headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},onComplete(l){s&&s(l)},onFailure(l,u){const m=l;m.msg=u.errormsg,m.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",m),n&&n(m)}})}function Qe(e,t="",s=void 0,n=void 0){const{space:a}=e;if(t==="")return;const r={uri:"/resources/v1/modeler/documents"},o={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json,text/javascript,*/*"},i=`${a}${r.uri}`,c=`$include=none,lockerInfo,ownerInfo,originatorInfo,files,ownerInfo,originatorInfo&$fields=none,title,name,typeNLS,collabSpaceTitle,revision,isLatestRevision,files,lockStatus,lockerInfo.name,lockerInfo.firstname,lockerInfo.lastname,owner,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,stateNLS,modified,policy,state,organizationTitle,originator,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname,hasModifyAccess,fileExtension,files.name,files.title,files.revision,files.locker,ownerInfo,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,originatorInfo,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname&$ids=${t}`;_(i,{method:"POST",headers:o,data:c,onComplete(d){s&&s(JSON.parse(d))},onFailure(d,l){const u=d;u.msg=l.error,n&&n(u)}})}async function T(e,t=void 0,s=void 0){const n=e._3DSwym+"/api/index/tk";return _(n,{onComplete(a,r,o){const i=JSON.parse(a);if(t)return t(i),e.token=i?.result?.ServerToken},onFailure(a){s&&s(a)}})}function Ze(e,t=void 0,s=void 0){const n=`${e._3DSwym}/api/exalead/whatsnew`,a={params:{community_id:null,hash_key:null,legacyFormat:!1,nresults:1,query:"#all",start:0}};T(e,r=>{_(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(a),type:"json",onComplete(o,i){t&&t(o,i)},onFailure(o,i){s&&s(o,i)}})})}function et(e,t=void 0,s=void 0){const n=`${e._3DSwym}/api/Recommendation/getpeoplefamiliartocurrentuser`,a={params:{idsToFilterArr:[],mode:"offline",limit:30,itemType:"User",maxNbOfCommonElements:"5"}};T(e,r=>{_(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(a),type:"json",onComplete(o,i){const c=o.result.hits.map(d=>({login:d.login,fullName:d.name}));t&&t(c,o)},onFailure(o,i){s&&s(o,i)}})})}function tt(e,t=void 0,s=void 0){const n={base:e._3DSwym,uri:"/api/community/listmycommunities",limit:`/limit/${e.limit?e.limit:500}`,page:`/page/${e.page?e.page:"1"}`},a=`${n.base}${n.uri}${n.limit}${n.page}`,r=[];T(e,o=>{_(a,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(i,c,d){const u=JSON.parse(i).result;let m=0;u.forEach(f=>{const g={description:f.description,id:f.id,title:f.title,owner:f.owner,role:f.role,access:f.access};Z(e,f.id,h=>{m++,g.members=h,r.push(g),m===u.length&&t&&t(r)},h=>s(h))})},onFailure(i,c){const d=i;d.status=c.status,d.response=c.errormsg,s&&s(d)}})})}function Z(e,t,s,n){const a=`${e._3DSwym}/api/community/listmembers`,r={params:{page:e.page?e.page:1,limit:e.limit?e.limit:50,community_id:t}};T(e,o=>{_(a,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},data:JSON.stringify(r),type:"json",onComplete(i,c,d){s&&s(i)},onFailure(i,c){const d=i;d.status=c.status,d.response=c.errormsg,n&&n(d)}})})}function nt(e,t=void 0,s=void 0){const n="YXdA5x4DSUKtlAi2wmnyTA";e.commu_id||(e.commu_id=n);const a=`${e._3DSwym}/api/v2/communities/${e.commu_id}/ideas/statuses`;T(e,r=>{_(a,{method:"GET",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const i=JSON.parse(o);t&&t(i)},onFailure(o,i){const c=o;c.status=i.status,c.response=i.errormsg,s&&s(c)}})})}function st(e,t,s=void 0,n=void 0){const{listAllContacts:a,currentUser:r,_3DSwym:o}=e;console.log("__listAllContacts",a.hits);const i=`${o}/api/directmessages`,c={users:[r.login].concat(t.receipt)},d={id_msg:"",senderId:e.currentUser.login,senderName:`${e.currentUser.first_name} ${e.currentUser.last_name}`,msg:at(t.msg)};let l=!1;ee(c.users,u=>{u!==void 0&&(d.id_msg=u.id,l=!0,M(e,d))},u=>{l=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",u),n&&n(u),d.id_msg=""}),l===!1&&setTimeout(()=>{l===!1&&T(e,u=>{_(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":u.result.ServerToken},data:JSON.stringify(c),type:"json",onComplete(m,f,g){const h=m;h.reponse=JSON.parse(g.response),h.status=g.status,s&&s(h),d.id_msg=h.result.id,M(e,d)},onFailure(m,f,g){const h=m;h.msg=f.errormsg,h.status=f.status,n&&n(h)}})})},500)}function ee(e,t,s,n){const a=`${e._3DSwym}/api/directmessages/lite?with_favorites=false`;T(e,r=>{_(a,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const i=JSON.parse(o),c=[];i.result.forEach(u=>{u.users=u.users.sort((m,f)=>m.login.localeCompare(f.login)),u.users.length===t.length&&c.push(u)});const d=t.sort(),l=c.find(u=>{const m=[];return u.users.forEach(f=>{m.push(f.login)}),JSON.stringify(m)===JSON.stringify(d)});s&&l!==void 0?s(l):(n||l===void 0)&&n(l)},onFailure(o){const i=o;i.msg=headers.errormsg,i.errCode=headers.errorcode,console.log("❌ sendDirectMessageLite => ",i),n&&n(i)}})})}function M(e,t,s=void 0,n=void 0){const a={base:e._3DSwym,uri:"/api/community",id_msg:`${t.id_msg}`,endUri:"/instantmessages"},r=`${a.base}${a.uri}/${a.id_msg}${a.endUri}`,o={author:{login:t.senderId,displayName:t.senderName},accessState:null,commentUri:null,comments:null,endorsements:null,moderationState:null,parentCommentUri:null,richMessage:t.msg};console.log("_3dSwym_sendDirectMessageData url ",r),T(e,i=>{_(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i.result.ServerToken},data:JSON.stringify(o),type:"json",onComplete(c,d,l){const u=c;u.status=l.status,u.response=JSON.parse(l.response),console.log("✅ _3dSwym_sendDirectMessageData => ",u),s&&s(u)},onFailure(c,d){const l=c;l.msg=d.errormsg,l.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",l),n&&n(l)}})})}function at(e){const t=new Date().toLocaleDateString(),s=new Date().toLocaleTimeString();return`<p>${e} </p>
1
+ (function(l,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon","@widget-lab/3ddashboard-utils"],I):(l=typeof globalThis<"u"?globalThis:l||self,I(l["@beam3_dev/api_module"]={},l.uuid,l.luxon,l["@widget-lab/3ddashboard-utils"]))})(this,function(l,I,$,D){"use strict";function J(){return I.v4()}const G={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function te(e,t=void 0,n=void 0){const s=parseInt(e);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+s,{method:"GET",headers:{Accept:"application/json"}}).then(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{n&&n(i),console.error("Erreur : "+i)})}async function ne(e,t=void 0,n=void 0){e=encodeURIComponent(e),await fetch("https://api-adresse.data.gouv.fr/search/?q="+e+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(s=>s.json()).then(s=>{t&&t(s)}).catch(s=>{n&&n(s),console.error("Erreur : "+s)})}async function se(e,t=G){let n=$.DateTime.now().year;const s=e,i=[],r=a=>{for(let c in a)i.push({date:c,comment:a[c]})};for(let a=n;a<=n+1;a++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+a+".json",{method:"GET",headers:{Accept:"application/json"}}).then(c=>c.json()).then(c=>{r(c)}).catch(c=>console.error("Erreur : "+c));return(()=>{const a=s.length===0?{events:[]}:s;for(let c of i)a.events.findIndex(p=>p.start===$.DateTime.fromISO(c.date).toISODate()&&p.name==="Férié : "+c.comment)===-1&&a.events.push({name:"Férié : "+c.comment,start:$.DateTime.fromISO(c.date).toISODate(),end:$.DateTime.fromISO(c.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return a})()}function x(e,t,n){const{credentials:s,myArray:i,chunk:r,fn_to_call:o}=e,a=[];for(let c=0;c<i.length;c+=r){const d=i.slice(c,c+r);a.push(d)}ie({credentials:s,chunks:a,initLoop:0,fn:o},c=>{t&&t(c)},c=>{n&&n(c)})}function ie(e,t,n){const{credentials:s,chunks:i,initLoop:r,fn:o}=e,a=c=>{o(s,i[c],()=>{c++,c<i.length&&a(c)},d=>{t&&t(d)},d=>{n&&n(d)})};a(r)}async function ae(e,t,n=!0){const s=e.events.findIndex(i=>i.uuid===t.uuid);return s===-1?e.events.push(t):n?e.events[s]=t:e.events.splice(s,1),e.length>0&&e.sort((i,r)=>i.start-r.start),e}function g(e,t){D.requirejs(["DS/WAFData/WAFData"],n=>{n.authenticatedRequest(e,t)})}function oe(e,t,n){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.draggable(e,{data:t,start:n})})}function re(e,t=void 0){D.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],n=>{let s;s===void 0&&(s=n.createProxy({widgetId:D.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&s.addEvent("onFilterSubjectsChange",t)),s.setSubjectsTags(e)})}function ce(e,t){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.droppable(e,{drop:t})})}async function de(e,t=void 0,n=void 0){await D.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],s=>{(!e||e==="")&&(e=D.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(s.getPlatformServices({platformId:e,onComplete:t,onFailure:n}))})}function E(){let e={};return D.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const n=t.getTenant(),s=t.getUser(),i=t.getAllApplicationConfigurations(),r=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:n,user:s,appsConfiguration:i,appConf:r}}),console.log("%cRETOUR API :","color:blue",e),e}function ue(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1.iam.3dexperience.3ds.com/api/authenticated/user/me?xrequestedwith=xmlhttprequest`;g(s,{onComplete(i){const r=typeof i=="string"?JSON.parse(i):i;r&&"fields"in r?t&&t(r.fields):n&&n("_getMe return not find properties fields")},onFailure(i){n&&n("_getMe return error",i)}})}}function k(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-apps.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?tenant=${e.tenant}&cors=true&xrequestedwith=xmlhttprequest`;g(s,{onComplete(i){const r=typeof i=="string"?JSON.parse(i):i;if(r&&"platforms"in r){const o=r.platforms.find(a=>a.id===e.tenant.toUpperCase());t&&o?t(o):n&&n("_getServiceUrl return listServiceUrl = undefined")}else n&&n("_getServiceUrl return oResponse = undefined")},onFailure(i){n&&n(i)}})}}function le(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dpassport&platformId=${e.tenant}`;g(s,{onComplete(i){const r=JSON.parse(i);if(console.log("serviceId=3dpassport",r),Array.isArray(r)&&r.length>0){const o=`${r[0].services[0].url}`;t&&t(o)}},onFailure(i){n&&n(i)}})}}function pe(e,t,n){const s={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},i=`${s.base}${s.uri}${s.option}`;g(i,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(r,o,a){const c=JSON.parse(r),d=c.data.map(p=>{const u=p.attributes.name,m=p.id;return{name:u,id:m}});t&&t(d,c)},onFailure(r,o){const a=r;a.msg=o.errormsg,a.errCode=o.errorcode,n&&n(a)}})}function fe(e,t=void 0,n=void 0){let s=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;g(s,{onComplete(i,r,o){const a=JSON.parse(i);console.log("_AppMngt_get_users => ",a),t&&t(a)},onFailure(i,r){const o=i;o.msg=r.errormsg,o.errCode=r.errorcode,n&&n(o)}})}function me(e,t,n=void 0,s=void 0){let i=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;g(i,{onComplete(r,o,a){const c=JSON.parse(r);n&&n(c)},onFailure(r,o){const a=r;a.msg=o.errormsg,a.errCode=o.errorcode,s&&s(a)}})}const v={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function ge(e,t,n=void 0,s=void 0){const{space:i,currentUser:r}=e,a=`${i}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,c={groups:[{title:t.title,description:t.description,members:t.members||[r.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};g(a,{method:"POST",headers:v,data:JSON.stringify(c),onComplete(d){n&&n(JSON.parse(d))},onFailure(d,p){console.log(d);const u=d;u.msg=p.errormsg,u.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",u),s&&s(u)}})}function _e(e,t,n=void 0,s=void 0){const{space:i,tenant:r}=e,o=i,a=`/3drdfpersist/v1/resources/${t}`,c=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${r}`,d=`${o}${a}${c}`;g(d,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(m){n&&n(JSON.parse(m))},onFailure(m,f){const _=m;_.msg=f.errormsg,_.errCode=f.errorcode,s&&s(_)}})}function B(e,t=void 0,n=void 0){const{space:s,tenant:i}=e,r=s,o="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",a=`?tenant=dstenant:${i}`,c={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${r}${o}${a}`;g(d,{OPTsH:c,onComplete(p){t&&t(JSON.parse(p))},onFailure(p,u){const m=p;m.msg=u.errormsg,m.errCode=u.errorcode,n&&n(m)}})}function he(e,t=void 0,n=void 0){const{space:s,currentUser:i}=e,a=`${s}/3drdfpersist/resources/v1/usersgroup?select=uri,title,description,owner,members,pending_members,creation_date,modification_date,visibility`,d={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}};try{g(a,{opts:d,onComplete(p){const u=JSON.parse(p),m={},f=u.groups.filter(_=>_.uri.startsWith("uuid:"));if(i&&Object.keys(i).length>0){const _=f.filter(y=>y.owner===i.email),h=f.filter(y=>y.members.includes(i.email)),S=_.concat(h);m.iam=S,m.UG=f,m.iamMember=h,B(e,y=>{m.rules=y,t&&t(m)},y=>{n&&n(y)})}},onFailure(p){n&&n(p)}})}catch(p){console.log(p)}}function Se(e,t){const{space:n}=e,i=`${n}/3drdfpersist/resources/v1/usersgroup/${t}`;g(i,{method:"DELETE"})}function ye(e,t,n,s=void 0,i=void 0){const{space:r,tenant:o}=e,a={URITI:"/3drdfpersist/resources/v1/template-instances",URIUGr:"/3drdfpersist/resources/v1/usersgroup",nextURICh:"/characteristics",nextURIGr:"/group",nexURImem:"/members",OPTsTI:"?$mask=dsaccess:Mask.GroupUI.Properties",OPTsTenant:`tenant=dstenant:${o}`},c=n,d=`${r}${a.URIUGr}/${t}`,p=JSON.stringify(c);g(d,{headers:v,method:"PATCH",data:p,type:"json",onComplete(u){s&&s(u)},onFailure(u){i&&i(u)}})}function we(e,t,n,s=void 0,i=void 0){const{space:r}=e,a=`${r}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(a,{method:"PATCH",headers:v,data:JSON.stringify(n),type:"json",onComplete(d){s&&s(d)},onFailure(d){i&&i(d)}})}function Ce(e,t,n=void 0,s=void 0){const{space:i}=e,o=`${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(o,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(d){n&&n(JSON.parse(d))},onFailure(d){s&&s(d)}})}async function K(e,t,n){if(e.space){const s=`${e.space}/resources/v1/application/CSRF`;g(s,{onComplete(i){i=JSON.parse(i),t&&t(i.csrf)},onFailure(i,r,o){n&&n({error:i,headers:r,xhr:o})}})}}var N={};function Te(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var be=function(e,t,n,s){t=t||"&",n=n||"=";var i={};if(typeof e!="string"||e.length===0)return i;var r=/\+/g;e=e.split(t);var o=1e3;s&&typeof s.maxKeys=="number"&&(o=s.maxKeys);var a=e.length;o>0&&a>o&&(a=o);for(var c=0;c<a;++c){var d=e[c].replace(r,"%20"),p=d.indexOf(n),u,m,f,_;p>=0?(u=d.substr(0,p),m=d.substr(p+1)):(u=d,m=""),f=decodeURIComponent(u),_=decodeURIComponent(m),Te(i,f)?Array.isArray(i[f])?i[f].push(_):i[f]=[i[f],_]:i[f]=_}return i},U=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Oe=function(e,t,n,s){return t=t||"&",n=n||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(i){var r=encodeURIComponent(U(i))+n;return Array.isArray(e[i])?e[i].map(function(o){return r+encodeURIComponent(U(o))}).join(t):r+encodeURIComponent(U(e[i]))}).filter(Boolean).join(t):s?encodeURIComponent(U(s))+n+encodeURIComponent(U(e)):""};N.decode=N.parse=be,N.encode=N.stringify=Oe;async function j(e,t=void 0,n=void 0,s=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const r=i+`/resources/v1/modeler/documents/${t}`;g(r,{onComplete(o,a,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})}async function De(e,t=void 0,n=void 0,s=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let r=`${i}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,o=N.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});g(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:o,onComplete(a,c,d){const p=JSON.parse(a);n&&n(p)},onFailure(a){s&&s(a)}})}function R(e,t=void 0,n=void 0){if(e.objID&&e.objID!==""){let s=`${e.space}/resources/v1/modeler/documents/${e.objID}`;g(s,{onComplete(i,r,o){const a=JSON.parse(i);e.success=!0,e.token=a?.csrf?.value,e.datas=a?.data[0],t&&t(e)},onFailure(i){n&&n(i)}})}else O(e,s=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",s),t&&t(s)},s=>{n&&n(s)})}function O(e,t=void 0,n=void 0){if(e.space){const s=e.space+"/resources/v1/application/CSRF";g(s,{onComplete(i,r,o){const a=JSON.parse(i);t&&t(a.csrf.value)},onFailure(i,r,o){n&&n({response:i,headers:r,xhr:o})}})}else n&&n("ERROR : url du 3DSpace non défini.")}function A(e,t=void 0,n=void 0){let s=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;R(e,i=>{g(s,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(r,o){const c=JSON.parse(r).data[0].dataelements.ticketURL;t&&t(c,o)},onFailure(r,o){console.warn("☠️ error => ",r,o),n&&n(r,o)}})},i=>{console.warn("_3DSpace_get_ticket / error => ",i),n&&n(i)})}function $e(e,t,n=void 0,s=void 0,i=void 0){const r=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;n||(n=e.token),g(r,{method:"PUT",headers:{ENO_CSRF_TOKEN:n},onComplete(o){let a=JSON.parse(o);if(console.log("☠️ info => ",a),a.success===!0)try{const c=a.data[0].dataelements.ticketURL;s&&s(c)}catch(c){i&&i(c)}},onFailure(o){i&&i(o)}})}function P(e,t,n,s,i,r=void 0,o=void 0){const a=()=>q(e,t,n,s,i,e.token,r,o);e.token?a():R(e,t,c=>{e.token=c.csrf.value,a()})}function q(e,t,n,s,i,r,o=void 0,a=void 0){const c=e.space+`/resources/v1/modeler/documents/${t}/files/CheckinTicket`;g(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(d,p,u){const m=JSON.parse(d).csrf,f=JSON.parse(d).data[0].dataelements,_=new FormData;let h;s instanceof Blob?h=s:h=new Blob([s],{type:"text/plain"}),_.append("__fcs__jobTicket",f.ticket),_.append("file_0",h,i);const S={};S.method="POST",S.data=_,S.onComplete=function(y){let w={method:"PUT",headers:{SecurityContext:"ctx::"+e.ctx},data:JSON.stringify({csrf:m,data:[{relateddata:{files:[{dataelements:{title:i,receipt:y},updateAction:"REVISE"}]},id:t,updateAction:"NONE"}]}),type:"json",onComplete(b){o&&o(b)},onFailure(b){a&&a(b)}},T=e.tenant.toUpperCase();g(e.space+`/resources/v1/modeler/documents/?$include=versions&tenant=${T}&e6w-lang=en&e6w-timezone=-120&xrequestedwith=xmlhttprequest`,w)},S.onFailure=function(y){a&&a(y)},S.timeout=0,g(f.ticketURL,S)}})}async function Ie(e,t,n=void 0,s=void 0){e.space,e.token,e.ctx;const i=e?.description,r=e?.title;let o=`${e.space}/resources/v1/modeler/documents/${t}`;const a=JSON.stringify({data:[{dataelements:{description:i,title:r}}]});g(o,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},data:a,type:"json",onComplete(c){n&&n(c)},onFailure(c){s&&s(c)}})}async function Ne(e,t,n,s=void 0,i=void 0){e.space,e.token,e.ctx,j(e,t,r=>{const o=r.data[0].relateddata.files[0].id,a=r.data[0].dataelements.secondaryTitle&&r.data[0].dataelements.secondaryTitle!==""?r.data[0].dataelements.secondaryTitle:r.data[0].dataelements.title;P(e,t,o,n,a,c=>{s&&s(c)},c=>{i&&i(c)})},r=>{i&&i(r)})}async function Ue(e,t,n,s,i=void 0,r=void 0){Re(e,o=>{o?.items>=1&&o.data.forEach(a=>{Fe(a,t,n,c=>{Ae(e,c,n,s,d=>{d?.data.length?i&&i(d):r&&r({success:!1,msg:"Erreur lors de la mise en ralation entre la document et le fichier"})},d=>console.warn(d))},c=>console.warn(c))})},o=>console.warn(o))}function Re(e,t=void 0,n=void 0){if(e?.space&&e.token&&e.ctx){let s=`${e.space}/resources/v1/modeler/documents/files/CheckinTicket`;g(s,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx},onComplete(i,r,o){try{i=JSON.parse(i)}catch{}t&&t(i)},onFailure(i){n&&n(i)}})}else console.log("Error de credentials",e)}function Fe(e,t,n,s=void 0,i=void 0){let r=new FormData;t instanceof Blob||(t=new Blob([t],{type:"text/plain"})),r.append("__fcs__jobTicket",e.dataelements.ticket),r.append("file_0",t,n);let o=e.dataelements.ticketURL;g(o,{method:"POST",data:r,onComplete(a){s&&s(a.replace(/[\n\r]/g,""))},onFailure(a){i&&i(a)}})}function Ae(e,t,n,s=void 0,i=void 0,r=void 0){console.log("relatedDocAndFile",{credentials:e,receipt:t,filename:n});const o=d=>d.indexOf(".")===-1?d:d.split(".").slice(0,-1).join(".");let a="temp_"+$.DateTime.now().ts,c=e.space+"/resources/v1/modeler/documents/?e6w-lang=fr&e6w-timezone=-120&xrequestedwith=xmlhttprequest";g(c,{method:"POST",headers:{ENO_CSRF_TOKEN:e.token,SecurityContext:encodeURIComponent("ctx::")+e.ctx,"Content-Type":"application/json"},data:JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Document",dataelements:{title:o(n),description:s},relateddata:{files:[{dataelements:{title:n,receipt:`${t}
2
+ `}}]},tempId:a}]}),onComplete(d){try{d=JSON.parse(d)}catch{}i&&i(d)},onFailure(d){r&&r(d)}})}function F(e,t=void 0,n=void 0,s=void 0,i=void 0,r=void 0,o=!1){const a=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;g(a,{method:"GET",onComplete(c){const d=JSON.parse(c);let p="",u,m,f;if(t){let _=d.collabspaces.find(h=>h.title===t);if(_){u=t;let h=_.couples;h=h.filter((S,y,w)=>y===w.findIndex(T=>T.organization.pid===S.organization.pid&&T.role.pid===S.role.pid)),n&&(Array.isArray(n)?n.forEach(S=>{f||h.forEach(y=>{if(S===y.role.name&&s===y.organization.title)f=S,m=s;else if(S===y.role.name){let w=h.filter(T=>T.role.name===S);w.length===1?(f=w[0].role.name,m=w[0].organization.title):r(w)}})}):h.forEach(S=>{if(n===S.role.name&&s===S.organization.title)f=n,m=s;else if(n===S.role.name){let y=h.filter(w=>w.role.name===n);y.length===1?(f=y[0].role.name,m=y[0].organization.title):r(y)}}))}}u&&m&&f?(p=f+"."+m+"."+u,i(p)):d.preferredcredentials&&o?(p=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,i(p)):r&&(p=f+"."+m+"."+u,r(p))},onFailure(c,d){console.warn("Erreur de récupération du contexte de sécurité. => ",{err:c,headers:d})}})}async function L(e,t=void 0,n=void 0){return(!e.objID||e.objID==="")&&(console.warn("_3DSpace_download_doc() / Le paramètre objectId est obligatoire"),n&&n("_3DSpace_download_doc() / Le paramètre objectId est obligatoire")),(e.space===""||!e.space)&&(console.warn("_3DSpace_download_doc() / Le paramètre space est obligatoire"),n&&n("_3DSpace_download_doc() / Le paramètre space est obligatoire")),(e.token===""||!e.token)&&K(e,s=>{e.token=s},s=>{console.log("☠️ error => ",s)}),new Promise((s,i)=>{A(e,r=>{e?.returnType==="blob"?(console.log("ticketURL blob",r),fetch(r).then(o=>o.blob()).then(o=>{t&&t(o)}).catch(o=>{n&&n(o)})):g(r,{onComplete(o){let a;try{a=JSON.parse(o)}catch{a=o}t&&typeof t=="function"&&t(a),s(a)},onFailure(o,a,c){n&&(console.log("error http",o),n({msg:JSON.parse(o),headers:a,xhr:c}),i({msg:JSON.parse(o),headers:a,xhr:c}))}})},r=>{n&&n(r),console.log("*_3dspace_download_doc / error file URL *",r),i(r)})})}async function W(e,t,n=void 0,s=void 0){typeof t<"u"&&Array.isArray(t)&&t?.length>0?x({credentials:e,myArray:t,chunk:80,fn_to_call:X},r=>{n&&n(r)}):(console.warn("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."),s&&s("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."))}function X(e,t,n=void 0,s=void 0,i=void 0){const r=[];t.forEach(c=>{r.push({id:c})});let o=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:r});const a=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;g(a,{method:"PUT",data:o,type:"json",onComplete(c){const d=c.data;c.success===!0&&(n&&n(),d.forEach(p=>{try{const u=p.dataelements.fileName,m=p.dataelements.ticketURL;g(m,{onComplete:(f,_)=>{let h;try{h=JSON.parse(f)}catch{h=f.blob()}s&&s({objectId:p.id,headers:_,fileName:u,data:h})},onFailure:f=>{console.log("error http",f)}})}catch(u){console.log(u),i&&i(u)}}))},onFailure(c){console.log(c),i&&i(c)}})}function ke(e,t,n=void 0,s=void 0){return new Promise(i=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t}]}),type:"json",onComplete(a){n&&n(a)},onFailure(a){s&&s(a)}};g(r,o)}})}function ve(e,t,n,s=void 0,i=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;let a={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t,nextState:n}]}),type:"json",onComplete(c){s&&s(c)},onFailure(c){i&&i(c)}};g(o,a)}})}function je(e,t,n=void 0,s=void 0){return new Promise(i=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)});let o={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t}]}),type:"json",onComplete(a){n&&n(a)},onFailure(a){s&&s(a)}};g(r,o)}})}function Pe(e,t,n=void 0,s=void 0){return new Promise(i=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{"attribute[PLMReference.V_versionComment]":null,physicalid:t,type:"Document",tenant:e.tenant,objectId:t,policy:"Document Release",availableSemantic:["E","LAST","NEW","DUP"]}]}),type:"json",onComplete(a){n&&n(a)},onFailure(a){s&&s(a)}};g(r,o)}})}function Le(e,t,n,s=void 0,i=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;F(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let a={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{physicalid:t,proposedRevision:n,modifiedAttributes:{revision:n}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(c){s&&s(c)},onFailure(c){i&&i(c)}};g(o,a)}})}function Me(e,t,n,s,i=void 0,r=void 0){return new Promise(o=>{const a=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let c={attributes:{title:n,description:s,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(c);let p={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx,ENO_CSRF_TOKEN:e.token},data:JSON.stringify(d),type:"json",onComplete(u){i&&i(u)},onFailure(u){r&&r(u)}};g(a,p)})}function Je(e,t,n,s,i=void 0,r=void 0){return console.log("credentials",e),new Promise(o=>{`${e.space}`,JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Workspace",cestamp:"businessobject",relId:t,id:t,dataelements:{personList:n,eventsList:s},tenant:e.tenant}]})})}//!SECTION
3
+ function Ge(e,t=void 0,n=void 0){const s={base:`${e.space}`,uri:"/resources/bps/cspaces",optTenant:`tenant=${e.tenant}`},i=`${s.base}${s.uri}?${s.optTenant}`;g(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","Content-Type":"application/ds-json"},onComplete(r,o){const a=JSON.parse(r);t&&t(a,o)},onFailure(r,o,a){n&&n({response:r,headers:o,xhr:a})}})}function xe(e,t,n,s){A(e.space,t,i=>{g(i,{header:{ENO_CSRF_TOKEN:e.token},onComplete:r=>{n&&n(r)},onFailure:r=>{console.log("error http",r),s&&s(r)}})})}async function Ee(e,t,n=void 0,s=void 0){return new Promise(i=>{A(e,t,r=>{g(r,{onComplete:(o,a,c)=>(i(JSON.parse(o)),n&&n(JSON.parse(o),a,c),i),onFailure:(o,a,c)=>{s&&s(o,a,c),console.log(o,a?.errormsg)}})})})}function Be(e,t,n,s=void 0,i=void 0){const r=new Blob([JSON.stringify(t)],{type:"text/plain"});R(e,n,o=>{const a=o.data[0].relateddata.files[0].id,c=o.data[0].dataelements.secondaryTitle!==""?o.data[0].dataelements.secondaryTitle:o.data[0].dataelements.title;P(e,n,a,r,c,d=>{s&&s(d)},d=>{i&&i(d)})})}let V,Y;const H=[];async function Ke(e,t=void 0,n=void 0){e.objID&&e.objID!==""?R(e,s=>{t&&t(s)},s=>{n&&n(s)}):(e.objID===null||e.objID==="")&&O(e,s=>{t&&t({rep:s,msg:"Pas d'objID, ou invalide"})},s=>{n&&n({msg:"Pas d'objID et erreur sur le Space",err:s})})}async function qe(e,t=void 0,n=void 0){console.log("getDatasByTenant (getDocuments)",e),await L(e,s=>{const i={};i.obj=s,console.log("getDatasByTenant (getDocuments) _datas",i),t&&t?.(i)},s=>{n&&n?.(s)})}function We(e,t=void 0,n=void 0){const s=[];if(!e.objIds&&!Array.isArray(e.objIds)&&e.objIds.length===0){console.warn("la liste est vide ou n'est pas un tableau");return}e.objIds.forEach((i,r)=>{L(e,i.objID,o=>{s.push({[i.name]:o}),i.name==="dbProjets"&&(V=o.affaires.map(a=>a.objectID),z(e,Y)),r===e.objIds.length-1&&(t&&t(s),delete e.objIds,delete e.datas)})})}function z(e,t,n=void 0,s=void 0){W(e,V,i=>{const r=[...t];r.find(o=>o.objectID===i.objectId).data=i.data,Y=r,H.push(i.data),n&&n(H)},i=>{s&&(s(i),console.log(i))})}const Xe="FA35FB9B177A280065800EA0000F599C",Ve=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],Q={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},Ye={objId:Xe,pred:"who",order_by:"desc",tag:"testTag"};function He(e,t,n=void 0,s=void 0){const{space:i,tenant:r}=e,{objId:o,pred:a,tag:c}=t,d={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${r}`},p=`${i}${d.uri}?${d.otpCTX}&${d.optTenant}`,u={tag:[{subject:[{uri:`pid://${o}`}],predicate:Q[a],object:{literal:c}}]};g(p,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(u),onComplete(m){JSON.parse(m);const f={};setTimeout(()=>{j(e,o,_=>{const h=_.data[0].dataelements.title,S=_.data[0].dataelements.fileExtension!==void 0?_.data[0].dataelements.fileExtension:"",y=_.data[0].relateddata.ownerInfo[0].dataelements.name;f.name=h,f.ext=S,f.createBy=y,t.info={...f},ze(e,t,w=>{n&&n(w)},w=>{s&&s(w)})},(_,h)=>{const S=_;S.msg=h.errormsg,S.errCode=h.errorcode,console.log("❌ sendDirectMessage => ",S),s&&s(S)})},2e3)},onFailure(m,f){const _=m;_.msg=f.errormsg,_.errCode=f.errorcode,console.log("❌ sendDirectMessage => ",_),s&&s(_)}})}function ze(e,t,n=void 0,s=void 0){console.log("obj ",t);const i=t.info.name,r={baseUrl:`https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,uri:"/federated/search"},o=`${r.baseUrl}${r.uri}`,a={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},c=J(),d={with_indexing_date:!0,with_synthesis:!0,with_nls:!1,label:`3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${c}`,locale:"fr",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:modified","ds6w:created","ds6wg:revision","ds6w:status","ds6w:responsible","owner","ds6w:responsibleUid","ds6wg:filesize","ds6w:project","ds6w:dataSource","ds6w:community","ds6w:originator","dsgeo:referential","ds6w:lastModifiedBy","ds6w:repository","dcterms:title","dcterms:description","ds6w:containerUid"],with_synthesis_hierarchical:!0,select_file:["icon","thumbnail_2d"],query:i,specific_source_parameter:{"3dspace":{additional_query:' AND NOT (owner:"ENOVIA_CLOUD" OR owner:"Service Creator" OR owner:"Corporate" OR owner:"User Agent" OR owner:"SLMInstallerAdmin" OR owner:"Creator" OR owner:"VPLMAdminUser") AND (ds6w_58_islastrevisionperstate:true OR NOT listoffields:ds6w_58_islastrevisionperstate)'},drive:{additional_query:' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'}},select_exclude_synthesis:["ds6w:what/ds6w:topic"],order_by:Ye.order_by,order_field:"relevance",select_snippets:["ds6w:snippet","ds6w:label:snippet","ds6w:responsible:snippet","ds6w:community:snippet","swym:message_text:snippet"],nresults:40,start:"0",source:Ve,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),g(o,{method:"POST",headers:a,data:JSON.stringify(d),onComplete(p){const u=JSON.parse(p);n(u)},onFailure(p,u){const m=p;m.msg=u.errormsg,m.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",m),s&&s(m),console.log("Erreur de recuperation d'id du doc et des tags",p)}})}function Qe(e,t,n=void 0,s=void 0){const{objId:i,pred:r,tag:o}=t,a={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${e.tenant}`},c=`${e.space}${a.uri}?${a.otpCTX}&${a.optTenant}`,d={tag:[{subject:[{uri:`pid://${i}`}],predicate:Q[r],object:{literal:o}}]};g(c,{method:"DELETE",data:JSON.stringify(d),headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},onComplete(p){n&&n(p)},onFailure(p,u){const m=p;m.msg=u.errormsg,m.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",m),s&&s(m)}})}function Ze(e,t="",n=void 0,s=void 0){const{space:i}=e;if(t==="")return;const r={uri:"/resources/v1/modeler/documents"},o={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json,text/javascript,*/*"},a=`${i}${r.uri}`,c=`$include=none,lockerInfo,ownerInfo,originatorInfo,files,ownerInfo,originatorInfo&$fields=none,title,name,typeNLS,collabSpaceTitle,revision,isLatestRevision,files,lockStatus,lockerInfo.name,lockerInfo.firstname,lockerInfo.lastname,owner,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,stateNLS,modified,policy,state,organizationTitle,originator,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname,hasModifyAccess,fileExtension,files.name,files.title,files.revision,files.locker,ownerInfo,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,originatorInfo,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname&$ids=${t}`;g(a,{method:"POST",headers:o,data:c,onComplete(d){n&&n(JSON.parse(d))},onFailure(d,p){const u=d;u.msg=p.error,s&&s(u)}})}async function C(e,t=void 0,n=void 0){const s=e._3DSwym+"/api/index/tk";return g(s,{onComplete(i,r,o){const a=JSON.parse(i);if(t)return t(a),e.token=a?.result?.ServerToken},onFailure(i){n&&n(i)}})}function et(e,t=void 0,n=void 0){const s=`${e._3DSwym}/api/exalead/whatsnew`,i={params:{community_id:null,hash_key:null,legacyFormat:!1,nresults:1,query:"#all",start:0}};C(e,r=>{g(s,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(o,a){t&&t(o,a)},onFailure(o,a){n&&n(o,a)}})})}function tt(e,t=void 0,n=void 0){const s=`${e._3DSwym}/api/Recommendation/getpeoplefamiliartocurrentuser`,i={params:{idsToFilterArr:[],mode:"offline",limit:30,itemType:"User",maxNbOfCommonElements:"5"}};C(e,r=>{g(s,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(o,a){const c=o.result.hits.map(d=>({login:d.login,fullName:d.name}));t&&t(c,o)},onFailure(o,a){n&&n(o,a)}})})}function nt(e,t=void 0,n=void 0){const s={base:e._3DSwym,uri:"/api/community/listmycommunities",limit:`/limit/${e.limit?e.limit:500}`,page:`/page/${e.page?e.page:"1"}`},i=`${s.base}${s.uri}${s.limit}${s.page}`,r=[];C(e,o=>{g(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(a,c,d){const u=JSON.parse(a).result;let m=0;u.forEach(f=>{const _={description:f.description,id:f.id,title:f.title,owner:f.owner,role:f.role,access:f.access};Z(e,f.id,h=>{m++,_.members=h,r.push(_),m===u.length&&t&&t(r)},h=>n(h))})},onFailure(a,c){const d=a;d.status=c.status,d.response=c.errormsg,n&&n(d)}})})}function Z(e,t,n,s){const i=`${e._3DSwym}/api/community/listmembers`,r={params:{page:e.page?e.page:1,limit:e.limit?e.limit:50,community_id:t}};C(e,o=>{g(i,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},data:JSON.stringify(r),type:"json",onComplete(a,c,d){n&&n(a)},onFailure(a,c){const d=a;d.status=c.status,d.response=c.errormsg,s&&s(d)}})})}function st(e,t=void 0,n=void 0){const s="YXdA5x4DSUKtlAi2wmnyTA";e.commu_id||(e.commu_id=s);const i=`${e._3DSwym}/api/v2/communities/${e.commu_id}/ideas/statuses`;C(e,r=>{g(i,{method:"GET",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const a=JSON.parse(o);t&&t(a)},onFailure(o,a){const c=o;c.status=a.status,c.response=a.errormsg,n&&n(c)}})})}function it(e,t,n=void 0,s=void 0){const{listAllContacts:i,currentUser:r,_3DSwym:o}=e;console.log("__listAllContacts",i.hits);const a=`${o}/api/directmessages`,c={users:[r.login].concat(t.receipt)},d={id_msg:"",senderId:e.currentUser.login,senderName:`${e.currentUser.first_name} ${e.currentUser.last_name}`,msg:at(t.msg)};let p=!1;ee(c.users,u=>{u!==void 0&&(d.id_msg=u.id,p=!0,M(e,d))},u=>{p=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",u),s&&s(u),d.id_msg=""}),p===!1&&setTimeout(()=>{p===!1&&C(e,u=>{g(a,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":u.result.ServerToken},data:JSON.stringify(c),type:"json",onComplete(m,f,_){const h=m;h.reponse=JSON.parse(_.response),h.status=_.status,n&&n(h),d.id_msg=h.result.id,M(e,d)},onFailure(m,f,_){const h=m;h.msg=f.errormsg,h.status=f.status,s&&s(h)}})})},500)}function ee(e,t,n,s){const i=`${e._3DSwym}/api/directmessages/lite?with_favorites=false`;C(e,r=>{g(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const a=JSON.parse(o),c=[];a.result.forEach(u=>{u.users=u.users.sort((m,f)=>m.login.localeCompare(f.login)),u.users.length===t.length&&c.push(u)});const d=t.sort(),p=c.find(u=>{const m=[];return u.users.forEach(f=>{m.push(f.login)}),JSON.stringify(m)===JSON.stringify(d)});n&&p!==void 0?n(p):(s||p===void 0)&&s(p)},onFailure(o){const a=o;a.msg=headers.errormsg,a.errCode=headers.errorcode,console.log("❌ sendDirectMessageLite => ",a),s&&s(a)}})})}function M(e,t,n=void 0,s=void 0){const i={base:e._3DSwym,uri:"/api/community",id_msg:`${t.id_msg}`,endUri:"/instantmessages"},r=`${i.base}${i.uri}/${i.id_msg}${i.endUri}`,o={author:{login:t.senderId,displayName:t.senderName},accessState:null,commentUri:null,comments:null,endorsements:null,moderationState:null,parentCommentUri:null,richMessage:t.msg};console.log("_3dSwym_sendDirectMessageData url ",r),C(e,a=>{g(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},data:JSON.stringify(o),type:"json",onComplete(c,d,p){const u=c;u.status=p.status,u.response=JSON.parse(p.response),console.log("✅ _3dSwym_sendDirectMessageData => ",u),n&&n(u)},onFailure(c,d){const p=c;p.msg=d.errormsg,p.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",p),s&&s(p)}})})}function at(e){const t=new Date().toLocaleDateString(),n=new Date().toLocaleTimeString();return`<p>${e} </p>
4
4
  <br/>
5
5
  <hr/>
6
- <p><u>envoyer :</u>Le <b>${t} à ${s}</b></p>`}function it(e,t,s=void 0,n=void 0){const a=`${e.space}/api/idea/add`,r=e.swymCommunities.find(c=>c.id===t.community_id),o=e.swymCommunities.find(c=>c.title.toLowerCase()===t.community_title.toLowerCase()),i={params:{title:t.title,community_id:r?.id!==void 0?r.id:o.id,message:lt(t.text_html),published:1}};T(e,c=>{const d={"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken};_(a,{method:"POST",headers:d,data:JSON.stringify(i),type:"json",onComplete(l,u,m){const f=JSON.parse(l);f.status=m.status,f.response=m.response,s&&s(f)},onFailure(l,u,m){const f=l;f.status=u.status,f.response=u.errormsg,n&&n(f)}})})}function ot(e,t=void 0,s=void 0){const n={base:e.space,uri:"/api/idea/add"};if(!Array.isArray(e.swymCommunities)){const o="☠️ swymCommunities doit être un tableau d'objets de communautés";throw new Error(`Erreur sur cette requête : ${n.base+n.uri}`,{cause:o})}if(e.swymCommunities.findIndex(o=>o.id===e.community_id)===-1){const o="la communauté n'existe pas dans la liste des communautés du Swym";throw new Error(`Erreur sur cette requête : ${n.base+n.uri}`,{cause:o})}if(e.community_id&&e.community_id===""){const o="☠️ community_id doit être un String qui contient l'id de la communauté dans laquelle on souhaite publier l'idée.";throw new Error(`Erreur sur cette requête : ${n.base+n.uri}`,{cause:o})}if(e.title&&e.title===""){const o="☠️ title doit être un String.";throw new Error(`Erreur sur cette requête : ${n.base+n.uri}`,{cause:o})}const r={params:{title:e.title,community_id:e.community_id,message:e.message,published:1}};T(e,o=>{if(!o)throw new Error(`☠️ token n'est pas disponible pour cette requête : ${n.base+n.uri}`,{cause:o});const i={headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o?.result?.ServerToken},method:"POST",data:JSON.stringify(r),onComplete(c,d,l){const u={response:c};typeof u.response=="string"&&(u.response=JSON.parse(u.response)),u.status=l.status,t&&t(u)},onFailure(c,d,l){const u=JSON.parse(d),m=JSON.parse(c),f=new Error(`Erreur sur cette requête : ${n.base+n.uri}`,{cause:{head:u,rep:m}});s&&s(f)}};_(n.base+n.uri,i)})}function rt(e,t,s=void 0,n=void 0){const a=`${e.space}/api/idea/delete`,r={params:{community_id:t.community_id,ideationIds:[t.idee_id]}};T(e,o=>{_(a,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o?.result?.ServerToken},data:JSON.stringify(r),type:"json",onComplete(i,c,d){s&&s(i)},onFailure(i,c,d){const l=i;l.status=c.status,l.response=c.errormsg,n&&n(l)}})})}function ct(e,t=void 0,s=void 0){const{_3DSwym:n,_3DSwym_token:a}=e,r=`${n}/api/idea/get`;if(e.idPost===""){const i="☠️ idPost est vide, vous devez renseigner un identifiant de post";throw new Error(`Erreur sur cette requête : ${r}`,{cause:i})}const o={params:{id:e.idPost}};_(r,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a},data:JSON.stringify(o),onComplete(i){i=typeof i=="string"?JSON.parse(i):i,t&&t({response:i})},onFailure(i){const c=i;c.status=headers.status,c.response=headers.errormsg,s&&s(c)}})}function dt(e,t,s){const{_3DSwym:n,_3DSwym_token:a,idPost:r,title:o,community_id:i,status_comment:c,status_id:d,message:l}=e,u={base:`${n}`,uri:"/api/idea/edit"},f={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a},data:JSON.stringify({params:{out:"false",id:r,title:o,community_id:i,status_comment:c,status_id:d,message:l,published:"1"}}),type:"json",onComplete(g,h,S){const y={response:typeof g=="string"?JSON.parse(g):g};y.status=S.status,t&&t(y)},onFailure(g){s&&s(g)}};_(u.base+u.uri,f)}function ut(e,t,s=void 0,n=void 0){const{_3DSwym:a}=e;let{community_id:r,limit:o,page:i,search:c}=t;const d=[],l=1;let u=!1,m=2;i||(i=l),o||(o=100);const f={uri:"/api/idea/list",comId:`/community_id/${r}`,limit:`/limit/${o}`,page:`/page/${i}`};let g=`${a}${f.uri}${f.comId}${f.limit}${f.page}`;T(e,h=>{const S=y=>{_(y,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":h.result.ServerToken},onComplete(w){const C={response:JSON.parse(w)};if(m=Math.ceil(Number(C.response.nb_result)/100),w&&m>=i){if(i++,f.page=`/page/${i}`,y=`${a}${f.uri}${f.comId}${f.limit}${f.page}`,!c)d.push(C.response.result);else{const b=C.response.result.find(kt=>kt.title.includes(c));if(b){s(b);return}}if(s&&m<i&&!c){u=!0,s(d);return}S(y)}},onFailure(w,C){const b=w;b.status=C.status,b.response=C.errormsg,n&&n(b)}})};u||S(g)})}function lt(e){return!e||e===""?`<h2><u>INFORMATIONS AFFAIRE :</u></h2>
6
+ <p><u>envoyer :</u>Le <b>${t} à ${n}</b></p>`}function ot(e,t,n=void 0,s=void 0){const i=`${e.space}/api/idea/add`,r=e.swymCommunities.find(c=>c.id===t.community_id),o=e.swymCommunities.find(c=>c.title.toLowerCase()===t.community_title.toLowerCase()),a={params:{title:t.title,community_id:r?.id!==void 0?r.id:o.id,message:pt(t.text_html),published:1}};C(e,c=>{const d={"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken};g(i,{method:"POST",headers:d,data:JSON.stringify(a),type:"json",onComplete(p,u,m){const f=JSON.parse(p);f.status=m.status,f.response=m.response,n&&n(f)},onFailure(p,u,m){const f=p;f.status=u.status,f.response=u.errormsg,s&&s(f)}})})}function rt(e,t=void 0,n=void 0){const s={base:e.space,uri:"/api/idea/add"};if(!Array.isArray(e.swymCommunities)){const o="☠️ swymCommunities doit être un tableau d'objets de communautés";throw new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:o})}if(e.swymCommunities.findIndex(o=>o.id===e.community_id)===-1){const o="la communauté n'existe pas dans la liste des communautés du Swym";throw new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:o})}if(e.community_id&&e.community_id===""){const o="☠️ community_id doit être un String qui contient l'id de la communauté dans laquelle on souhaite publier l'idée.";throw new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:o})}if(e.title&&e.title===""){const o="☠️ title doit être un String.";throw new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:o})}const r={params:{title:e.title,community_id:e.community_id,message:e.message,published:1}};C(e,o=>{if(!o)throw new Error(`☠️ token n'est pas disponible pour cette requête : ${s.base+s.uri}`,{cause:o});const a={headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o?.result?.ServerToken},method:"POST",data:JSON.stringify(r),onComplete(c,d,p){const u={response:c};typeof u.response=="string"&&(u.response=JSON.parse(u.response)),u.status=p.status,t&&t(u)},onFailure(c,d,p){const u=JSON.parse(d),m=JSON.parse(c),f=new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:{head:u,rep:m}});n&&n(f)}};g(s.base+s.uri,a)})}function ct(e,t,n=void 0,s=void 0){const i=`${e.space}/api/idea/delete`,r={params:{community_id:t.community_id,ideationIds:[t.idee_id]}};C(e,o=>{g(i,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o?.result?.ServerToken},data:JSON.stringify(r),type:"json",onComplete(a,c,d){n&&n(a)},onFailure(a,c,d){const p=a;p.status=c.status,p.response=c.errormsg,s&&s(p)}})})}function dt(e,t=void 0,n=void 0){const{_3DSwym:s,_3DSwym_token:i}=e,r=`${s}/api/idea/get`;if(e.idPost===""){const a="☠️ idPost est vide, vous devez renseigner un identifiant de post";throw new Error(`Erreur sur cette requête : ${r}`,{cause:a})}const o={params:{id:e.idPost}};g(r,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i},data:JSON.stringify(o),onComplete(a){a=typeof a=="string"?JSON.parse(a):a,t&&t({response:a})},onFailure(a){const c=a;c.status=headers.status,c.response=headers.errormsg,n&&n(c)}})}function ut(e,t,n){const{_3DSwym:s,_3DSwym_token:i,idPost:r,title:o,community_id:a,status_comment:c,status_id:d,message:p}=e,u={base:`${s}`,uri:"/api/idea/edit"},f={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i},data:JSON.stringify({params:{out:"false",id:r,title:o,community_id:a,status_comment:c,status_id:d,message:p,published:"1"}}),type:"json",onComplete(_,h,S){const y={response:typeof _=="string"?JSON.parse(_):_};y.status=S.status,t&&t(y)},onFailure(_){n&&n(_)}};g(u.base+u.uri,f)}function lt(e,t,n=void 0,s=void 0){const{_3DSwym:i}=e;let{community_id:r,limit:o,page:a,search:c}=t;const d=[],p=1;let u=!1,m=2;a||(a=p),o||(o=100);const f={uri:"/api/idea/list",comId:`/community_id/${r}`,limit:`/limit/${o}`,page:`/page/${a}`};let _=`${i}${f.uri}${f.comId}${f.limit}${f.page}`;C(e,h=>{const S=y=>{g(y,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":h.result.ServerToken},onComplete(w){const T={response:JSON.parse(w)};if(m=Math.ceil(Number(T.response.nb_result)/100),w&&m>=a){if(a++,f.page=`/page/${a}`,y=`${i}${f.uri}${f.comId}${f.limit}${f.page}`,!c)d.push(T.response.result);else{const b=T.response.result.find(vt=>vt.title.includes(c));if(b){n(b);return}}if(n&&m<a&&!c){u=!0,n(d);return}S(y)}},onFailure(w,T){const b=w;b.status=T.status,b.response=T.errormsg,s&&s(b)}})};u||S(_)})}function pt(e){return!e||e===""?`<h2><u>INFORMATIONS AFFAIRE :</u></h2>
7
7
  <p><u>|⚠️<em> Merci de respecter l&#39;écriture des tags, en MAJUSCULES, nom complet, pas de caractères</em></u></p>
8
8
  <p><u><em>|spéciaux, séparation par &#34;_&#34; si besoin !</em></u></p>
9
9
  <p><strong>Référence client </strong>: <em>
@@ -75,7 +75,7 @@ function Je(e,t=void 0,s=void 0){const n={base:`${e.space}`,uri:"/resources/bps/
75
75
  <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
76
76
  </tbody></table>
77
77
  <p>
78
- </p>`:e}function pt(e,t=void 0,s=void 0){const{tenant:n,_3DSwym:a,_3DSwym_token:r,community_id:o,idea_id:i}=e;if(n&&a&&r&&o&&i){const c=`${a}/api/idea/forward`;_(c,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r},data:JSON.stringify({community_uri:`swym:prd:${n.toUpperCase()}:community:${o}`,content_uri:`swym:prd:${n.toUpperCase()}:idea:${i}`,timeout:3e4}),type:"json",onComplete(d){t&&t(d)},onFailure(d,l){const u=d;u.status=l.status,u.response=l.errormsg,s&&s(u)}})}else s&&s({status:"error",msg:"Credentials incomplet !",attend:"tenant, _3DSwym , _3DSwym_token, community_id, idea_id",credentials:e})}function ft(e,t=void 0,s=void 0){return new Promise((n,a)=>{try{let r;if(e._3DDashboard){const o=e._3DDashboard+"/api/users/current";console.log("_3DSwym_get_currentUser | url",o),_(o,{method:"GET",onComplete(i,c,d){let l=i.replace('"[',"[").replace(']"',"]").replace('"{',"{").replace('}"',"}").replace(/\\/g,"");l=l.replace('"[',"[").replace(']"',"]").replace('"{',"{").replace('}"',"}").replace(/\\/g,""),console.log("result",l);let u={};try{u=JSON.parse(l)}catch(m){a("ERROR | _3DSwym_get_currentUser => JSON.Parse()",m)}console.log(u),u.first_name=u?.firstName?u.firstName:"",u.last_name=u?.lastName?u.lastName:"",console.log("_3DSwym_get_currentUser | info",u),r=u,n(u)},onFailure(i){a("ERROR | _3DSwym_get_currentUser => _3DDashboard + /api/users/current",i)}})}r?n(r):a("ERROR | _3DSwym_get_currentUser => CURRENT_USER is null")}catch(r){a("ERROR | _3DSwym_get_currentUser => ",r)}})}function mt(e,t,s=void 0,n=void 0){const a=e.space+"/api/user/find/login/"+t;T(e,r=>{_(a,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o,i,c){const d=JSON.parse(o);s&&s(d)},onFailure(o){n&&n(o)}})},n)}function _t(e,t=void 0,s=void 0){const{_3DSwym:n,_3DSwym_token:a,subjectUri:r,richMessage:o}=e,i=`${n}/commentproxy/subjects/${r}/comments`,d={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a},data:JSON.stringify({richMessage:o}),type:"json",onComplete(l,u,m){const f={response:typeof l=="string"?JSON.parse(l):l};f.status=m.status,t&&t(f)},onFailure(l){s&&s(l)}};_(i,d)}function gt(e,t=void 0,s=void 0){e.tenant&&k(e,n=>{const a=n.services.find(r=>r.id==="businessprocess")?.url+"/api/v2";return t&&t(a),a})}function ht(e,t=void 0,s=void 0){e.tenant&&k(e,n=>{const a=n.services.find(i=>i.id==="3dpassport")?.url,r=n.services.find(i=>i.id==="businessprocess")?.url+"/api/v2",o=`${a}/login/?service=${r}/auth/cas`;_(o,{async onComplete(i){const c=typeof i=="string"?JSON.parse(i)?.x3ds_service_redirect_url:i?.x3ds_service_redirect_url;await fetch(c,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(i){s&&s(i)}})})}function St(e,t=void 0,s=void 0){if(e.tenant){const n=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${n}/iterop/jwtuser`,{method:"POST"}).then(a=>a.json()).then(a=>{t&&t(a)}).catch(a=>{s&&s(a)})}}async function yt(e,t,s=void 0,n=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/repository/data/tables?t=${t}`,{method:"GET"}).then(r=>r.json()).then(r=>{s&&s(r)}).catch(r=>{n&&n(r)})}}async function wt(e,t,s,n=void 0,a=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/businesstable/one/${s}?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{n&&n(o)}).catch(o=>{a&&a(o)})}}async function Tt(e,t,s,n=void 0,a=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/businesstable/rows/${s}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{n&&n(o)}).catch(o=>{a&&a(o)})}}async function Ct(e,t,s,n,a=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/businesstable/patch/rows/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(i=>i.json()).then(i=>{a&&a(i)}).catch(i=>{r&&r(i,s,n)})}}async function bt(e,t,s,n,a,r=void 0,o=void 0){if(e.tenant){const i=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/search/rows/${s}?t=${t}&c=${encodeURIComponent(n)}&b=${encodeURIComponent(a)}`;fetch(i,{method:"POST"}).then(c=>c.json()).then(c=>{c.url=i,r&&r(c)}).catch(c=>{o&&o({error:c,tableId:s,columns:n,body:a})})}}async function Ot(e,t,s,n,a=void 0,r=void 0){if(e.tenant){const o=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/update/${s}?t=${t}&b=${encodeURIComponent(n)}`;fetch(o,{method:"POST"}).then(i=>i.json()).then(i=>{a&&a(i)}).catch(i=>{r&&r({error:i,url:o})})}}async function Dt(e,t,s,n=void 0,a=void 0){if(e.tenant){const r=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/create/?t=${t}&b=${encodeURIComponent(s)}`;fetch(r,{method:"POST"}).then(o=>o.json()).then(o=>{n&&n(o)}).catch(o=>{a&&a({error:o,url:r})})}}async function $t(e,t,s,n,a=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/runtime/processes/${s}?t=${t}&b=${n}`,{method:"POST"}).then(i=>i.json()).then(i=>{console.log("_Iterop_runProcess : OK"),a&&a(i)}).catch(i=>{r&&r(i)})}}async function It(e,t,s,n=void 0,a=void 0){if(console.log("_Iterop_GetOneDependencyTable | Run"),e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/dependencytable/one/${s}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{n&&n(o)}).catch(o=>{a&&a(o)})}}async function Nt(e,t,s,n,a,r=void 0,o=void 0){if(e.tenant){const i=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${i}/iterop/dependencytable/patch/${s}/?t=${t}&cli=${n}&b=${a}`,{method:"POST"}).then(c=>c.json()).then(c=>{r&&r(c)}).catch(c=>{o&&o(c)})}}async function Ut(e,t,s,n,a=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/dependencytable/put/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(i=>i.json()).then(i=>{a&&a(i)}).catch(i=>{r&&r(i)})}}//!SECTION
79
- async function Rt(e,t,s,n=void 0,a=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/list/one/${s}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{n&&n(o)}).catch(o=>{a&&a(o)})}}//!SECTION
80
- function Ft(e){const t="Hello "+e;return console.log(t),t}function At(e,t=void 0,s=void 0){return console.log("credentials",e),new Promise(n=>{if(e.token===""&&O(e),!e.space||e.space===""){const o=E();console.log("platformeInfo",o)}F(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)},!0);const a=$.DateTime.now().ts,r=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;_(r,{onComplete(o){if(Array.isArray(JSON.parse(o))){const i=JSON.parse(o);console.log("serviceId=3dsearch",i);const c=`${i[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;_(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({with_indexing_date:!0,with_nls:!1,label:`3DSearch-${a}`,locale:"en",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:responsible","ds6wg:fullname"],select_file:["icon","thumbnail_2d"],query:'([ds6w:type]:(Group) AND [ds6w:status]:(Public)) OR (flattenedtaxonomies:"types/Person" AND current:"active")',order_by:"desc",order_field:"relevance",nresults:1e3,start:"0",source:["3dspace","usersgroup"],tenant:e.tenant,login:{"3dspace":{SecurityContext:`ctx::${e.ctx}`}}}),type:"json",onComplete(d){t&&t(d)},onFailure(d){s&&s(d)}})}},onFailure(o){s&&s(o)}})})}p.UUID=J,p._3DSearch_usersGroup=At,p._3DSpace_Create_Doc=Ne,p._3DSpace_Update_Doc=Ie,p._3DSpace_bookmark_addSubsciptions=Me,p._3DSpace_bookmark_newWorkspace=Le,p._3DSpace_csrf=O,p._3DSpace_download_doc=L,p._3DSpace_download_multidoc=W,p._3DSpace_file_update=P,p._3DSpace_file_update_csr=q,p._3DSpace_file_url_csr=De,p._3DSpace_get_csrf=R,p._3DSpace_get_docInfo=v,p._3DSpace_get_downloadTicket_multidoc=X,p._3DSpace_get_multiDocInfo=Oe,p._3DSpace_get_securityContexts=F,p._3DSpace_get_ticket=A,p._3DSpace_lifecycle_changeRevision=Pe,p._3DSpace_lifecycle_changeState=ke,p._3DSpace_lifecycle_getGraph=je,p._3DSpace_lifecycle_getNextRevision=ve,p._3DSpace_lifecycle_getNextStates=Ae,p._3DSpace_put_docInfo=$e,p._3DSwym_ForwardIdea=pt,p._3DSwym_addComment=_t,p._3DSwym_buildDirectMessage=st,p._3DSwym_deleteIdea=rt,p._3DSwym_editIdea=dt,p._3DSwym_findCommunityToInstantMSG=ee,p._3DSwym_getAllCommunities=tt,p._3DSwym_getAllListIdeas=ut,p._3DSwym_getAllNews=Ze,p._3DSwym_getFamiliarPeople=et,p._3DSwym_getIdeaStatusMaturity=nt,p._3DSwym_getMembersCommunity=Z,p._3DSwym_getOneIdea=ct,p._3DSwym_get_Token=T,p._3DSwym_get_currentUser=ft,p._3DSwym_get_findUser=mt,p._3DSwym_postIdea=ot,p._3DSwym_postIdeaTemplate=it,p._3DSwym_sendMessageData=M,p._AppMngt_get_info_user=fe,p._AppMngt_get_users=pe,p._Iterop_AddOrRemoveRows=Ct,p._Iterop_Auth_CAS=ht,p._Iterop_GetOneDependencyTable=It,p._Iterop_GetOneList=Rt,p._Iterop_PatchDependencyTable=Nt,p._Iterop_PutDependencyTable=Ut,p._Iterop_businessTableSearchInRows=bt,p._Iterop_createBusinessTable=Dt,p._Iterop_getAllBusinessTables=yt,p._Iterop_getOneBusinessTable=wt,p._Iterop_getOneBusinessTableRows=Tt,p._Iterop_jwtUser=St,p._Iterop_runProcess=$t,p._Iterop_updateBusinessTable=Ot,p._getPlateformInfos=E,p._getPlatformServices=de,p._getServiceUrl=k,p._getServiceUrl_3DPassport=ue,p._getServiceUrl_Iterop=gt,p._httpCallAuthenticated=_,p._setDraggable=oe,p._setDroppable=ce,p._setupTagger=re,p.addTagToDoc=Ye,p.chunkArray=x,p.compass_getListAdditionalApps=le,p.couleurs=G,p.createUserGroups=me,p.dataMixing=z,p.deleteUserGroups=he,p.findAdresse=ne,p.getAllContextSecurity=Je,p.getCSRFToken=K,p.getCommunes=te,p.getComplementUG=_e,p.getDataFrom3DSpace=Ge,p.getDataFromGouvFr=se,p.getDatasByTenant=Ke,p.getDatasFrom3DSpace=qe,p.getDownloadDocument=xe,p.getInfoDocTags=Qe,p.getUserGroupsList=ge,p.getUsersGroupRules=B,p.get_3DSpace_csrf=Be,p.patchUserGroups=Se,p.patchUserGroupsControl=ye,p.pushDataIn3DSpace=Ee,p.readUserGroupControl=we,p.removeTagToDoc=ze,p.sayHello=Ft,p.updateEvent=ie,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
78
+ </p>`:e}function ft(e,t=void 0,n=void 0){const{tenant:s,_3DSwym:i,_3DSwym_token:r,community_id:o,idea_id:a}=e;if(s&&i&&r&&o&&a){const c=`${i}/api/idea/forward`;g(c,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r},data:JSON.stringify({community_uri:`swym:prd:${s.toUpperCase()}:community:${o}`,content_uri:`swym:prd:${s.toUpperCase()}:idea:${a}`,timeout:3e4}),type:"json",onComplete(d){t&&t(d)},onFailure(d,p){const u=d;u.status=p.status,u.response=p.errormsg,n&&n(u)}})}else n&&n({status:"error",msg:"Credentials incomplet !",attend:"tenant, _3DSwym , _3DSwym_token, community_id, idea_id",credentials:e})}function mt(e,t=void 0,n=void 0){return new Promise((s,i)=>{try{let r;if(e._3DDashboard){const o=e._3DDashboard+"/api/users/current";console.log("_3DSwym_get_currentUser | url",o),g(o,{method:"GET",onComplete(a,c,d){let p=a.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,"");p=p.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,""),console.log("result",p);let u={};try{u=JSON.parse(p)}catch(m){i("ERROR | _3DSwym_get_currentUser => JSON.Parse()",m)}console.log(u),u.first_name=u?.firstName?u.firstName:"",u.last_name=u?.lastName?u.lastName:"",console.log("_3DSwym_get_currentUser | info",u),r=u,s(u)},onFailure(a){i("ERROR | _3DSwym_get_currentUser => _3DDashboard + /api/users/current",a)}})}r?s(r):i("ERROR | _3DSwym_get_currentUser => CURRENT_USER is null")}catch(r){i("ERROR | _3DSwym_get_currentUser => ",r)}})}function gt(e,t,n=void 0,s=void 0){const i=e.space+"/api/user/find/login/"+t;C(e,r=>{g(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o,a,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})},s)}function _t(e,t=void 0,n=void 0){const{_3DSwym:s,_3DSwym_token:i,subjectUri:r,richMessage:o}=e,a=`${s}/commentproxy/subjects/${r}/comments`,d={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i},data:JSON.stringify({richMessage:o}),type:"json",onComplete(p,u,m){const f={response:typeof p=="string"?JSON.parse(p):p};f.status=m.status,t&&t(f)},onFailure(p){n&&n(p)}};g(a,d)}function ht(e,t=void 0,n=void 0){e.tenant&&k(e,s=>{const i=s.services.find(r=>r.id==="businessprocess")?.url+"/api/v2";return t&&t(i),i})}function St(e,t=void 0,n=void 0){e.tenant&&k(e,s=>{const i=s.services.find(a=>a.id==="3dpassport")?.url,r=s.services.find(a=>a.id==="businessprocess")?.url+"/api/v2",o=`${i}/login/?service=${r}/auth/cas`;g(o,{async onComplete(a){const c=typeof a=="string"?JSON.parse(a)?.x3ds_service_redirect_url:a?.x3ds_service_redirect_url;await fetch(c,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(a){n&&n(a)}})})}function yt(e,t=void 0,n=void 0){if(e.tenant){const s=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${s}/iterop/jwtuser`,{method:"POST"}).then(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{n&&n(i)})}}async function wt(e,t,n=void 0,s=void 0){if(e.tenant){const i=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${i}/iterop/repository/data/tables?t=${t}`,{method:"GET"}).then(r=>r.json()).then(r=>{n&&n(r)}).catch(r=>{s&&s(r)})}}async function Ct(e,t,n,s=void 0,i=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/businesstable/one/${n}?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{s&&s(o)}).catch(o=>{i&&i(o)})}}async function Tt(e,t,n,s=void 0,i=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/businesstable/rows/${n}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{s&&s(o)}).catch(o=>{i&&i(o)})}}async function bt(e,t,n,s,i=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/businesstable/patch/rows/${n}/?t=${t}&b=${s}`,{method:"POST"}).then(a=>a.json()).then(a=>{i&&i(a)}).catch(a=>{r&&r(a,n,s)})}}async function Ot(e,t,n,s,i,r=void 0,o=void 0){if(e.tenant){const a=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/search/rows/${n}?t=${t}&c=${encodeURIComponent(s)}&b=${encodeURIComponent(i)}`;fetch(a,{method:"POST"}).then(c=>c.json()).then(c=>{c.url=a,r&&r(c)}).catch(c=>{o&&o({error:c,tableId:n,columns:s,body:i})})}}async function Dt(e,t,n,s,i=void 0,r=void 0){if(e.tenant){const o=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/update/${n}?t=${t}&b=${encodeURIComponent(s)}`;fetch(o,{method:"POST"}).then(a=>a.json()).then(a=>{i&&i(a)}).catch(a=>{r&&r({error:a,url:o})})}}async function $t(e,t,n,s=void 0,i=void 0){if(e.tenant){const r=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/create/?t=${t}&b=${encodeURIComponent(n)}`;fetch(r,{method:"POST"}).then(o=>o.json()).then(o=>{s&&s(o)}).catch(o=>{i&&i({error:o,url:r})})}}async function It(e,t,n,s,i=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/runtime/processes/${n}?t=${t}&b=${s}`,{method:"POST"}).then(a=>a.json()).then(a=>{console.log("_Iterop_runProcess : OK"),i&&i(a)}).catch(a=>{r&&r(a)})}}async function Nt(e,t,n,s=void 0,i=void 0){if(console.log("_Iterop_GetOneDependencyTable | Run"),e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/dependencytable/one/${n}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{s&&s(o)}).catch(o=>{i&&i(o)})}}async function Ut(e,t,n,s,i,r=void 0,o=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/dependencytable/patch/${n}/?t=${t}&cli=${s}&b=${i}`,{method:"POST"}).then(c=>c.json()).then(c=>{r&&r(c)}).catch(c=>{o&&o(c)})}}async function Rt(e,t,n,s,i=void 0,r=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/dependencytable/put/${n}/?t=${t}&b=${s}`,{method:"POST"}).then(a=>a.json()).then(a=>{i&&i(a)}).catch(a=>{r&&r(a)})}}//!SECTION
79
+ async function Ft(e,t,n,s=void 0,i=void 0){if(e.tenant){const r=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${r}/iterop/list/one/${n}/?t=${t}`,{method:"POST"}).then(o=>o.json()).then(o=>{s&&s(o)}).catch(o=>{i&&i(o)})}}//!SECTION
80
+ function At(e){const t="Hello "+e;return console.log(t),t}function kt(e,t=void 0,n=void 0){return console.log("credentials",e),new Promise(s=>{if(e.token===""&&O(e),!e.space||e.space===""){const o=E();console.log("platformeInfo",o)}F(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)},!0);const i=$.DateTime.now().ts,r=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;g(r,{onComplete(o){if(Array.isArray(JSON.parse(o))){const a=JSON.parse(o);console.log("serviceId=3dsearch",a);const c=`${a[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;g(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({with_indexing_date:!0,with_nls:!1,label:`3DSearch-${i}`,locale:"en",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:responsible","ds6wg:fullname"],select_file:["icon","thumbnail_2d"],query:'([ds6w:type]:(Group) AND [ds6w:status]:(Public)) OR (flattenedtaxonomies:"types/Person" AND current:"active")',order_by:"desc",order_field:"relevance",nresults:1e3,start:"0",source:["3dspace","usersgroup"],tenant:e.tenant,login:{"3dspace":{SecurityContext:`ctx::${e.ctx}`}}}),type:"json",onComplete(d){t&&t(d)},onFailure(d){n&&n(d)}})}},onFailure(o){n&&n(o)}})})}l.UUID=J,l._3DSearch_usersGroup=kt,l._3DSpace_Create_Doc=Ue,l._3DSpace_Update_Doc=Ne,l._3DSpace_bookmark_addSubsciptions=Je,l._3DSpace_bookmark_newWorkspace=Me,l._3DSpace_csrf=O,l._3DSpace_download_doc=L,l._3DSpace_download_multidoc=W,l._3DSpace_file_update=P,l._3DSpace_file_update_csr=q,l._3DSpace_file_url_csr=$e,l._3DSpace_get_csrf=R,l._3DSpace_get_docInfo=j,l._3DSpace_get_downloadTicket_multidoc=X,l._3DSpace_get_multiDocInfo=De,l._3DSpace_get_securityContexts=F,l._3DSpace_get_ticket=A,l._3DSpace_lifecycle_changeRevision=Le,l._3DSpace_lifecycle_changeState=ve,l._3DSpace_lifecycle_getGraph=je,l._3DSpace_lifecycle_getNextRevision=Pe,l._3DSpace_lifecycle_getNextStates=ke,l._3DSpace_put_docInfo=Ie,l._3DSwym_ForwardIdea=ft,l._3DSwym_addComment=_t,l._3DSwym_buildDirectMessage=it,l._3DSwym_deleteIdea=ct,l._3DSwym_editIdea=ut,l._3DSwym_findCommunityToInstantMSG=ee,l._3DSwym_getAllCommunities=nt,l._3DSwym_getAllListIdeas=lt,l._3DSwym_getAllNews=et,l._3DSwym_getFamiliarPeople=tt,l._3DSwym_getIdeaStatusMaturity=st,l._3DSwym_getMembersCommunity=Z,l._3DSwym_getOneIdea=dt,l._3DSwym_get_Token=C,l._3DSwym_get_currentUser=mt,l._3DSwym_get_findUser=gt,l._3DSwym_postIdea=rt,l._3DSwym_postIdeaTemplate=ot,l._3DSwym_sendMessageData=M,l._AppMngt_get_info_user=me,l._AppMngt_get_users=fe,l._Iterop_AddOrRemoveRows=bt,l._Iterop_Auth_CAS=St,l._Iterop_GetOneDependencyTable=Nt,l._Iterop_GetOneList=Ft,l._Iterop_PatchDependencyTable=Ut,l._Iterop_PutDependencyTable=Rt,l._Iterop_businessTableSearchInRows=Ot,l._Iterop_createBusinessTable=$t,l._Iterop_getAllBusinessTables=wt,l._Iterop_getOneBusinessTable=Ct,l._Iterop_getOneBusinessTableRows=Tt,l._Iterop_jwtUser=yt,l._Iterop_runProcess=It,l._Iterop_updateBusinessTable=Dt,l._getMe=ue,l._getPlateformInfos=E,l._getPlatformServices=de,l._getServiceUrl=k,l._getServiceUrl_3DPassport=le,l._getServiceUrl_Iterop=ht,l._httpCallAuthenticated=g,l._setDraggable=oe,l._setDroppable=ce,l._setupTagger=re,l.addTagToDoc=He,l.chunkArray=x,l.compass_getListAdditionalApps=pe,l.couleurs=G,l.createUserGroups=ge,l.dataMixing=z,l.deleteUserGroups=Se,l.findAdresse=ne,l.getAllContextSecurity=Ge,l.getCSRFToken=K,l.getCommunes=te,l.getComplementUG=_e,l.getDataFrom3DSpace=xe,l.getDataFromGouvFr=se,l.getDatasByTenant=qe,l.getDatasFrom3DSpace=We,l.getDownloadDocument=Ee,l.getInfoDocTags=Ze,l.getUserGroupsList=he,l.getUsersGroupRules=B,l.get_3DSpace_csrf=Ke,l.patchUserGroups=ye,l.patchUserGroupsControl=we,l.pushDataIn3DSpace=Be,l.readUserGroupControl=Ce,l.removeTagToDoc=Qe,l.sayHello=At,l.updateEvent=ae,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
81
81
  //# sourceMappingURL=wb3Api.umd.cjs.map