(function(u,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):(u=typeof globalThis<"u"?globalThis:u||self,I(u["@beam3_dev/api_module"]={},u.uuid,u.luxon,u["@widget-lab/3ddashboard-utils"]))})(this,function(u,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(l=>l.start===$.DateTime.fromISO(c.date).toISODate()&&l.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{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{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 v(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 ue(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 le(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(l=>{const p=l.attributes.name,m=l.id;return{name:p,id:m}});t&&t(d,c)},onFailure(r,o){const a=r;a.msg=o.errormsg,a.errCode=o.errorcode,n&&n(a)}})}function pe(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 fe(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 U={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function me(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:U,data:JSON.stringify(c),onComplete(d){n&&n(JSON.parse(d))},onFailure(d,l){console.log(d);const p=d;p.msg=l.errormsg,p.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",p),s&&s(p)}})}function ge(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 K(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(l){t&&t(JSON.parse(l))},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,n&&n(m)}})}function _e(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(l){const p=JSON.parse(l),m={},f=p.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,K(e,y=>{m.rules=y,t&&t(m)},y=>{n&&n(y)})}},onFailure(l){n&&n(l)}})}catch(l){console.log(l)}}function he(e,t){const{space:n}=e,i=`${n}/3drdfpersist/resources/v1/usersgroup/${t}`;g(i,{method:"DELETE"})}function Se(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}`,l=JSON.stringify(c);g(d,{headers:U,method:"PATCH",data:l,type:"json",onComplete(p){s&&s(p)},onFailure(p){i&&i(p)}})}function ye(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:U,data:JSON.stringify(n),type:"json",onComplete(d){s&&s(d)},onFailure(d){i&&i(d)}})}function we(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 B(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 Ce=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=0?(p=d.substr(0,l),m=d.substr(l+1)):(p=d,m=""),f=decodeURIComponent(p),_=decodeURIComponent(m),Te(i,f)?Array.isArray(i[f])?i[f].push(_):i[f]=[i[f],_]:i[f]=_}return i},A=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,n,s){return t=t||"&",n=n||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(i){var r=encodeURIComponent(A(i))+n;return Array.isArray(e[i])?e[i].map(function(o){return r+encodeURIComponent(A(o))}).join(t):r+encodeURIComponent(A(e[i]))}).filter(Boolean).join(t):s?encodeURIComponent(A(s))+n+encodeURIComponent(A(e)):""};N.decode=N.parse=Ce,N.encode=N.stringify=be;async function R(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 Oe(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 l=JSON.parse(a);n&&n(l)},onFailure(a){s&&s(a)}})}function F(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 j(e,t=void 0,n=void 0){let s=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;F(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 De(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():F(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,l,p){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)}},C=e.tenant.toUpperCase();g(e.space+`/resources/v1/modeler/documents/?$include=versions&tenant=${C}&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 $e(e,t,n,s=void 0,i=void 0){e.space,e.token,e.ctx,R(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 Ie(e,t,n,s,i=void 0,r=void 0){Ne(e,o=>{console.log("resultCheckinTicket",n,o),o?.items>=1&&o.data.forEach(a=>{Ae(a,t,n,c=>{console.log("receipt",n,c),Fe(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 Ne(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 Ae(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 Fe(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} `}}]},tempId:a}]}),onComplete(d){try{d=JSON.parse(d)}catch{}i&&i(d)},onFailure(d){r&&r(d)}})}function k(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 l="",p,m,f;if(t){let _=d.collabspaces.find(h=>h.title===t);if(_){p=t;let h=_.couples;h=h.filter((S,y,w)=>y===w.findIndex(C=>C.organization.pid===S.organization.pid&&C.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(C=>C.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)}}))}}p&&m&&f?(l=f+"."+m+"."+p,i(l)):d.preferredcredentials&&o?(l=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,i(l)):r&&(l=f+"."+m+"."+p,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,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)&&B(e,s=>{e.token=s},s=>{console.log("☠️ error => ",s)}),new Promise((s,i)=>{j(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(l=>{try{const p=l.dataelements.fileName,m=l.dataelements.ticketURL;g(m,{onComplete:(f,_)=>{let h;try{h=JSON.parse(f)}catch{h=f.blob()}s&&s({objectId:l.id,headers:_,fileName:p,data:h})},onFailure:f=>{console.log("error http",f)}})}catch(p){console.log(p),i&&i(p)}}))},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 je(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 ve(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}`;k(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 Ue(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}`;k(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 Re(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}`;k(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 Pe(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 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(p){i&&i(p)},onFailure(p){r&&r(p)}};g(a,l)})}function Le(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 function Me(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 Je(e,t,n,s){j(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 Ge(e,t,n=void 0,s=void 0){return new Promise(i=>{j(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 xe(e,t,n,s=void 0,i=void 0){const r=new Blob([JSON.stringify(t)],{type:"text/plain"});F(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 Ee(e,t=void 0,n=void 0){e.objID&&e.objID!==""?F(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 Ke(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 Be(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 qe="FA35FB9B177A280065800EA0000F599C",We=["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"},Xe={objId:qe,pred:"who",order_by:"desc",tag:"testTag"};function Ve(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}`},l=`${i}${d.uri}?${d.otpCTX}&${d.optTenant}`,p={tag:[{subject:[{uri:`pid://${o}`}],predicate:Q[a],object:{literal:c}}]};g(l,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(p),onComplete(m){JSON.parse(m);const f={};setTimeout(()=>{R(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},Ye(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 Ye(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:Xe.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:We,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),g(o,{method:"POST",headers:a,data:JSON.stringify(d),onComplete(l){const p=JSON.parse(l);n(p)},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",m),s&&s(m),console.log("Erreur de recuperation d'id du doc et des tags",l)}})}function He(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(l){n&&n(l)},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.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,l){const p=d;p.msg=l.error,s&&s(p)}})}async function T(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 Qe(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}};T(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 Ze(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"}};T(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 et(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=[];T(e,o=>{g(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(a,c,d){const p=JSON.parse(a).result;let m=0;p.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===p.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}};T(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 tt(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`;T(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 nt(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:st(t.msg)};let l=!1;ee(c.users,p=>{p!==void 0&&(d.id_msg=p.id,l=!0,M(e,d))},p=>{l=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",p),s&&s(p),d.id_msg=""}),l===!1&&setTimeout(()=>{l===!1&&T(e,p=>{g(a,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":p.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`;T(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(p=>{p.users=p.users.sort((m,f)=>m.login.localeCompare(f.login)),p.users.length===t.length&&c.push(p)});const d=t.sort(),l=c.find(p=>{const m=[];return p.users.forEach(f=>{m.push(f.login)}),JSON.stringify(m)===JSON.stringify(d)});n&&l!==void 0?n(l):(s||l===void 0)&&s(l)},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),T(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,l){const p=c;p.status=l.status,p.response=JSON.parse(l.response),console.log("✅ _3dSwym_sendDirectMessageData => ",p),n&&n(p)},onFailure(c,d){const l=c;l.msg=d.errormsg,l.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",l),s&&s(l)}})})}function st(e){const t=new Date().toLocaleDateString(),n=new Date().toLocaleTimeString();return`

${e}



envoyer :Le ${t} à ${n}

`}function it(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:ut(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};g(i,{method:"POST",headers:d,data:JSON.stringify(a),type:"json",onComplete(l,p,m){const f=JSON.parse(l);f.status=m.status,f.response=m.response,n&&n(f)},onFailure(l,p,m){const f=l;f.status=p.status,f.response=p.errormsg,s&&s(f)}})})}function at(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}};T(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,l){const p={response:c};typeof p.response=="string"&&(p.response=JSON.parse(p.response)),p.status=l.status,t&&t(p)},onFailure(c,d,l){const p=JSON.parse(d),m=JSON.parse(c),f=new Error(`Erreur sur cette requête : ${s.base+s.uri}`,{cause:{head:p,rep:m}});n&&n(f)}};g(s.base+s.uri,a)})}function ot(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]}};T(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 l=a;l.status=c.status,l.response=c.errormsg,s&&s(l)}})})}function rt(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 ct(e,t,n){const{_3DSwym:s,_3DSwym_token:i,idPost:r,title:o,community_id:a,status_comment:c,status_id:d,message:l}=e,p={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:l,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(p.base+p.uri,f)}function dt(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=[],l=1;let p=!1,m=2;a||(a=l),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}`;T(e,h=>{const S=y=>{g(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>=a){if(a++,f.page=`/page/${a}`,y=`${i}${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){n(b);return}}if(n&&mINFORMATIONS AFFAIRE :

|⚠️ Merci de respecter l'écriture des tags, en MAJUSCULES, nom complet, pas de caractères

|spéciaux, séparation par "_" si besoin !

Référence client : CLIENT

Référence projet : NOM AFFAIRE VILLE DPT

📝 Base documentaire : LIEN projet

📝 Fiche COCLICO : LIEN projet


Description projet :



Produit : Hexapli Usiné Hexapli MP Lamwood

Type de Bâtiment : Logements BUP ERP Plateforme Logistique

Essence : DOUGLAS PIN MIXTE EPICEA

Qualité : NVI VI1F VI2F

Traitement : PARKA CT2

Type de Paroi : Murs Intérieurs Murs Extérieurs Planchers Couverture

Etanchéité Accessible Etanchéité Non-Accessible

Hauteur Dernier Plancher : Hauteur <8m 8m< Hauteur <28m 28m< Hauteur <50m


EQUIPE PIVETEAU :

Chargé d'Affaires
Service études de prix

`:e}function lt(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,l){const p=d;p.status=l.status,p.response=l.errormsg,n&&n(p)}})}else n&&n({status:"error",msg:"Credentials incomplet !",attend:"tenant, _3DSwym , _3DSwym_token, community_id, idea_id",credentials:e})}function pt(e,t=void 0,n=void 0){const s=e._3DSwym+"/api/user/getcurrent/";T(e,i=>{g(s,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":i.result.ServerToken},onComplete(r,o,a){const c=JSON.parse(r);t&&t(c.result)},onFailure(r,o,a){const c={erreur:JSON.parse(r),headers:o,xhr:a};n&&n(c)}})})}function ft(e,t,n=void 0,s=void 0){const i=e.space+"/api/user/find/login/"+t;T(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 mt(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(l,p,m){const f={response:typeof l=="string"?JSON.parse(l):l};f.status=m.status,t&&t(f)},onFailure(l){n&&n(l)}};g(a,d)}function gt(e,t=void 0,n=void 0){e.tenant&&v(e,s=>{const i=s.services.find(r=>r.id==="businessprocess")?.url+"/api/v2";return t&&t(i),i})}function _t(e,t=void 0,n=void 0){e.tenant&&v(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 ht(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 St(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 yt(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 wt(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 Tt(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 Ct(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 bt(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 Ot(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 Dt(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 $t(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 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/dependencytable/put/${n}/?t=${t}&b=${s}`,{method:"POST"}).then(a=>a.json()).then(a=>{i&&i(a)}).catch(a=>{r&&r(a)})}}//!SECTION async function Nt(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 function At(e){const t="Hello "+e;return console.log(t),t}function Ft(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)}k(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)}})})}u.UUID=J,u._3DSearch_usersGroup=Ft,u._3DSpace_Create_Doc=Ie,u._3DSpace_Update_Doc=$e,u._3DSpace_bookmark_addSubsciptions=Le,u._3DSpace_bookmark_newWorkspace=Pe,u._3DSpace_csrf=O,u._3DSpace_download_doc=L,u._3DSpace_download_multidoc=W,u._3DSpace_file_update=P,u._3DSpace_file_update_csr=q,u._3DSpace_file_url_csr=De,u._3DSpace_get_csrf=F,u._3DSpace_get_docInfo=R,u._3DSpace_get_downloadTicket_multidoc=X,u._3DSpace_get_multiDocInfo=Oe,u._3DSpace_get_securityContexts=k,u._3DSpace_get_ticket=j,u._3DSpace_lifecycle_changeRevision=Re,u._3DSpace_lifecycle_changeState=je,u._3DSpace_lifecycle_getGraph=ve,u._3DSpace_lifecycle_getNextRevision=Ue,u._3DSpace_lifecycle_getNextStates=ke,u._3DSwym_ForwardIdea=lt,u._3DSwym_addComment=mt,u._3DSwym_buildDirectMessage=nt,u._3DSwym_deleteIdea=ot,u._3DSwym_editIdea=ct,u._3DSwym_findCommunityToInstantMSG=ee,u._3DSwym_getAllCommunities=et,u._3DSwym_getAllListIdeas=dt,u._3DSwym_getAllNews=Qe,u._3DSwym_getFamiliarPeople=Ze,u._3DSwym_getIdeaStatusMaturity=tt,u._3DSwym_getMembersCommunity=Z,u._3DSwym_getOneIdea=rt,u._3DSwym_get_Token=T,u._3DSwym_get_currentUser=pt,u._3DSwym_get_findUser=ft,u._3DSwym_postIdea=at,u._3DSwym_postIdeaTemplate=it,u._3DSwym_sendMessageData=M,u._AppMngt_get_info_user=fe,u._AppMngt_get_users=pe,u._Iterop_AddOrRemoveRows=Tt,u._Iterop_Auth_CAS=_t,u._Iterop_GetOneDependencyTable=Dt,u._Iterop_GetOneList=Nt,u._Iterop_PatchDependencyTable=$t,u._Iterop_PutDependencyTable=It,u._Iterop_businessTableSearchInRows=Ct,u._Iterop_getAllBusinessTables=St,u._Iterop_getOneBusinessTable=yt,u._Iterop_getOneBusinessTableRows=wt,u._Iterop_jwtUser=ht,u._Iterop_runProcess=Ot,u._Iterop_updateBusinessTable=bt,u._getPlateformInfos=E,u._getPlatformServices=de,u._getServiceUrl=v,u._getServiceUrl_3DPassport=ue,u._getServiceUrl_Iterop=gt,u._httpCallAuthenticated=g,u._setDraggable=oe,u._setDroppable=ce,u._setupTagger=re,u.addTagToDoc=Ve,u.chunkArray=x,u.compass_getListAdditionalApps=le,u.couleurs=G,u.createUserGroups=me,u.dataMixing=z,u.deleteUserGroups=he,u.findAdresse=ne,u.getAllContextSecurity=Me,u.getCSRFToken=B,u.getCommunes=te,u.getComplementUG=ge,u.getDataFrom3DSpace=Je,u.getDataFromGouvFr=se,u.getDatasByTenant=Ke,u.getDatasFrom3DSpace=Be,u.getDownloadDocument=Ge,u.getInfoDocTags=ze,u.getUserGroupsList=_e,u.getUsersGroupRules=K,u.get_3DSpace_csrf=Ee,u.patchUserGroups=Se,u.patchUserGroupsControl=ye,u.pushDataIn3DSpace=xe,u.readUserGroupControl=we,u.removeTagToDoc=He,u.sayHello=At,u.updateEvent=ae,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=wb3Api.umd.cjs.map