@beam3_dev/api_module 0.0.301 → 0.0.303

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,5 +1,5 @@
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,O){"use strict";function G(){return I.v4()}const q={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 oe(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(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{s&&s(i),console.error("Erreur : "+i)})}async function ce(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 re(e,t=q){let s=D.DateTime.now().year;const n=e,i=[],c=o=>{for(let r in o)i.push({date:r,comment:o[r]})};for(let o=s;o<=s+1;o++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+o+".json",{method:"GET",headers:{Accept:"application/json"}}).then(r=>r.json()).then(r=>{c(r)}).catch(r=>console.error("Erreur : "+r));return(()=>{const o=n.length===0?{events:[]}:n;for(let r of i)o.events.findIndex(u=>u.start===D.DateTime.fromISO(r.date).toISODate()&&u.name==="Férié : "+r.comment)===-1&&o.events.push({name:"Férié : "+r.comment,start:D.DateTime.fromISO(r.date).toISODate(),end:D.DateTime.fromISO(r.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return o})()}function K(e,t,s){const{credentials:n,myArray:i,chunk:c,fn_to_call:a}=e,o=[];for(let r=0;r<i.length;r+=c){const d=i.slice(r,r+c);o.push(d)}de({credentials:n,chunks:o,initLoop:0,fn:a},r=>{t&&t(r)},r=>{s&&s(r)})}function de(e,t,s){const{credentials:n,chunks:i,initLoop:c,fn:a}=e,o=r=>{a(n,i[r],()=>{r++,r<i.length&&o(r)},d=>{t&&t(d)},d=>{s&&s(d)})};o(c)}async function ue(e,t,s=!0){const n=e.events.findIndex(i=>i.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((i,c)=>i.start-c.start),e}function _(e,t){O.requirejs(["DS/WAFData/WAFData"],s=>{s.authenticatedRequest(e,t)})}function le(e,t,s){O.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function pe(e,t=void 0){O.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],s=>{let n;n===void 0&&(n=s.createProxy({widgetId:O.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&n.addEvent("onFilterSubjectsChange",t)),n.setSubjectsTags(e)})}function fe(e,t){O.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.droppable(e,{drop:t})})}async function me(e,t=void 0,s=void 0){await O.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],n=>{(!e||e==="")&&(e=O.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(n.getPlatformServices({platformId:e,onComplete:t,onFailure:s}))})}function B(){let e={};return O.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const s=t.getTenant(),n=t.getUser(),i=t.getAllApplicationConfigurations(),c=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:s,user:n,appsConfiguration:i,appConf:c}}),console.log("%cRETOUR API :","color:blue",e),e}function _e(e,t=void 0,s=void 0){if(e.tenant){const n=`https://${e.tenant}-eu1.iam.3dexperience.3ds.com/api/authenticated/user/me?xrequestedwith=xmlhttprequest`;_(n,{onComplete(i){const c=typeof i=="string"?JSON.parse(i):i;c&&"fields"in c?t&&t(c.fields):s&&s("_getMe return not find properties fields")},onFailure(i){s&&s("_getMe return error",i)}})}}function A(e,t=void 0,s=void 0){if(console.log("_getServiceUrl"),e.tenant){const n=`https://${e.tenant.toLowerCase()}-eu1-compass.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?platform=${e.tenant.toUpperCase()}&cors=true&xrequestedwith=xmlhttprequest`;_(n,{onComplete(i){const c=typeof i=="string"?JSON.parse(i):i;if(c&&"platforms"in c){const a=c.platforms.find(o=>o.id===e.tenant.toUpperCase());t&&a?t(a):s&&s("_getServiceUrl return listServiceUrl = undefined")}else s&&s("_getServiceUrl return oResponse = undefined")},onFailure(i){s&&s(i)}})}}function ge(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(i){const c=JSON.parse(i);if(console.log("serviceId=3dpassport",c),Array.isArray(c)&&c.length>0){const a=`${c[0].services[0].url}`;t&&t(a)}},onFailure(i){s&&s(i)}})}}function he(e,t,s){const n={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},i=`${n.base}${n.uri}${n.option}`;_(i,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(c,a,o){const r=JSON.parse(c),d=r.data.map(u=>{const l=u.attributes.name,m=u.id;return{name:l,id:m}});t&&t(d,r)},onFailure(c,a){const o=c;o.msg=a.errormsg,o.errCode=a.errorcode,s&&s(o)}})}function Se(e,t=void 0,s=void 0){let n=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;_(n,{onComplete(i,c,a){const o=JSON.parse(i);console.log("_AppMngt_get_users => ",o),t&&t(o)},onFailure(i,c){const a=i;a.msg=c.errormsg,a.errCode=c.errorcode,s&&s(a)}})}function ye(e,t,s=void 0,n=void 0){let i=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;_(i,{onComplete(c,a,o){const r=JSON.parse(c);s&&s(r)},onFailure(c,a){const o=c;o.msg=a.errormsg,o.errCode=a.errorcode,n&&n(o)}})}const j={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function we(e,t,s=void 0,n=void 0){const{space:i,currentUser:c}=e,o=`${i}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,r={groups:[{title:t.title,description:t.description,members:t.members||[c.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};_(o,{method:"POST",headers:j,data:JSON.stringify(r),onComplete(d){s&&s(JSON.parse(d))},onFailure(d,u){console.log(d);const l=d;l.msg=u.errormsg,l.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",l),n&&n(l)}})}function Ce(e,t,s=void 0,n=void 0){const{space:i,tenant:c}=e,a=i,o=`/3drdfpersist/v1/resources/${t}`,r=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${c}`,d=`${a}${o}${r}`;_(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 E(e,t=void 0,s=void 0){const{space:n,tenant:i}=e,c=n,a="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",o=`?tenant=dstenant:${i}`,r={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${c}${a}${o}`;_(d,{OPTsH:r,onComplete(u){t&&t(JSON.parse(u))},onFailure(u,l){const m=u;m.msg=l.errormsg,m.errCode=l.errorcode,s&&s(m)}})}function Te(e,t=void 0,s=void 0){const{space:n,currentUser:i}=e,o=`${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{_(o,{opts:d,onComplete(u){const l=JSON.parse(u),m={},f=l.groups.filter(g=>g.uri.startsWith("uuid:"));if(i&&Object.keys(i).length>0){const g=f.filter(y=>y.owner===i.email),h=f.filter(y=>y.members.includes(i.email)),S=g.concat(h);m.iam=S,m.UG=f,m.iamMember=h,E(e,y=>{m.rules=y,t&&t(m)},y=>{s&&s(y)})}},onFailure(u){s&&s(u)}})}catch(u){console.log(u)}}function be(e,t){const{space:s}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;_(i,{method:"DELETE"})}function Oe(e,t,s,n=void 0,i=void 0){const{space:c,tenant:a}=e,o={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:${a}`},r=s,d=`${c}${o.URIUGr}/${t}`,u=JSON.stringify(r);_(d,{headers:j,method:"PATCH",data:u,type:"json",onComplete(l){n&&n(l)},onFailure(l){i&&i(l)}})}function De(e,t,s,n=void 0,i=void 0){const{space:c}=e,o=`${c}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(o,{method:"PATCH",headers:j,data:JSON.stringify(s),type:"json",onComplete(d){n&&n(d)},onFailure(d){i&&i(d)}})}function $e(e,t,s=void 0,n=void 0){const{space:i}=e,a=`${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(a,{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 X(e,t,s){if(e.space){const n=`${e.space}/resources/v1/application/CSRF`;_(n,{onComplete(i){i=JSON.parse(i),t&&t(i.csrf)},onFailure(i,c,a){s&&s({error:i,headers:c,xhr:a})}})}}var N={};function Ie(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ne=function(e,t,s,n){t=t||"&",s=s||"=";var i={};if(typeof e!="string"||e.length===0)return i;var c=/\+/g;e=e.split(t);var a=1e3;n&&typeof n.maxKeys=="number"&&(a=n.maxKeys);var o=e.length;a>0&&o>a&&(o=a);for(var r=0;r<o;++r){var d=e[r].replace(c,"%20"),u=d.indexOf(s),l,m,f,g;u>=0?(l=d.substr(0,u),m=d.substr(u+1)):(l=d,m=""),f=decodeURIComponent(l),g=decodeURIComponent(m),Ie(i,f)?Array.isArray(i[f])?i[f].push(g):i[f]=[i[f],g]:i[f]=g}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""}},Ue=function(e,t,s,n){return t=t||"&",s=s||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(i){var c=encodeURIComponent(U(i))+s;return Array.isArray(e[i])?e[i].map(function(a){return c+encodeURIComponent(U(a))}).join(t):c+encodeURIComponent(U(e[i]))}).filter(Boolean).join(t):n?encodeURIComponent(U(n))+s+encodeURIComponent(U(e)):""};N.decode=N.parse=Ne,N.encode=N.stringify=Ue;async function P(e,t=void 0,s=void 0,n=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const c=i+`/resources/v1/modeler/documents/${t}`;_(c,{onComplete(a,o,r){const d=JSON.parse(a);s&&s(d)},onFailure(a){n&&n(a)}})}async function Fe(e,t=void 0,s=void 0,n=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let c=`${i}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,a=N.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});_(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:a,onComplete(o,r,d){const u=JSON.parse(o);s&&s(u)},onFailure(o){n&&n(o)}})}function F(e,t=void 0,s=void 0){if(e.objID&&e.objID!==""){let n=`${e.space}/resources/v1/modeler/documents/${e.objID}`;_(n,{onComplete(i,c,a){const o=JSON.parse(i);e.success=!0,e.token=o?.csrf?.value,e.datas=o?.data[0],t&&t(e)},onFailure(i){s&&s(i)}})}else b(e,n=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",n),e.token=n,t&&t(e)},n=>{s&&s(n)})}function b(e,t=void 0,s=void 0){if(e.space){const n=e.space+"/resources/v1/application/CSRF";_(n,{onComplete(i,c,a){const o=JSON.parse(i);t&&t(o.csrf.value)},onFailure(i,c,a){s&&s({response:i,headers:c,xhr:a})}})}else s&&s("ERROR : url du 3DSpace non défini.")}function k(e,t=void 0,s=void 0){let n=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;F(e,i=>{_(n,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(c,a){const r=JSON.parse(c).data[0].dataelements.ticketURL;t&&t(r,a)},onFailure(c,a){console.warn("☠️ error => ",c,a),s&&s(c,a)}})},i=>{console.warn("_3DSpace_get_ticket / error => ",i),s&&s(i)})}function Re(e,t,s=void 0,n=void 0,i=void 0){const c=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;s||(s=e.token),_(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:s},onComplete(a){let o=JSON.parse(a);if(console.log("☠️ info => ",o),o.success===!0)try{const r=o.data[0].dataelements.ticketURL;n&&n(r)}catch(r){i&&i(r)}},onFailure(a){i&&i(a)}})}function L(e,t,s,n,i,c=void 0,a=void 0){const o=()=>W(e,t,s,n,i,e.token,c,a);e.token?o():F(e,t,r=>{console.log("_3DSpace_file_update | _3DSpace_get_csrf| onDone | result",r),e.token=r,o()})}function W(e,t,s,n,i,c,a=void 0,o=void 0){const r=e.space+`/resources/v1/modeler/documents/files/CheckinTicket?tenant=${e.tenant.toUpperCase()}&e6w-lang=fr&e6w-timezone=-60&xrequestedwith=xmlhttprequest`;_(r,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},data:JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token}}),type:"json",onComplete(d,u,l){const m=d.csrf,f=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,i);const S={};S.method="POST",S.data=g,S.onComplete=function(y){let C={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(w){a&&a(w)},onFailure(w){o&&o(w)}};e.tenant.toUpperCase(),_(e.space+`/resources/v1/modeler/documents/?$include=versions&tenant=${e.tenant.toUpperCase()}&e6w-lang=fr&e6w-timezone=-60&xrequestedwith=xmlhttprequest`,C)},S.onFailure=function(y){o&&o(y)},S.timeout=0,_(f.ticketURL,S)}})}async function ke(e,t,s=void 0,n=void 0){e.space,e.token,e.ctx;const i=e?.description,c=e?.title;if(!t){console.warn("Error: docId undefined"),n&&n("Error: docId undefined");return}let a=`${e.space}/resources/v1/modeler/documents/${t}`;const o=JSON.stringify({data:[{dataelements:{description:i,title:c}}]});_(a,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},data:o,type:"json",onComplete(r){s&&s(r)},onFailure(r){n&&n(r)}})}async function ve(e,t=void 0,s=void 0,n=void 0,i=void 0,c=void 0){let{tenant:a,cs_name:o}=e;if(!a&&!o){i&&i("Credentials undefined");return}if(!t&&!s){i&&i("Définition du fichier undefined");return}const r=D.DateTime.now().ts;let d=`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/collabspaces/${encodeURIComponent(o)}/ticket?id=${r}&tenant=${a.toUpperCase()}&xrequestedwith=xmlhttprequest`;_(`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/session?tenant=${a.toUpperCase()}&xrequestedwith=xmlhttprequest`,{method:"GET",onComplete(u){try{u=JSON.parse(u);const{csrftoken:l,isadmin:m}=u;l&&_(d,{method:"GET",headers:{"x-ds-csrftoken":l,Accept:"application/json"},onComplete(f,g,h){try{if(f=JSON.parse(f),f?.ticket){const{ticket:S,actionurl:y,jobticket:C}=f;V({dataelements:{ticket:S,ticketURL:y}},s,t,w=>{const x=new DOMParser().parseFromString(w,"text/html").body.firstChild.querySelector("input").getAttributeNode("value").value,ie=`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/collabspaces/${o}/contents?receipt=${encodeURIComponent(x)}`;let Gt=/(?:\.([^.]+))?$/.exec(t)[1];const ae=JSON.stringify({actions:[],businessobj:{description:e?.description,file:t,fullnameowner:"",icon:"",maturity:"",modified:"",owner:{},thumbnail:"",title:Gt?t.split(".").slice(0,-1).join("."):t,type:{}},collabspace:o});_(ie,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-DS-CSRFTOKEN":l},data:ae,type:"json",onComplete(v,Kt,Bt){n&&n(v)},onFailure(v){console.warn("_3DSpace_Upload_Doc | pushFileInFcs | onFailure",{url:ie,bodyRequest:ae,err:v}),i&&i(v)}})},w=>{console.warn("pushFileInFcs",w),i&&i(w)},w=>{c&&c({fileName:t,progress:w})})}}catch(S){i&&i(S)}},onFailure(f){console.warn("_3DSpace_Upload_Doc | onFailure"),i&&i(f)}})}catch{i&&i()}},onFailure(u){i&&i(u)}})}async function Ae(e,t,s,n=void 0,i=void 0){e.space,e.token,e.ctx,P(e,t,c=>{const a=c.data[0].relateddata.files[0].id,o=c.data[0].dataelements.secondaryTitle&&c.data[0].dataelements.secondaryTitle!==""?c.data[0].dataelements.secondaryTitle:c.data[0].dataelements.title;L(e,t,a,s,o,r=>{n&&n(r)},r=>{i&&i(r)})},c=>{i&&i(c)})}async function je(e,t,s,n,i=void 0,c=void 0){Pe(e,a=>{a?.items>=1&&a.data.forEach(o=>{V(o,t,s,r=>{Le(e,r,s,n,d=>{d?.data.length?i&&i(d):c&&c({success:!1,msg:"Erreur lors de la mise en ralation entre la document et le fichier"})},d=>console.warn(d))},r=>console.warn(r))})},a=>console.warn(a))}function Pe(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(i,c,a){try{i=JSON.parse(i)}catch{}t&&t(i)},onFailure(i){s&&s(i)}})}else console.log("Error de credentials",e)}function V(e,t,s,n=void 0,i=void 0,c=void 0){let a=new FormData;t instanceof Blob||(t=new Blob([t],{type:"text/plain"})),a.append("__fcs__jobTicket",e.dataelements.ticket),a.append("file_0",t,s);let o=e.dataelements.ticketURL;const r=new XMLHttpRequest;r.open("POST",o,!0),r.upload.onprogress=function(d){if(d.lengthComputable){const u=d.loaded/d.total*100;c&&c(u)}},r.onload=function(){r.status===200?n&&n(r.responseText.replace(/[\n\r]/g,"")):i&&i(r.statusText)},r.onerror=function(){i&&i(r.statusText)},r.send(a)}function Le(e,t,s,n=void 0,i=void 0,c=void 0){console.log("relatedDocAndFile",{credentials:e,receipt:t,filename:s});const a=d=>d.indexOf(".")===-1?d:d.split(".").slice(0,-1).join(".");let o="temp_"+D.DateTime.now().ts,r=e.space+"/resources/v1/modeler/documents/?e6w-lang=fr&e6w-timezone=-120&xrequestedwith=xmlhttprequest";_(r,{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:a(s),description:n},relateddata:{files:[{dataelements:{title:s,receipt:`${t}
2
- `}}]},tempId:o}]}),onComplete(d){try{d=JSON.parse(d)}catch{}i&&i(d)},onFailure(d){c&&c(d)}})}function R(e,t=void 0,s=void 0,n=void 0,i=void 0,c=void 0,a=!1){const o=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;_(o,{method:"GET",onComplete(r){const d=JSON.parse(r);let u="",l,m,f;if(t){let g=d.collabspaces.find(h=>h.title===t);if(g){l=t;let h=g.couples;h=h.filter((S,y,C)=>y===C.findIndex(w=>w.organization.pid===S.organization.pid&&w.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 C=h.filter(w=>w.role.name===S);C.length===1?(f=C[0].role.name,m=C[0].organization.title):c(C)}})}):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(C=>C.role.name===s);y.length===1?(f=y[0].role.name,m=y[0].organization.title):c(y)}}))}}l&&m&&f?(u=f+"."+m+"."+l,i(u)):d.preferredcredentials&&a?(u=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,i(u)):c&&(u=f+"."+m+"."+l,c(u))},onFailure(r,d){console.warn("Erreur de récupération du contexte de sécurité. => ",{err:r,headers:d})}})}async function M(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)&&X(e,n=>{e.token=n},n=>{console.log("☠️ error => ",n)}),new Promise((n,i)=>{k(e,c=>{e?.returnType==="blob"?(console.log("ticketURL blob",c),fetch(c).then(a=>a.blob()).then(a=>{t&&t(a)}).catch(a=>{s&&s(a)})):_(c,{onComplete(a){let o;try{o=JSON.parse(a)}catch{o=a}t&&typeof t=="function"&&t(o),n(o)},onFailure(a,o,r){s&&(console.log("error http",a),s({msg:JSON.parse(a),headers:o,xhr:r}),i({msg:JSON.parse(a),headers:o,xhr:r}))}})},c=>{s&&s(c),console.log("*_3dspace_download_doc / error file URL *",c),i(c)})})}async function Y(e,t,s=void 0,n=void 0){typeof t<"u"&&Array.isArray(t)&&t?.length>0?K({credentials:e,myArray:t,chunk:80,fn_to_call:H},c=>{s&&s(c)}):(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 H(e,t,s=void 0,n=void 0,i=void 0){const c=[];t.forEach(r=>{c.push({id:r})});let a=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:c});const o=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;_(o,{method:"PUT",data:a,type:"json",onComplete(r){const d=r.data;r.success===!0&&(s&&s(),d.forEach(u=>{try{const l=u.dataelements.fileName,m=u.dataelements.ticketURL;_(m,{onComplete:(f,g)=>{let h;try{h=JSON.parse(f)}catch{h=f.blob()}n&&n({objectId:u.id,headers:g,fileName:l,data:h})},onFailure:f=>{console.log("error http",f)}})}catch(l){console.log(l),i&&i(l)}}))},onFailure(r){console.log(r),i&&i(r)}})}function Me(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;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}]}),type:"json",onComplete(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function Je(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const a=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;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,nextState:s}]}),type:"json",onComplete(r){n&&n(r)},onFailure(r){i&&i(r)}};_(a,o)}})}function xe(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});let a={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(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function Ge(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});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:[{"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(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function qe(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const a=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,r=>e.ctx=r,r=>{console.log("onError =>",r)});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:[{physicalid:t,proposedRevision:s,modifiedAttributes:{revision:s}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(r){n&&n(r)},onFailure(r){i&&i(r)}};_(a,o)}})}function Ke(e){return new Promise((t,s)=>{const n=`${e.space}/resources/pno/person/getsecuritycontext&tenant=${e.tenant.toUpperCase()}&xrequestedwith=xmlhttprequest`;_(n,{method:"GET",onComplete(c){t(c)},onFailure(c){s(c)}})})}function Be(e,t,s=void 0,n=void 0){return new Promise(async(i,c)=>{const{tenant:a,ctx:o,space:r}=e;(!a||!o||!r)&&c({error:"Erreur de credentials",tenant:a,ctx:o,space:r});const d=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=1&withAttributes=1&withCopyFrom=1&tenant=${e.tenant.toUpperCase()}&xrequestedwith=xmlhttprequest`;let u;await Ke(e).then(m=>u=m?.SecurityContext);let l={method:"POST",headers:{securitycontext:"ctx::"+u,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t,attributes:["revision","policy"]}]}),type:"json",onComplete(m){s&&s(m),i(m)},onFailure(m){n&&n(m),c(m)}};_(d,l)})}function Ee(e,t,s,n,i=void 0,c=void 0){return new Promise(a=>{const o=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let r={attributes:{title:s,description:n,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(r);let u={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(l){i&&i(l)},onFailure(l){c&&c(l)}};_(o,u)})}function Xe(e,t,s,n,i=void 0,c=void 0){return console.log("credentials",e),new Promise(a=>{`${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
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,O){"use strict";function G(){return I.v4()}const q={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 oe(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(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{s&&s(i),console.error("Erreur : "+i)})}async function ce(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 re(e,t=q){let s=D.DateTime.now().year;const n=e,i=[],c=o=>{for(let r in o)i.push({date:r,comment:o[r]})};for(let o=s;o<=s+1;o++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+o+".json",{method:"GET",headers:{Accept:"application/json"}}).then(r=>r.json()).then(r=>{c(r)}).catch(r=>console.error("Erreur : "+r));return(()=>{const o=n.length===0?{events:[]}:n;for(let r of i)o.events.findIndex(u=>u.start===D.DateTime.fromISO(r.date).toISODate()&&u.name==="Férié : "+r.comment)===-1&&o.events.push({name:"Férié : "+r.comment,start:D.DateTime.fromISO(r.date).toISODate(),end:D.DateTime.fromISO(r.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return o})()}function B(e,t,s){const{credentials:n,myArray:i,chunk:c,fn_to_call:a}=e,o=[];for(let r=0;r<i.length;r+=c){const d=i.slice(r,r+c);o.push(d)}de({credentials:n,chunks:o,initLoop:0,fn:a},r=>{t&&t(r)},r=>{s&&s(r)})}function de(e,t,s){const{credentials:n,chunks:i,initLoop:c,fn:a}=e,o=r=>{a(n,i[r],()=>{r++,r<i.length&&o(r)},d=>{t&&t(d)},d=>{s&&s(d)})};o(c)}async function ue(e,t,s=!0){const n=e.events.findIndex(i=>i.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((i,c)=>i.start-c.start),e}function _(e,t){O.requirejs(["DS/WAFData/WAFData"],s=>{s.authenticatedRequest(e,t)})}function le(e,t,s){O.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.draggable(e,{data:t,start:s})})}function pe(e,t=void 0){O.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],s=>{let n;n===void 0&&(n=s.createProxy({widgetId:O.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&n.addEvent("onFilterSubjectsChange",t)),n.setSubjectsTags(e)})}function fe(e,t){O.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.droppable(e,{drop:t})})}async function me(e,t=void 0,s=void 0){await O.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],n=>{(!e||e==="")&&(e=O.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(n.getPlatformServices({platformId:e,onComplete:t,onFailure:s}))})}function K(){let e={};return O.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const s=t.getTenant(),n=t.getUser(),i=t.getAllApplicationConfigurations(),c=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:s,user:n,appsConfiguration:i,appConf:c}}),console.log("%cRETOUR API :","color:blue",e),e}function _e(e,t=void 0,s=void 0){if(e.tenant){const n=`https://${e.tenant}-eu1.iam.3dexperience.3ds.com/api/authenticated/user/me?xrequestedwith=xmlhttprequest`;_(n,{onComplete(i){const c=typeof i=="string"?JSON.parse(i):i;c&&"fields"in c?t&&t(c.fields):s&&s("_getMe return not find properties fields")},onFailure(i){s&&s("_getMe return error",i)}})}}function A(e,t=void 0,s=void 0){if(console.log("_getServiceUrl"),e.tenant){const n=`https://${e.tenant.toLowerCase()}-eu1-compass.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?platform=${e.tenant.toUpperCase()}&cors=true&xrequestedwith=xmlhttprequest`;_(n,{onComplete(i){const c=typeof i=="string"?JSON.parse(i):i;if(c&&"platforms"in c){const a=c.platforms.find(o=>o.id===e.tenant.toUpperCase());t&&a?t(a):s&&s("_getServiceUrl return listServiceUrl = undefined")}else s&&s("_getServiceUrl return oResponse = undefined")},onFailure(i){s&&s(i)}})}}function ge(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(i){const c=JSON.parse(i);if(console.log("serviceId=3dpassport",c),Array.isArray(c)&&c.length>0){const a=`${c[0].services[0].url}`;t&&t(a)}},onFailure(i){s&&s(i)}})}}function he(e,t,s){const n={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},i=`${n.base}${n.uri}${n.option}`;_(i,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(c,a,o){const r=JSON.parse(c),d=r.data.map(u=>{const l=u.attributes.name,m=u.id;return{name:l,id:m}});t&&t(d,r)},onFailure(c,a){const o=c;o.msg=a.errormsg,o.errCode=a.errorcode,s&&s(o)}})}function Se(e,t=void 0,s=void 0){let n=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;_(n,{onComplete(i,c,a){const o=JSON.parse(i);console.log("_AppMngt_get_users => ",o),t&&t(o)},onFailure(i,c){const a=i;a.msg=c.errormsg,a.errCode=c.errorcode,s&&s(a)}})}function ye(e,t,s=void 0,n=void 0){let i=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;_(i,{onComplete(c,a,o){const r=JSON.parse(c);s&&s(r)},onFailure(c,a){const o=c;o.msg=a.errormsg,o.errCode=a.errorcode,n&&n(o)}})}const j={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function we(e,t,s=void 0,n=void 0){const{space:i,currentUser:c}=e,o=`${i}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,r={groups:[{title:t.title,description:t.description,members:t.members||[c.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};_(o,{method:"POST",headers:j,data:JSON.stringify(r),onComplete(d){s&&s(JSON.parse(d))},onFailure(d,u){console.log(d);const l=d;l.msg=u.errormsg,l.errCode=u.errorcode,console.log("❌ sendDirectMessage => ",l),n&&n(l)}})}function Ce(e,t,s=void 0,n=void 0){const{space:i,tenant:c}=e,a=i,o=`/3drdfpersist/v1/resources/${t}`,r=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${c}`,d=`${a}${o}${r}`;_(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 E(e,t=void 0,s=void 0){const{space:n,tenant:i}=e,c=n,a="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",o=`?tenant=dstenant:${i}`,r={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${c}${a}${o}`;_(d,{OPTsH:r,onComplete(u){t&&t(JSON.parse(u))},onFailure(u,l){const m=u;m.msg=l.errormsg,m.errCode=l.errorcode,s&&s(m)}})}function Te(e,t=void 0,s=void 0){const{space:n,currentUser:i}=e,o=`${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{_(o,{opts:d,onComplete(u){const l=JSON.parse(u),m={},f=l.groups.filter(g=>g.uri.startsWith("uuid:"));if(i&&Object.keys(i).length>0){const g=f.filter(y=>y.owner===i.email),h=f.filter(y=>y.members.includes(i.email)),S=g.concat(h);m.iam=S,m.UG=f,m.iamMember=h,E(e,y=>{m.rules=y,t&&t(m)},y=>{s&&s(y)})}},onFailure(u){s&&s(u)}})}catch(u){console.log(u)}}function be(e,t){const{space:s}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup/${t}`;_(i,{method:"DELETE"})}function Oe(e,t,s,n=void 0,i=void 0){const{space:c,tenant:a}=e,o={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:${a}`},r=s,d=`${c}${o.URIUGr}/${t}`,u=JSON.stringify(r);_(d,{headers:j,method:"PATCH",data:u,type:"json",onComplete(l){n&&n(l)},onFailure(l){i&&i(l)}})}function De(e,t,s,n=void 0,i=void 0){const{space:c}=e,o=`${c}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(o,{method:"PATCH",headers:j,data:JSON.stringify(s),type:"json",onComplete(d){n&&n(d)},onFailure(d){i&&i(d)}})}function $e(e,t,s=void 0,n=void 0){const{space:i}=e,a=`${i}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;_(a,{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 X(e,t,s){if(e.space){const n=`${e.space}/resources/v1/application/CSRF`;_(n,{onComplete(i){i=JSON.parse(i),t&&t(i.csrf)},onFailure(i,c,a){s&&s({error:i,headers:c,xhr:a})}})}}var U={};function Ie(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ue=function(e,t,s,n){t=t||"&",s=s||"=";var i={};if(typeof e!="string"||e.length===0)return i;var c=/\+/g;e=e.split(t);var a=1e3;n&&typeof n.maxKeys=="number"&&(a=n.maxKeys);var o=e.length;a>0&&o>a&&(o=a);for(var r=0;r<o;++r){var d=e[r].replace(c,"%20"),u=d.indexOf(s),l,m,f,g;u>=0?(l=d.substr(0,u),m=d.substr(u+1)):(l=d,m=""),f=decodeURIComponent(l),g=decodeURIComponent(m),Ie(i,f)?Array.isArray(i[f])?i[f].push(g):i[f]=[i[f],g]:i[f]=g}return i},N=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Ne=function(e,t,s,n){return t=t||"&",s=s||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(i){var c=encodeURIComponent(N(i))+s;return Array.isArray(e[i])?e[i].map(function(a){return c+encodeURIComponent(N(a))}).join(t):c+encodeURIComponent(N(e[i]))}).filter(Boolean).join(t):n?encodeURIComponent(N(n))+s+encodeURIComponent(N(e)):""};U.decode=U.parse=Ue,U.encode=U.stringify=Ne;async function P(e,t=void 0,s=void 0,n=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const c=i+`/resources/v1/modeler/documents/${t}`;_(c,{onComplete(a,o,r){const d=JSON.parse(a);s&&s(d)},onFailure(a){n&&n(a)}})}async function Fe(e,t=void 0,s=void 0,n=void 0){const i=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let c=`${i}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,a=U.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});_(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:a,onComplete(o,r,d){const u=JSON.parse(o);s&&s(u)},onFailure(o){n&&n(o)}})}function F(e,t=void 0,s=void 0){if(e.objID&&e.objID!==""){let n=`${e.space}/resources/v1/modeler/documents/${e.objID}`;_(n,{onComplete(i,c,a){const o=JSON.parse(i);e.success=!0,e.token=o?.csrf?.value,e.datas=o?.data[0],t&&t(e)},onFailure(i){s&&s(i)}})}else b(e,n=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",n),e.token=n,t&&t(e)},n=>{s&&s(n)})}function b(e,t=void 0,s=void 0){if(e.space){const n=e.space+"/resources/v1/application/CSRF";_(n,{onComplete(i,c,a){const o=JSON.parse(i);t&&t(o.csrf.value)},onFailure(i,c,a){s&&s({response:i,headers:c,xhr:a})}})}else s&&s("ERROR : url du 3DSpace non défini.")}function k(e,t=void 0,s=void 0){let n=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;F(e,i=>{_(n,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(c,a){const r=JSON.parse(c).data[0].dataelements.ticketURL;t&&t(r,a)},onFailure(c,a){console.warn("☠️ error => ",c,a),s&&s(c,a)}})},i=>{console.warn("_3DSpace_get_ticket / error => ",i),s&&s(i)})}function Re(e,t,s=void 0,n=void 0,i=void 0){const c=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;s||(s=e.token),_(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:s},onComplete(a){let o=JSON.parse(a);if(console.log("☠️ info => ",o),o.success===!0)try{const r=o.data[0].dataelements.ticketURL;n&&n(r)}catch(r){i&&i(r)}},onFailure(a){i&&i(a)}})}function L(e,t,s,n,i,c=void 0,a=void 0){const o=()=>W(e,t,s,n,i,e.token,c,a);e.token?o():F(e,t,r=>{console.log("_3DSpace_file_update | _3DSpace_get_csrf| onDone | result",r),e.token=r,o()})}function W(e,t,s,n,i,c,a=void 0,o=void 0){const r=e.space+`/resources/v1/modeler/documents/files/CheckinTicket?tenant=${e.tenant.toUpperCase()}&e6w-lang=fr&e6w-timezone=-60&xrequestedwith=xmlhttprequest`;_(r,{method:"PUT",headers:{SecurityContext:encodeURIComponent("ctx::"+e.ctx)},data:JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token}}),type:"json",onComplete(d,u,l){const m=d.csrf,f=d.data[0].dataelements,g=new FormData;let h;n instanceof Blob?h=n:h=new Blob([n],{type:"text/plain"}),g.append(f.ticketparamname,f.ticket),g.append("file_0",h,i);const S={};S.method="POST",S.data=g,S.onComplete=function(y){let C={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(w){a&&a(w)},onFailure(w){o&&o(w)}};e.tenant.toUpperCase(),_(e.space+`/resources/v1/modeler/documents/?$include=versions&tenant=${e.tenant.toUpperCase()}&e6w-lang=fr&e6w-timezone=-60&xrequestedwith=xmlhttprequest`,C)},S.onFailure=function(y){o&&o(y)},S.timeout=0,_(f.ticketURL,S)}})}async function ke(e,t,s=void 0,n=void 0){e.space,e.token,e.ctx;const i=e?.description,c=e?.title;if(!t){console.warn("Error: docId undefined"),n&&n("Error: docId undefined");return}let a=`${e.space}/resources/v1/modeler/documents/${t}`;const o=JSON.stringify({data:[{dataelements:{description:i,title:c}}]});_(a,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},data:o,type:"json",onComplete(r){s&&s(r)},onFailure(r){n&&n(r)}})}async function ve(e,t=void 0,s=void 0,n=void 0,i=void 0,c=void 0){let{tenant:a,cs_name:o}=e;if(!a&&!o){i&&i("Credentials undefined");return}if(!t&&!s){i&&i("Définition du fichier undefined");return}const r=D.DateTime.now().ts;let d=`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/collabspaces/${encodeURIComponent(o)}/ticket?id=${r}&tenant=${a.toUpperCase()}&xrequestedwith=xmlhttprequest`;_(`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/session?tenant=${a.toUpperCase()}&xrequestedwith=xmlhttprequest`,{method:"GET",onComplete(u){try{u=JSON.parse(u);const{csrftoken:l,isadmin:m}=u;l&&_(d,{method:"GET",headers:{"x-ds-csrftoken":l,Accept:"application/json"},onComplete(f,g,h){try{if(f=JSON.parse(f),f?.ticket){const{ticket:S,actionurl:y,jobticket:C}=f;V({dataelements:{ticket:S,ticketURL:y}},s,t,w=>{const x=new DOMParser().parseFromString(w,"text/html").body.firstChild.querySelector("input").getAttributeNode("value").value,ie=`https://${a.toLowerCase()}-eu1-space.3dexperience.3ds.com/enovia/resources/enocsmrest/collabspaces/${encodeURIComponent(o)}/contents?receipt=${encodeURIComponent(x)}`;let Gt=/(?:\.([^.]+))?$/.exec(t)[1];const ae=JSON.stringify({actions:[],businessobj:{description:e?.description,file:t,fullnameowner:"",icon:"",maturity:"",modified:"",owner:{},thumbnail:"",title:Gt?t.split(".").slice(0,-1).join("."):t,type:{}},collabspace:o});_(ie,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-DS-CSRFTOKEN":l},data:ae,type:"json",onComplete(v,Bt,Kt){n&&n(v)},onFailure(v){console.warn("_3DSpace_Upload_Doc | pushFileInFcs | onFailure",{url:ie,bodyRequest:ae,err:v}),i&&i(v)}})},w=>{console.warn("pushFileInFcs",w),i&&i(w)},w=>{c&&c({fileName:t,progress:w})})}}catch(S){i&&i(S)}},onFailure(f){console.warn("_3DSpace_Upload_Doc | onFailure"),i&&i(f)}})}catch{i&&i()}},onFailure(u){i&&i(u)}})}async function Ae(e,t,s,n=void 0,i=void 0){e.space,e.token,e.ctx,P(e,t,c=>{const a=c.data[0].relateddata.files[0].id,o=c.data[0].relateddata.files[0].dataelements.title;L(e,t,a,s,o,r=>{n&&n(r)},r=>{i&&i(r)})},c=>{i&&i(c)})}async function je(e,t,s,n,i=void 0,c=void 0){Pe(e,a=>{a?.items>=1&&a.data.forEach(o=>{V(o,t,s,r=>{Le(e,r,s,n,d=>{d?.data.length?i&&i(d):c&&c({success:!1,msg:"Erreur lors de la mise en ralation entre la document et le fichier"})},d=>console.warn(d))},r=>console.warn(r))})},a=>console.warn(a))}function Pe(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(i,c,a){try{i=JSON.parse(i)}catch{}t&&t(i)},onFailure(i){s&&s(i)}})}else console.log("Error de credentials",e)}function V(e,t,s,n=void 0,i=void 0,c=void 0){let a=new FormData;t instanceof Blob||(t=new Blob([t],{type:"text/plain"})),a.append("__fcs__jobTicket",e.dataelements.ticket),a.append("file_0",t,s);let o=e.dataelements.ticketURL;const r=new XMLHttpRequest;r.open("POST",o,!0),r.upload.onprogress=function(d){if(d.lengthComputable){const u=d.loaded/d.total*100;c&&c(u)}},r.onload=function(){r.status===200?n&&n(r.responseText.replace(/[\n\r]/g,"")):i&&i(r.statusText)},r.onerror=function(){i&&i(r.statusText)},r.send(a)}function Le(e,t,s,n=void 0,i=void 0,c=void 0){console.log("relatedDocAndFile",{credentials:e,receipt:t,filename:s});const a=d=>d.indexOf(".")===-1?d:d.split(".").slice(0,-1).join(".");let o="temp_"+D.DateTime.now().ts,r=e.space+"/resources/v1/modeler/documents/?e6w-lang=fr&e6w-timezone=-120&xrequestedwith=xmlhttprequest";_(r,{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:a(s),description:n},relateddata:{files:[{dataelements:{title:s,receipt:`${t}
2
+ `}}]},tempId:o}]}),onComplete(d){try{d=JSON.parse(d)}catch{}i&&i(d)},onFailure(d){c&&c(d)}})}function R(e,t=void 0,s=void 0,n=void 0,i=void 0,c=void 0,a=!1){const o=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;_(o,{method:"GET",onComplete(r){const d=JSON.parse(r);let u="",l,m,f;if(t){let g=d.collabspaces.find(h=>h.title===t);if(g){l=t;let h=g.couples;h=h.filter((S,y,C)=>y===C.findIndex(w=>w.organization.pid===S.organization.pid&&w.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 C=h.filter(w=>w.role.name===S);C.length===1?(f=C[0].role.name,m=C[0].organization.title):c(C)}})}):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(C=>C.role.name===s);y.length===1?(f=y[0].role.name,m=y[0].organization.title):c(y)}}))}}l&&m&&f?(u=f+"."+m+"."+l,i(u)):d.preferredcredentials&&a?(u=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,i(u)):c&&(u=f+"."+m+"."+l,c(u))},onFailure(r,d){console.warn("Erreur de récupération du contexte de sécurité. => ",{err:r,headers:d})}})}async function M(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)&&X(e,n=>{e.token=n},n=>{console.log("☠️ error => ",n)}),new Promise((n,i)=>{k(e,c=>{e?.returnType==="blob"?(console.log("ticketURL blob",c),fetch(c).then(a=>a.blob()).then(a=>{t&&t(a)}).catch(a=>{s&&s(a)})):_(c,{onComplete(a){let o;try{o=JSON.parse(a)}catch{o=a}t&&typeof t=="function"&&t(o),n(o)},onFailure(a,o,r){s&&(console.log("error http",a),s({msg:JSON.parse(a),headers:o,xhr:r}),i({msg:JSON.parse(a),headers:o,xhr:r}))}})},c=>{s&&s(c),console.log("*_3dspace_download_doc / error file URL *",c),i(c)})})}async function Y(e,t,s=void 0,n=void 0){typeof t<"u"&&Array.isArray(t)&&t?.length>0?B({credentials:e,myArray:t,chunk:80,fn_to_call:H},c=>{s&&s(c)}):(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 H(e,t,s=void 0,n=void 0,i=void 0){const c=[];t.forEach(r=>{c.push({id:r})});let a=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:c});const o=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;_(o,{method:"PUT",data:a,type:"json",onComplete(r){const d=r.data;r.success===!0&&(s&&s(),d.forEach(u=>{try{const l=u.dataelements.fileName,m=u.dataelements.ticketURL;_(m,{onComplete:(f,g)=>{let h;try{h=JSON.parse(f)}catch{h=f.blob()}n&&n({objectId:u.id,headers:g,fileName:l,data:h})},onFailure:f=>{console.log("error http",f)}})}catch(l){console.log(l),i&&i(l)}}))},onFailure(r){console.log(r),i&&i(r)}})}function Me(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;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}]}),type:"json",onComplete(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function Je(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const a=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;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,nextState:s}]}),type:"json",onComplete(r){n&&n(r)},onFailure(r){i&&i(r)}};_(a,o)}})}function xe(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});let a={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(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function Ge(e,t,s=void 0,n=void 0){return new Promise(i=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const c=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)});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:[{"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(o){s&&s(o)},onFailure(o){n&&n(o)}};_(c,a)}})}function qe(e,t,s,n=void 0,i=void 0){return new Promise(c=>{if(e.token===""&&b(e),t!==void 0&&t!==""&&t!==null){const a=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;R(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,r=>e.ctx=r,r=>{console.log("onError =>",r)});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:[{physicalid:t,proposedRevision:s,modifiedAttributes:{revision:s}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(r){n&&n(r)},onFailure(r){i&&i(r)}};_(a,o)}})}function Be(e){return new Promise((t,s)=>{const n=`${e.space}/resources/pno/person/getsecuritycontext&tenant=${e.tenant.toUpperCase()}&xrequestedwith=xmlhttprequest`;_(n,{method:"GET",onComplete(c){t(c)},onFailure(c){s(c)}})})}function Ke(e,t,s=void 0,n=void 0){return new Promise(async(i,c)=>{const{tenant:a,ctx:o,space:r}=e;(!a||!o||!r)&&c({error:"Erreur de credentials",tenant:a,ctx:o,space:r});const d=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=1&withAttributes=1&withCopyFrom=1&tenant=${e.tenant.toUpperCase()}&xrequestedwith=xmlhttprequest`;let u;await Be(e).then(m=>u=m?.SecurityContext);let l={method:"POST",headers:{securitycontext:"ctx::"+u,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t,attributes:["revision","policy"]}]}),type:"json",onComplete(m){s&&s(m),i(m)},onFailure(m){n&&n(m),c(m)}};_(d,l)})}function Ee(e,t,s,n,i=void 0,c=void 0){return new Promise(a=>{const o=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let r={attributes:{title:s,description:n,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(r);let u={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(l){i&&i(l)},onFailure(l){c&&c(l)}};_(o,u)})}function Xe(e,t,s,n,i=void 0,c=void 0){return console.log("credentials",e),new Promise(a=>{`${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
3
  function We(e,t=void 0,s=void 0){const n={base:`${e.space}`,uri:"/resources/bps/cspaces",optTenant:`tenant=${e.tenant}`},i=`${n.base}${n.uri}?${n.optTenant}`;_(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","Content-Type":"application/ds-json"},onComplete(c,a){const o=JSON.parse(c);t&&t(o,a)},onFailure(c,a,o){s&&s({response:c,headers:a,xhr:o})}})}function Ve(e,t,s,n){k(e.space,t,i=>{_(i,{header:{ENO_CSRF_TOKEN:e.token},onComplete:c=>{s&&s(c)},onFailure:c=>{console.log("error http",c),n&&n(c)}})})}async function Ye(e,t,s=void 0,n=void 0){return new Promise(i=>{k(e,t,c=>{_(c,{onComplete:(a,o,r)=>(i(JSON.parse(a)),s&&s(JSON.parse(a),o,r),i),onFailure:(a,o,r)=>{n&&n(a,o,r),console.log(a,o?.errormsg)}})})})}function He(e,t,s,n=void 0,i=void 0){const c=new Blob([JSON.stringify(t)],{type:"text/plain"});e={...e,objID:s},F(e,a=>{console.log("_3DSpace_get_csrf | onDone | data",a);const o=a.datas.relateddata.files[0].id,r=a.datas.relateddata.files[0].dataelements.title;L(e,s,o,c,r,d=>{n&&n(d)},d=>{i&&i(d)})},a=>{console.log("En cas d'erreur nous avons :",a),alert("Erreur lors de la sauvegarde, Veuillez réessayez"),i&&i(a)})}let z,Q;const Z=[];async function ze(e,t=void 0,s=void 0){e.objID&&e.objID!==""?F(e,n=>{t&&t(n)},n=>{s&&s(n)}):(e.objID===null||e.objID==="")&&b(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 Qe(e,t=void 0,s=void 0){console.log("getDatasByTenant (getDocuments)",e),await M(e,n=>{const i={};i.obj=n,console.log("getDatasByTenant (getDocuments) _datas",i),t&&t?.(i)},n=>{s&&s?.(n)})}function Ze(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((i,c)=>{M(e,i.objID,a=>{n.push({[i.name]:a}),i.name==="dbProjets"&&(z=a.affaires.map(o=>o.objectID),ee(e,Q)),c===e.objIds.length-1&&(t&&t(n),delete e.objIds,delete e.datas)})})}function ee(e,t,s=void 0,n=void 0){Y(e,z,i=>{const c=[...t];c.find(a=>a.objectID===i.objectId).data=i.data,Q=c,Z.push(i.data),s&&s(Z)},i=>{n&&(n(i),console.log(i))})}const et="FA35FB9B177A280065800EA0000F599C",tt=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],te={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},nt={objId:et,pred:"who",order_by:"desc",tag:"testTag"};function st(e,t,s=void 0,n=void 0){const{space:i,tenant:c}=e,{objId:a,pred:o,tag:r}=t,d={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${c}`},u=`${i}${d.uri}?${d.otpCTX}&${d.optTenant}`,l={tag:[{subject:[{uri:`pid://${a}`}],predicate:te[o],object:{literal:r}}]};_(u,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(l),onComplete(m){JSON.parse(m);const f={};setTimeout(()=>{P(e,a,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},it(e,t,C=>{s&&s(C)},C=>{n&&n(C)})},(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 it(e,t,s=void 0,n=void 0){console.log("obj ",t);const i=t.info.name,c={baseUrl:`https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,uri:"/federated/search"},a=`${c.baseUrl}${c.uri}`,o={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},r=G(),d={with_indexing_date:!0,with_synthesis:!0,with_nls:!1,label:`3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${r}`,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:nt.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:tt,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),_(a,{method:"POST",headers:o,data:JSON.stringify(d),onComplete(u){const l=JSON.parse(u);s(l)},onFailure(u,l){const m=u;m.msg=l.errormsg,m.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",m),n&&n(m),console.log("Erreur de recuperation d'id du doc et des tags",u)}})}function at(e,t,s=void 0,n=void 0){const{objId:i,pred:c,tag:a}=t,o={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${e.tenant}`},r=`${e.space}${o.uri}?${o.otpCTX}&${o.optTenant}`,d={tag:[{subject:[{uri:`pid://${i}`}],predicate:te[c],object:{literal:a}}]};_(r,{method:"DELETE",data:JSON.stringify(d),headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},onComplete(u){s&&s(u)},onFailure(u,l){const m=u;m.msg=l.errormsg,m.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",m),n&&n(m)}})}function ot(e,t="",s=void 0,n=void 0){const{space:i}=e;if(t==="")return;const c={uri:"/resources/v1/modeler/documents"},a={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json,text/javascript,*/*"},o=`${i}${c.uri}`,r=`$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}`;_(o,{method:"POST",headers:a,data:r,onComplete(d){s&&s(JSON.parse(d))},onFailure(d,u){const l=d;l.msg=u.error,n&&n(l)}})}async function T(e,t=void 0,s=void 0){const n=e._3DSwym+"/api/index/tk";return _(n,{onComplete(i,c,a){const o=JSON.parse(i);if(t)return t(o),e.token=o?.result?.ServerToken},onFailure(i){s&&s(i)}})}function ct(e,t=void 0,s=void 0){const n=`${e._3DSwym}/api/exalead/whatsnew`,i={params:{community_id:null,hash_key:null,legacyFormat:!1,nresults:1,query:"#all",start:0}};T(e,c=>{_(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(a,o){t&&t(a,o)},onFailure(a,o){s&&s(a,o)}})})}function rt(e,t=void 0,s=void 0){const n=`${e._3DSwym}/api/Recommendation/getpeoplefamiliartocurrentuser`,i={params:{idsToFilterArr:[],mode:"offline",limit:30,itemType:"User",maxNbOfCommonElements:"5"}};T(e,c=>{_(n,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(i),type:"json",onComplete(a,o){const r=a.result.hits.map(d=>({login:d.login,fullName:d.name}));t&&t(r,a)},onFailure(a,o){s&&s(a,o)}})})}function dt(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"}`},i=`${n.base}${n.uri}${n.limit}${n.page}`,c=[];T(e,a=>{_(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},onComplete(o,r,d){const l=JSON.parse(o).result;let m=0;l.forEach(f=>{const g={description:f.description,id:f.id,title:f.title,owner:f.owner,role:f.role,access:f.access};ne(e,f.id,h=>{m++,g.members=h,c.push(g),m===l.length&&t&&t(c)},h=>s(h))})},onFailure(o,r){const d=o;d.status=r.status,d.response=r.errormsg,s&&s(d)}})})}function ne(e,t,s,n){const i=`${e._3DSwym}/api/community/listmembers`,c={params:{page:e.page?e.page:1,limit:e.limit?e.limit:50,community_id:t}};T(e,a=>{_(i,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},data:JSON.stringify(c),type:"json",onComplete(o,r,d){s&&s(o)},onFailure(o,r){const d=o;d.status=r.status,d.response=r.errormsg,n&&n(d)}})})}function ut(e,t=void 0,s=void 0){const n="YXdA5x4DSUKtlAi2wmnyTA";e.commu_id||(e.commu_id=n);const i=`${e._3DSwym}/api/v2/communities/${e.commu_id}/ideas/statuses`;T(e,c=>{_(i,{method:"GET",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(a){const o=JSON.parse(a);t&&t(o)},onFailure(a,o){const r=a;r.status=o.status,r.response=o.errormsg,s&&s(r)}})})}function lt(e,t,s=void 0,n=void 0){const{listAllContacts:i,currentUser:c,_3DSwym:a}=e;console.log("__listAllContacts",i.hits);const o=`${a}/api/directmessages`,r={users:[c.login].concat(t.receipt)},d={id_msg:"",senderId:e.currentUser.login,senderName:`${e.currentUser.first_name} ${e.currentUser.last_name}`,msg:pt(t.msg)};let u=!1;se(r.users,l=>{l!==void 0&&(d.id_msg=l.id,u=!0,J(e,d))},l=>{u=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",l),n&&n(l),d.id_msg=""}),u===!1&&setTimeout(()=>{u===!1&&T(e,l=>{_(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":l.result.ServerToken},data:JSON.stringify(r),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,J(e,d)},onFailure(m,f,g){const h=m;h.msg=f.errormsg,h.status=f.status,n&&n(h)}})})},500)}function se(e,t,s,n){const i=`${e._3DSwym}/api/directmessages/lite?with_favorites=false`;T(e,c=>{_(i,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(a){const o=JSON.parse(a),r=[];o.result.forEach(l=>{l.users=l.users.sort((m,f)=>m.login.localeCompare(f.login)),l.users.length===t.length&&r.push(l)});const d=t.sort(),u=r.find(l=>{const m=[];return l.users.forEach(f=>{m.push(f.login)}),JSON.stringify(m)===JSON.stringify(d)});s&&u!==void 0?s(u):(n||u===void 0)&&n(u)},onFailure(a){const o=a;o.msg=headers.errormsg,o.errCode=headers.errorcode,console.log("❌ sendDirectMessageLite => ",o),n&&n(o)}})})}function J(e,t,s=void 0,n=void 0){const i={base:e._3DSwym,uri:"/api/community",id_msg:`${t.id_msg}`,endUri:"/instantmessages"},c=`${i.base}${i.uri}/${i.id_msg}${i.endUri}`,a={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 ",c),T(e,o=>{_(c,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},data:JSON.stringify(a),type:"json",onComplete(r,d,u){const l=r;l.status=u.status,l.response=JSON.parse(u.response),console.log("✅ _3dSwym_sendDirectMessageData => ",l),s&&s(l)},onFailure(r,d){const u=r;u.msg=d.errormsg,u.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",u),n&&n(u)}})})}function pt(e){const t=new Date().toLocaleDateString(),s=new Date().toLocaleTimeString();return`<p>${e} </p>
4
4
  <br/>
5
5
  <hr/>
@@ -75,7 +75,7 @@ function We(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 wt(e,t=void 0,s=void 0){const{tenant:n,_3DSwym:i,_3DSwym_token:c,community_id:a,idea_id:o}=e;if(n&&i&&c&&a&&o){const r=`${i}/api/idea/forward`;_(r,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c},data:JSON.stringify({community_uri:`swym:prd:${n.toUpperCase()}:community:${a}`,content_uri:`swym:prd:${n.toUpperCase()}:idea:${o}`,timeout:3e4}),type:"json",onComplete(d){t&&t(d)},onFailure(d,u){const l=d;l.status=u.status,l.response=u.errormsg,s&&s(l)}})}else s&&s({status:"error",msg:"Credentials incomplet !",attend:"tenant, _3DSwym , _3DSwym_token, community_id, idea_id",credentials:e})}function Ct(e,t=void 0,s=void 0){return new Promise((n,i)=>{try{let c;if(e._3DDashboard){const a=e._3DDashboard+"/api/users/current";console.log("_3DSwym_get_currentUser | url",a),_(a,{method:"GET",onComplete(o,r,d){let u=o.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,"");u=u.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,""),console.log("result",u);let l={};try{l=JSON.parse(u)}catch(m){i("ERROR | _3DSwym_get_currentUser => JSON.Parse()",m)}console.log(l),l.first_name=l?.firstName?l.firstName:"",l.last_name=l?.lastName?l.lastName:"",console.log("_3DSwym_get_currentUser | info",l),c=l,n(l)},onFailure(o){i("ERROR | _3DSwym_get_currentUser => _3DDashboard + /api/users/current",o)}})}c?n(c):i("ERROR | _3DSwym_get_currentUser => CURRENT_USER is null")}catch(c){i("ERROR | _3DSwym_get_currentUser => ",c)}})}function Tt(e,t,s=void 0,n=void 0){const i=e.space+"/api/user/find/login/"+t;T(e,c=>{_(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(a,o,r){const d=JSON.parse(a);s&&s(d)},onFailure(a){n&&n(a)}})},n)}function bt(e,t=void 0,s=void 0){const{_3DSwym:n,_3DSwym_token:i,subjectUri:c,richMessage:a}=e,o=`${n}/commentproxy/subjects/${c}/comments`,d={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i},data:JSON.stringify({richMessage:a}),type:"json",onComplete(u,l,m){const f={response:typeof u=="string"?JSON.parse(u):u};f.status=m.status,t&&t(f)},onFailure(u){s&&s(u)}};_(o,d)}function Ot(e,t=void 0,s=void 0){e.tenant&&A(e,n=>{const i=n.services.find(c=>c.id==="businessprocess")?.url+"/api/v2";return t&&t(i),i})}function Dt(e,t=void 0,s=void 0){console.log("_Iterop_Auth_CAS"),e.tenant&&A(e,n=>{console.log("serviceUrls",n);const i=n.services.find(o=>o.id==="3dpassport")?.url,c=n.services.find(o=>o.id==="businessprocess")?.url+"/api/v2",a=`${i}/login/?cors=false&service=${c}/auth/cas`;_(a,{async onComplete(o){console.log("response",o);const r=typeof o=="string"?JSON.parse(o)?.x3ds_service_redirect_url:o?.x3ds_service_redirect_url;await fetch(r,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(o){s&&s(o)}})})}function $t(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(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{s&&s(i)})}}async function It(e,t,s=void 0,n=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(c=>c.json()).then(c=>{s&&s(c)}).catch(c=>{n&&n(c)})}}async function Nt(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/businesstable/one/${s}?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Ut(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/businesstable/rows/${s}/?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Ft(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/businesstable/patch/rows/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c(o,s,n)})}}async function Rt(e,t,s,n,i,c=void 0,a=void 0){if(e.tenant){const o=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/search/rows/${s}?t=${t}&c=${encodeURIComponent(n)}&b=${encodeURIComponent(i)}`;fetch(o,{method:"POST"}).then(r=>r.json()).then(r=>{r.url=o,c&&c(r)}).catch(r=>{a&&a({error:r,tableId:s,columns:n,body:i})})}}async function kt(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/update/${s}?t=${t}&b=${encodeURIComponent(n)}`;fetch(a,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c({error:o,url:a})})}}async function vt(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/create/?t=${t}&b=${encodeURIComponent(s)}`;fetch(c,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i({error:a,url:c})})}}async function At(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/runtime/processes/${s}?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{console.log("_Iterop_runProcess : OK"),i&&i(o)}).catch(o=>{c&&c(o)})}}async function jt(e,t,s,n=void 0,i=void 0){if(console.log("_Iterop_GetOneDependencyTable | Run"),e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/dependencytable/one/${s}/?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Pt(e,t,s,n,i,c=void 0,a=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/dependencytable/patch/${s}/?t=${t}&cli=${n}&b=${i}`,{method:"POST"}).then(r=>r.json()).then(r=>{c&&c(r)}).catch(r=>{a&&a(r)})}}async function Lt(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/dependencytable/put/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c(o)})}}//!SECTION
78
+ </p>`:e}function wt(e,t=void 0,s=void 0){const{tenant:n,_3DSwym:i,_3DSwym_token:c,community_id:a,idea_id:o}=e;if(n&&i&&c&&a&&o){const r=`${i}/api/idea/forward`;_(r,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":c},data:JSON.stringify({community_uri:`swym:prd:${n.toUpperCase()}:community:${a}`,content_uri:`swym:prd:${n.toUpperCase()}:idea:${o}`,timeout:3e4}),type:"json",onComplete(d){t&&t(d)},onFailure(d,u){const l=d;l.status=u.status,l.response=u.errormsg,s&&s(l)}})}else s&&s({status:"error",msg:"Credentials incomplet !",attend:"tenant, _3DSwym , _3DSwym_token, community_id, idea_id",credentials:e})}function Ct(e,t=void 0,s=void 0){return new Promise((n,i)=>{try{let c;if(e._3DDashboard){const a=e._3DDashboard+"/api/users/current";console.log("_3DSwym_get_currentUser | url",a),_(a,{method:"GET",onComplete(o,r,d){let u=o.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,"");u=u.replace(/\"\[/g,"[").replace(/\]\"/g,"]").replace(/\"{/g,"{").replace(/}\"/g,"}").replace(/\\/g,""),console.log("result",u);let l={};try{l=JSON.parse(u)}catch(m){i("ERROR | _3DSwym_get_currentUser => JSON.Parse()",m)}console.log(l),l.first_name=l?.firstName?l.firstName:"",l.last_name=l?.lastName?l.lastName:"",console.log("_3DSwym_get_currentUser | info",l),c=l,n(l)},onFailure(o){i("ERROR | _3DSwym_get_currentUser => _3DDashboard + /api/users/current",o)}})}c?n(c):i("ERROR | _3DSwym_get_currentUser => CURRENT_USER is null")}catch(c){i("ERROR | _3DSwym_get_currentUser => ",c)}})}function Tt(e,t,s=void 0,n=void 0){const i=e.space+"/api/user/find/login/"+t;T(e,c=>{_(i,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":c.result.ServerToken},onComplete(a,o,r){const d=JSON.parse(a);s&&s(d)},onFailure(a){n&&n(a)}})},n)}function bt(e,t=void 0,s=void 0){const{_3DSwym:n,_3DSwym_token:i,subjectUri:c,richMessage:a}=e,o=`${n}/commentproxy/subjects/${c}/comments`,d={method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i},data:JSON.stringify({richMessage:a}),type:"json",onComplete(u,l,m){const f={response:typeof u=="string"?JSON.parse(u):u};f.status=m.status,t&&t(f)},onFailure(u){s&&s(u)}};_(o,d)}function Ot(e,t=void 0,s=void 0){e.tenant&&A(e,n=>{const i=n.services.find(c=>c.id==="businessprocess")?.url+"/api/v2";return t&&t(i),i})}function Dt(e,t=void 0,s=void 0){console.log("_Iterop_Auth_CAS"),e.tenant&&A(e,n=>{console.log("serviceUrls",n);const i=n.services.find(o=>o.id==="3dpassport")?.url,c=n.services.find(o=>o.id==="businessprocess")?.url+"/api/v2",a=`${i}/login/?cors=false&service=${c}/auth/cas`;_(a,{async onComplete(o){console.log("response",o);const r=typeof o=="string"?JSON.parse(o)?.x3ds_service_redirect_url:o?.x3ds_service_redirect_url;await fetch(r,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(o){s&&s(o)}})})}function $t(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(i=>i.json()).then(i=>{t&&t(i)}).catch(i=>{s&&s(i)})}}async function It(e,t,s=void 0,n=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(c=>c.json()).then(c=>{s&&s(c)}).catch(c=>{n&&n(c)})}}async function Ut(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/businesstable/one/${s}?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Nt(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/businesstable/rows/${s}/?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Ft(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/businesstable/patch/rows/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c(o,s,n)})}}async function Rt(e,t,s,n,i,c=void 0,a=void 0){if(e.tenant){const o=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/search/rows/${s}?t=${t}&c=${encodeURIComponent(n)}&b=${encodeURIComponent(i)}`;fetch(o,{method:"POST"}).then(r=>r.json()).then(r=>{r.url=o,c&&c(r)}).catch(r=>{a&&a({error:r,tableId:s,columns:n,body:i})})}}async function kt(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/update/${s}?t=${t}&b=${encodeURIComponent(n)}`;fetch(a,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c({error:o,url:a})})}}async function vt(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=`https://api.uixhome.fr/${e.tenant.toLowerCase()}/iterop/businesstable/post/create/?t=${t}&b=${encodeURIComponent(s)}`;fetch(c,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i({error:a,url:c})})}}async function At(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/runtime/processes/${s}?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{console.log("_Iterop_runProcess : OK"),i&&i(o)}).catch(o=>{c&&c(o)})}}async function jt(e,t,s,n=void 0,i=void 0){if(console.log("_Iterop_GetOneDependencyTable | Run"),e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/dependencytable/one/${s}/?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}async function Pt(e,t,s,n,i,c=void 0,a=void 0){if(e.tenant){const o=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${o}/iterop/dependencytable/patch/${s}/?t=${t}&cli=${n}&b=${i}`,{method:"POST"}).then(r=>r.json()).then(r=>{c&&c(r)}).catch(r=>{a&&a(r)})}}async function Lt(e,t,s,n,i=void 0,c=void 0){if(e.tenant){const a=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${a}/iterop/dependencytable/put/${s}/?t=${t}&b=${n}`,{method:"POST"}).then(o=>o.json()).then(o=>{i&&i(o)}).catch(o=>{c&&c(o)})}}//!SECTION
79
79
  async function Mt(e,t,s,n=void 0,i=void 0){if(e.tenant){const c=e.tenant.toLowerCase();fetch(`https://api.uixhome.fr/${c}/iterop/list/one/${s}/?t=${t}`,{method:"POST"}).then(a=>a.json()).then(a=>{n&&n(a)}).catch(a=>{i&&i(a)})}}//!SECTION
80
- function Jt(e){const t="Hello "+e;return console.log(t),t}function xt(e,t=void 0,s=void 0){return console.log("credentials",e),new Promise(n=>{if(e.token===""&&b(e),!e.space||e.space===""){const a=B();console.log("platformeInfo",a)}R(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)},!0);const i=D.DateTime.now().ts,c=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;_(c,{onComplete(a){if(Array.isArray(JSON.parse(a))){const o=JSON.parse(a);console.log("serviceId=3dsearch",o);const r=`${o[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;_(r,{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){s&&s(d)}})}},onFailure(a){s&&s(a)}})})}p.UUID=G,p._3DSearch_usersGroup=xt,p._3DSpace_Create_Doc=je,p._3DSpace_Update_Doc=Ae,p._3DSpace_Upload_File=ve,p._3DSpace_bookmark_addSubsciptions=Xe,p._3DSpace_bookmark_newWorkspace=Ee,p._3DSpace_csrf=b,p._3DSpace_download_doc=M,p._3DSpace_download_multidoc=Y,p._3DSpace_file_update=L,p._3DSpace_file_update_csr=W,p._3DSpace_file_url_csr=Re,p._3DSpace_get_csrf=F,p._3DSpace_get_docInfo=P,p._3DSpace_get_downloadTicket_multidoc=H,p._3DSpace_get_multiDocInfo=Fe,p._3DSpace_get_securityContexts=R,p._3DSpace_get_ticket=k,p._3DSpace_lifecycle_changeRevision=qe,p._3DSpace_lifecycle_changeState=Je,p._3DSpace_lifecycle_getGraph=xe,p._3DSpace_lifecycle_getNextRevision=Ge,p._3DSpace_lifecycle_getNextStates=Me,p._3DSpace_lifecycle_getRevisions=Be,p._3DSpace_put_docInfo=ke,p._3DSwym_ForwardIdea=wt,p._3DSwym_addComment=bt,p._3DSwym_buildDirectMessage=lt,p._3DSwym_deleteIdea=_t,p._3DSwym_editIdea=ht,p._3DSwym_findCommunityToInstantMSG=se,p._3DSwym_getAllCommunities=dt,p._3DSwym_getAllListIdeas=St,p._3DSwym_getAllNews=ct,p._3DSwym_getFamiliarPeople=rt,p._3DSwym_getIdeaStatusMaturity=ut,p._3DSwym_getMembersCommunity=ne,p._3DSwym_getOneIdea=gt,p._3DSwym_get_Token=T,p._3DSwym_get_currentUser=Ct,p._3DSwym_get_findUser=Tt,p._3DSwym_postIdea=mt,p._3DSwym_postIdeaTemplate=ft,p._3DSwym_sendMessageData=J,p._AppMngt_get_info_user=ye,p._AppMngt_get_users=Se,p._Iterop_AddOrRemoveRows=Ft,p._Iterop_Auth_CAS=Dt,p._Iterop_GetOneDependencyTable=jt,p._Iterop_GetOneList=Mt,p._Iterop_PatchDependencyTable=Pt,p._Iterop_PutDependencyTable=Lt,p._Iterop_businessTableSearchInRows=Rt,p._Iterop_createBusinessTable=vt,p._Iterop_getAllBusinessTables=It,p._Iterop_getOneBusinessTable=Nt,p._Iterop_getOneBusinessTableRows=Ut,p._Iterop_jwtUser=$t,p._Iterop_runProcess=At,p._Iterop_updateBusinessTable=kt,p._getMe=_e,p._getPlateformInfos=B,p._getPlatformServices=me,p._getServiceUrl=A,p._getServiceUrl_3DPassport=ge,p._getServiceUrl_Iterop=Ot,p._httpCallAuthenticated=_,p._setDraggable=le,p._setDroppable=fe,p._setupTagger=pe,p.addTagToDoc=st,p.chunkArray=K,p.compass_getListAdditionalApps=he,p.couleurs=q,p.createUserGroups=we,p.dataMixing=ee,p.deleteUserGroups=be,p.findAdresse=ce,p.getAllContextSecurity=We,p.getCSRFToken=X,p.getCommunes=oe,p.getComplementUG=Ce,p.getDataFrom3DSpace=Ve,p.getDataFromGouvFr=re,p.getDatasByTenant=Qe,p.getDatasFrom3DSpace=Ze,p.getDownloadDocument=Ye,p.getInfoDocTags=ot,p.getUserGroupsList=Te,p.getUsersGroupRules=E,p.get_3DSpace_csrf=ze,p.patchUserGroups=Oe,p.patchUserGroupsControl=De,p.pushDataIn3DSpace=He,p.readUserGroupControl=$e,p.removeTagToDoc=at,p.sayHello=Jt,p.updateEvent=ue,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
80
+ function Jt(e){const t="Hello "+e;return console.log(t),t}function xt(e,t=void 0,s=void 0){return console.log("credentials",e),new Promise(n=>{if(e.token===""&&b(e),!e.space||e.space===""){const a=K();console.log("platformeInfo",a)}R(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,a=>e.ctx=a,a=>{console.log("onError =>",a)},!0);const i=D.DateTime.now().ts,c=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;_(c,{onComplete(a){if(Array.isArray(JSON.parse(a))){const o=JSON.parse(a);console.log("serviceId=3dsearch",o);const r=`${o[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;_(r,{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){s&&s(d)}})}},onFailure(a){s&&s(a)}})})}p.UUID=G,p._3DSearch_usersGroup=xt,p._3DSpace_Create_Doc=je,p._3DSpace_Update_Doc=Ae,p._3DSpace_Upload_File=ve,p._3DSpace_bookmark_addSubsciptions=Xe,p._3DSpace_bookmark_newWorkspace=Ee,p._3DSpace_csrf=b,p._3DSpace_download_doc=M,p._3DSpace_download_multidoc=Y,p._3DSpace_file_update=L,p._3DSpace_file_update_csr=W,p._3DSpace_file_url_csr=Re,p._3DSpace_get_csrf=F,p._3DSpace_get_docInfo=P,p._3DSpace_get_downloadTicket_multidoc=H,p._3DSpace_get_multiDocInfo=Fe,p._3DSpace_get_securityContexts=R,p._3DSpace_get_ticket=k,p._3DSpace_lifecycle_changeRevision=qe,p._3DSpace_lifecycle_changeState=Je,p._3DSpace_lifecycle_getGraph=xe,p._3DSpace_lifecycle_getNextRevision=Ge,p._3DSpace_lifecycle_getNextStates=Me,p._3DSpace_lifecycle_getRevisions=Ke,p._3DSpace_put_docInfo=ke,p._3DSwym_ForwardIdea=wt,p._3DSwym_addComment=bt,p._3DSwym_buildDirectMessage=lt,p._3DSwym_deleteIdea=_t,p._3DSwym_editIdea=ht,p._3DSwym_findCommunityToInstantMSG=se,p._3DSwym_getAllCommunities=dt,p._3DSwym_getAllListIdeas=St,p._3DSwym_getAllNews=ct,p._3DSwym_getFamiliarPeople=rt,p._3DSwym_getIdeaStatusMaturity=ut,p._3DSwym_getMembersCommunity=ne,p._3DSwym_getOneIdea=gt,p._3DSwym_get_Token=T,p._3DSwym_get_currentUser=Ct,p._3DSwym_get_findUser=Tt,p._3DSwym_postIdea=mt,p._3DSwym_postIdeaTemplate=ft,p._3DSwym_sendMessageData=J,p._AppMngt_get_info_user=ye,p._AppMngt_get_users=Se,p._Iterop_AddOrRemoveRows=Ft,p._Iterop_Auth_CAS=Dt,p._Iterop_GetOneDependencyTable=jt,p._Iterop_GetOneList=Mt,p._Iterop_PatchDependencyTable=Pt,p._Iterop_PutDependencyTable=Lt,p._Iterop_businessTableSearchInRows=Rt,p._Iterop_createBusinessTable=vt,p._Iterop_getAllBusinessTables=It,p._Iterop_getOneBusinessTable=Ut,p._Iterop_getOneBusinessTableRows=Nt,p._Iterop_jwtUser=$t,p._Iterop_runProcess=At,p._Iterop_updateBusinessTable=kt,p._getMe=_e,p._getPlateformInfos=K,p._getPlatformServices=me,p._getServiceUrl=A,p._getServiceUrl_3DPassport=ge,p._getServiceUrl_Iterop=Ot,p._httpCallAuthenticated=_,p._setDraggable=le,p._setDroppable=fe,p._setupTagger=pe,p.addTagToDoc=st,p.chunkArray=B,p.compass_getListAdditionalApps=he,p.couleurs=q,p.createUserGroups=we,p.dataMixing=ee,p.deleteUserGroups=be,p.findAdresse=ce,p.getAllContextSecurity=We,p.getCSRFToken=X,p.getCommunes=oe,p.getComplementUG=Ce,p.getDataFrom3DSpace=Ve,p.getDataFromGouvFr=re,p.getDatasByTenant=Qe,p.getDatasFrom3DSpace=Ze,p.getDownloadDocument=Ye,p.getInfoDocTags=ot,p.getUserGroupsList=Te,p.getUsersGroupRules=E,p.get_3DSpace_csrf=ze,p.patchUserGroups=Oe,p.patchUserGroupsControl=De,p.pushDataIn3DSpace=He,p.readUserGroupControl=$e,p.removeTagToDoc=at,p.sayHello=Jt,p.updateEvent=ue,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
81
81
  //# sourceMappingURL=wb3Api.umd.cjs.map