@inweb/client 26.1.1 → 26.1.3

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.
Files changed (44) hide show
  1. package/dist/client.js +449 -434
  2. package/dist/client.js.map +1 -1
  3. package/dist/client.min.js +1 -1
  4. package/dist/client.module.js +37 -74
  5. package/dist/client.module.js.map +1 -1
  6. package/lib/Api/Assembly.d.ts +69 -65
  7. package/lib/Api/ClashTest.d.ts +16 -16
  8. package/lib/Api/Client.d.ts +77 -78
  9. package/lib/Api/Endpoint.d.ts +6 -6
  10. package/lib/Api/FetchError.d.ts +5 -5
  11. package/lib/Api/File.d.ts +132 -120
  12. package/lib/Api/IHttpClient.d.ts +3 -4
  13. package/lib/Api/IRole.d.ts +6 -6
  14. package/lib/Api/ISharedLink.d.ts +1 -1
  15. package/lib/Api/IUser.d.ts +4 -4
  16. package/lib/Api/Job.d.ts +12 -12
  17. package/lib/Api/Member.d.ts +6 -6
  18. package/lib/Api/Model.d.ts +18 -18
  19. package/lib/Api/OAuthClient.d.ts +10 -10
  20. package/lib/Api/Permission.d.ts +20 -17
  21. package/lib/Api/Project.d.ts +13 -14
  22. package/lib/Api/Role.d.ts +2 -2
  23. package/lib/Api/SharedLink.d.ts +2 -2
  24. package/lib/Api/User.d.ts +31 -33
  25. package/package.json +2 -2
  26. package/src/Api/Assembly.ts +70 -66
  27. package/src/Api/ClashTest.ts +16 -16
  28. package/src/Api/Client.ts +77 -78
  29. package/src/Api/Endpoint.ts +6 -6
  30. package/src/Api/FetchError.ts +5 -5
  31. package/src/Api/File.ts +133 -121
  32. package/src/Api/IHttpClient.ts +3 -4
  33. package/src/Api/IRole.ts +6 -6
  34. package/src/Api/ISharedLink.ts +1 -1
  35. package/src/Api/IUser.ts +4 -4
  36. package/src/Api/Job.ts +12 -12
  37. package/src/Api/Member.ts +6 -6
  38. package/src/Api/Model.ts +18 -18
  39. package/src/Api/OAuthClient.ts +10 -10
  40. package/src/Api/Permission.ts +20 -17
  41. package/src/Api/Project.ts +13 -14
  42. package/src/Api/Role.ts +2 -2
  43. package/src/Api/SharedLink.ts +2 -2
  44. package/src/Api/User.ts +31 -33
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Api=t.ODA.Api||{}))}(this,(function(t){"use strict";class e{constructor(t,e,s={}){this.path=t,this.httpClient=e,this.headers=s}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}getEndpointPath(t){return this.appendVersionParam(`${this.path}${t}`)}get(t,e){return this.httpClient.get(this.getEndpointPath(t),{signal:e,headers:this.headers})}post(t,e){return this.httpClient.post(this.getEndpointPath(t),e,{headers:this.headers})}put(t,e){return this.httpClient.put(this.getEndpointPath(t),e,{headers:this.headers})}delete(t){return this.httpClient.delete(this.getEndpointPath(t),{headers:this.headers})}useVersion(t){return this._useVersion=t,this}}const s={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};function r(t){return s[t]||`Error ${t}`}function i(t,e="400"){try{return JSON.parse(t).description}catch{return e}}class a extends Error{constructor(t,e){super(e||r(t)),this.name="FetchError",this.status=t,this.statusText=r(t)}}class n extends e{constructor(t,e){super(`${e.path}/downloads`,e.httpClient),this._data=t,this._file=e}get assembly(){return this._file}get data(){return this._data}set data(t){this._data=t}get database(){return this.data.database}get default(){return this.data.default}get file(){return this._file}get fileId(){return this.data.fileId}get geometry(){return this.data.geometry}get id(){return this.data.id}get name(){return this.data.name}get type(){return this.file.type}get version(){return this.data.version}getModels(){return Promise.resolve([this])}getModelTransformMatrix(t){return this.file.getModelTransformMatrix(t)}setModelTransformMatrix(t,e){return this.file.setModelTransformMatrix(t,e).then((()=>this))}getViewpoints(){return this._file.getViewpoints().then((t=>t.filter((({custom_fields:t={}})=>t.modelId===this.id||t.modelName===this.name))))}saveViewpoint(t){return this._file.saveViewpoint({...t,custom_fields:{...t.custom_fields,modelId:this.id,modelName:this.name}})}deleteViewpoint(t){return this._file.deleteViewpoint(t)}getSnapshot(t){return this._file.getSnapshot(t)}getSnapshotData(t,e){return this._file.getSnapshotData(t,e)}downloadResource(t,e,s){return this._file.downloadResource(t,e,s)}downloadResourceRange(t,e,s,r,i){return this._file.downloadResourceRange(t,e,s,r,i)}partialDownloadResource(t,e,s){return console.warn("Model.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Model.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){if(!e)return;let a=[];if(e.length)a=e.map((t=>({begin:Number(t.begin),end:Number(t.end),requestId:t.reqId})));else for(let s=0;s<e.size();s++){const r=e.get(s);a.push({begin:Number(r.begin),end:Number(r.end),requestId:t}),r.delete()}await this.downloadResourceRange(s,t,a,r,i)}getReferences(t){return this._file.getReferences(t)}}function o(t,e){return new Promise((s=>{let r=0;const i=()=>{clearTimeout(r),s(!0)};r=window.setTimeout((()=>{e.removeEventListener("abort",i),s(!1)}),t),e.addEventListener("abort",i,{once:!0})}))}async function h(t,e={}){var s,r,i;const a=e.timeout||6e5,n=e.interval||3e3,h=null!==(s=e.signal)&&void 0!==s?s:(new AbortController).signal,d=null!==(r=e.abortError)&&void 0!==r?r:new DOMException("Aborted","AbortError"),l=null!==(i=e.timeoutError)&&void 0!==i?i:new DOMException("Timeout","TimeoutError"),u=performance.now()+a;let p=a/n;do{if(await t(e))return Promise.resolve(e.result);if(await o(n,h)||h.aborted)return Promise.reject(d)}while(performance.now()<u&&--p>0);return Promise.reject(l)}function d(t){if("string"==typeof t){const e=t.indexOf("--");-1!==e&&(t=t.slice(e));const s=t.split("--").map((t=>t.split("=").map((t=>t.split(" "))).flat())).filter((t=>t[0])).map((t=>t.concat([""])));return Object.fromEntries(s)}return t||{}}function l(t,e="",s=""){var r;return t&&"string"!=typeof t?l(null!==(r=t.firstName)&&void 0!==r?r:t.name,t.lastName,t.userName):`${null!=t?t:""} ${null!=e?e:""}`.trim()||s}function u(t=""){const e=t.split(" ").filter((t=>t));return e.reduce(((t,s,r)=>(0!==r&&r!==e.length-1||(t+=s.charAt(0)),t)),"").toUpperCase()}class p extends e{constructor(t,e,s){super(`${e}/clashes/${t.id}`,s),this.data=t}get clearance(){return this.data.clearance}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName)}get id(){return this.data.id}get lastModifiedAt(){return this.data.lastModifiedAt}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get selectionSetA(){return this.data.selectionSetA}get selectionTypeA(){return this.data.selectionTypeA}get selectionSetB(){return this.data.selectionSetB}get selectionTypeB(){return this.data.selectionTypeB}get status(){return this.data.status}get tolerance(){return this.data.tolerance}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}getReport(){return this.get("/report").then((t=>t.json()))}}class c extends e{constructor(t,e){super(`/assemblies/${t.id}`,e),this.data=t}get activeVersion(){return this.data.activeVersion}get associatedFiles(){return this.data.associatedFiles}get created(){return this.data.created}get data(){return this._data}set data(t){var e,s;this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName),null!==(e=(s=this._data).associatedFiles)&&void 0!==e||(s.associatedFiles=[]),this._data.associatedFiles.forEach((t=>t.link=`${this.httpClient.serverUrl}/files/${t.fileId}`))}get files(){return this.data.files}get geometryType(){return"done"===this.status?"vsfx":""}get id(){return this.data.id}get name(){return this.data.name}set name(t){this.data.name=t}get originalAssemblyId(){return this.data.originalAssemblyId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl||""}get relatedJobs(){return this.data.relatedJobs}get status(){return this.data.status}get type(){return"assembly"}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}setPreview(t){return console.warn("Assembly does not support preview"),Promise.resolve(this)}deletePreview(){return console.warn("Assembly does not support preview"),Promise.resolve(this)}getModels(){return this.get("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){return this.data.transform[t]}setModelTransformMatrix(t,e){const s={...this.data.transform};return s[t]=e,this.update({transform:s})}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.get(e).then((t=>t.json()))}searchProperties(t){return this.post("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.get("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.get("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.post("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return super.delete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.get(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.get(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}downloadResource(t,e,s){return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${t}`),e,{signal:s,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,r,i){return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${t}?requestId=${e}`),e,s,r,{signal:i,headers:this.headers}).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("Assembly.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Assembly.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){await this.downloadResourceRange(s,t,e,r,i)}async getReferences(t){const s=new e("/files",this.httpClient,this.headers);return{id:"",references:await Promise.all(this.associatedFiles.map((t=>`/${t.fileId}/references`)).map((e=>s.get(e,t).then((t=>t.json()))))).then((t=>t.map((t=>t.references)))).then((t=>t.reduce(((t,e)=>[...e,...t]),[]))).then((t=>[...new Set(t.map(JSON.stringify))].map((t=>JSON.parse(t)))))}}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}getClashTests(t,e,s,r,i,a){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&n.set("id",r)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),a&&n.set("sortField",a);let o=n.toString();return o&&(o="?"+o),this.get(`/clashes${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new p(t,this.path,this.httpClient)))})))}getClashTest(t){return this.get(`/clashes/${t}`).then((t=>t.json())).then((t=>new p(t,this.path,this.httpClient)))}createClashTest(t,e,s,r,i,a){const{tolerance:n,clearance:o,waitForDone:h}=null!=a?a:{};return Array.isArray(r)||(r=[r]),Array.isArray(i)||(i=[i]),this.post("/clashes",{name:t,selectionTypeA:e,selectionTypeB:s,selectionSetA:r,selectionSetB:i,tolerance:n,clearance:o}).then((t=>t.json())).then((t=>new p(t,this.path,this.httpClient))).then((t=>h?t.waitForDone(a):t))}deleteClashTest(t){return super.delete(`/clashes/${t}`).then((t=>t.json()))}updateVersion(t,e={waitForDone:!1}){return Promise.reject(new Error("Assembly version support will be implemeted in a future release"))}getVersions(){return Promise.resolve(void 0)}getVersion(t){return Promise.reject(new a(404))}deleteVersion(t){return Promise.reject(new a(404))}setActiveVersion(t){return this.update({activeVersion:t})}async createSharedLink(t){return Promise.reject(new Error("Assembly shared link will be implemeted in a future release"))}async getSharedLink(){return Promise.resolve(void 0)}async deleteSharedLink(){return Promise.reject(new a(404))}}class g{constructor(){this._listeners={}}addEventListener(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this}removeEventListener(t,e){if(void 0===this._listeners[t])return this;const s=this._listeners[t].filter((t=>t!==e));return 0!==s.length?this._listeners[t]=s:delete this._listeners[t],this}removeAllListeners(t){return t?delete this._listeners[t]:this._listeners={},this}emitEvent(t){if(void 0===this._listeners[t.type])return!1;return this._listeners[t.type].slice().forEach((e=>e.call(this,t))),!0}on(t,e){return this.addEventListener(t,e)}off(t,e){return this.removeEventListener(t,e)}emit(t,...e){return"string"==typeof t?this.emitEvent({type:t,args:e}):"object"==typeof t&&this.emitEvent(t)}}function m(t){if(!t.ok)switch(t.status){case 400:return t.text().then((t=>(console.error(t),Promise.reject(new a(400,i(t))))));case 500:return t.text().then((t=>(console.error(i(t,t)),Promise.reject(new a(500)))));default:return Promise.reject(new a(t.status))}return Promise.resolve(t)}function w(t,e={method:"GET"}){const s={...e.headers};let r;return delete s["Content-Type"],Object.keys(s).filter((t=>void 0===s[t])).forEach((t=>delete s[t])),"POST"!==e.method&&"PUT"!==e.method||(e.body instanceof FormData?r=e.body:e.body instanceof Blob?(r=new FormData,r.append("file",e.body)):e.body instanceof ArrayBuffer?(r=new FormData,r.append("file",new Blob([e.body]))):"object"==typeof e.body?(r=JSON.stringify(e.body),s["Content-Type"]="application/json"):"string"==typeof e.body&&(r=e.body,s["Content-Type"]="text/plain")),fetch(t,{...e,headers:s,body:r}).then(m)}function f(t,e={method:"GET"}){return new Promise(((s,r)=>{const n=new XMLHttpRequest;n.open(e.method,t,!0);for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);function o(t){return t.lengthComputable?t.loaded/t.total:1}n.upload.onprogress=t=>e.uploadProgress&&e.uploadProgress(o(t)),n.onprogress=t=>e.downloadProgress&&e.downloadProgress(o(t)),n.onloadend=t=>function(t){if(0===t.status)return Promise.reject(new a(0,"Network error"));if(t.status<200||t.status>299)switch(t.status){case 400:return console.error(t.responseText),Promise.reject(new a(400,i(t.responseText)));case 500:return console.error(i(t.responseText,t.responseText)),Promise.reject(new a(500));default:return Promise.reject(new a(t.status))}return Promise.resolve(t)}(t.target).then(s,r),n.send(e.body)}))}class v{constructor(t){this.headers={},this.signInUserId="",this.signInUserIsAdmin=!1,this.serverUrl=t}get(t,e={}){return w(`${this.serverUrl}${t}`,{...e,method:"GET",headers:{...this.headers,...e.headers}})}post(t,e,s={}){return w(`${this.serverUrl}${t}`,{...s,method:"POST",headers:{...this.headers,...s.headers},body:e})}put(t,e,s={}){return w(`${this.serverUrl}${t}`,{...s,method:"PUT",headers:{...this.headers,...s.headers},body:e})}delete(t,e={}){return w(`${this.serverUrl}${t}`,{...e,method:"DELETE",headers:{...this.headers,...e.headers}})}uploadFile(t,e,s,r={}){const i=new FormData;return i.append("file",e),f(`${this.serverUrl}${t}`,{method:"POST",headers:{...this.headers,...r.headers},body:i,uploadProgress:s})}async downloadFile(t,e,s={}){const r=await this.get(t,s),i=r.headers.get("Content-Length"),a=parseInt(i||"",10)||1;return new Response(new ReadableStream({async start(t){const s=r.body.getReader();let i=0;for(;;){const{done:r,value:n}=await s.read();if(r)break;t.enqueue(n),i+=n.length,e&&e(i/a,n)}t.close()}}))}async downloadFileRange(t,e,s,r,i={}){const a={...i.headers};a.Range="bytes="+s.map((t=>`${t.begin}-${t.end}`)).join(",");const n=await this.get(t,{...i,headers:a}),o=n.headers.get("content-length"),h=parseInt(o||"",10)||1;return new Response(new ReadableStream({async start(t){const e=n.body.getReader();let i=0,a=0,o=0;for(;;){const{done:n,value:d}=await e.read();if(n)break;t.enqueue(d),i+=d.length;let l=d.length,u=0;for(;l>0;){const t=s[a],e=t.end-t.begin-o;if(l<e){const e=d.subarray(u,u+l);r&&r(i/h,e,t.requestId),o+=l,l=0}else{const s=d.subarray(u,u+e);r&&r(i/h,s,t.requestId),u+=e,l-=e,a++,o=0}}}t.close()}}))}}class y extends e{constructor(t,e,s){super(`/files/${e}/permissions/${t.id}`,s),this.data=t}get actions(){return this.data.actions}set actions(t){this._data.actions=t}get data(){return this._data}set data(t){this._data=t}get id(){return this.data.id}get grantedTo(){return this.data.grantedTo}set grantedTo(t){this.data.grantedTo=t}get public(){return this.data.public}set public(t){this.data.public=t}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class C extends e{constructor(t,e){super(`/jobs/${t.id}`,e),this.data=t}get assemblyId(){return this.data.assemblyId}get authorId(){return this.data.authorId}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get done(){return"done"===this.data.status||"failed"===this.data.status}get fileId(){return this.data.fileId}get id(){return this.data.id}get lastUpdate(){return this.data.lastUpdate}get outputFormat(){return this.data.outputFormat}get parameters(){return this.data.parameters}get status(){return this.data.status}get statusMessage(){return this.data.statusMessage}get startedAt(){return this.data.startedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}}class j extends e{constructor(t,e){super(`/shares/${t.token}`,e),this.data=t}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions={...this.data.permissions,...t}}get token(){return this.data.token}get url(){return this.data.url}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class _ extends e{constructor(t,e){super(`/files/${t.id}`,e),this.data=t}get activeVersion(){return this.data.activeVersion}get created(){return this.data.created}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){var e,s,r,i,a,n,o,h,d,p,c,g,m,w,f,v,y,C,j,_,b,$,A;this._data=t,this._data.previewUrl=t.preview?`${this.httpClient.serverUrl}${this.path}/preview?updated=${t.updatedAt}`:"","string"==typeof this._data.owner&&(this._data.owner={userId:this._data.owner}),null!==(e=(w=this._data).owner)&&void 0!==e||(w.owner={}),this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName),null!==(s=(f=this._data).status)&&void 0!==s||(f.status={}),null!==(r=(v=this._data.status).geometry)&&void 0!==r||(v.geometry={state:null!==(i=this._data.geometryStatus)&&void 0!==i?i:"none"}),null!==(a=(y=this._data.status).properties)&&void 0!==a||(y.properties={state:null!==(n=this._data.propertiesStatus)&&void 0!==n?n:"none"}),null!==(o=(C=this._data.status).validation)&&void 0!==o||(C.validation={state:null!==(h=this._data.validationStatus)&&void 0!==h?h:"none"}),null!==(d=(j=this._data).updatedBy)&&void 0!==d||(j.updatedBy={}),this._data.updatedBy.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`,this._data.updatedBy.fullName=l(this._data.updatedBy),this._data.updatedBy.initials=u(this._data.updatedBy.fullName),null!==(p=(_=this._data).versions)&&void 0!==p||(_.versions=[{...t}]),null!==(c=(b=this._data.status).geometryGltf)&&void 0!==c||(b.geometryGltf={state:"none"}),null!==(g=($=this._data).isFileDeleted)&&void 0!==g||($.isFileDeleted=!1),null!==(m=(A=this._data).sharedLinkToken)&&void 0!==m||(A.sharedLinkToken=null)}get exports(){return this.data.exports}get geometryType(){return"done"===this.status.geometryGltf.state?"gltf":"done"===this.status.geometry.state?"vsfx":""}get id(){return this.data.id}get isFileDeleted(){return this.data.isFileDeleted}get name(){return this.data.name}set name(t){this.data.name=t}get originalFileId(){return this.data.originalFileId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl}get size(){return this.data.size}get sizeTotal(){return this.data.sizeTotal}get sharedLinkToken(){return this.data.sharedLinkToken}get status(){return this.data.status}get type(){return this.data.type}get updatedAt(){return this.data.updatedAt}get updatedBy(){return this.data.updatedBy}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.post("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await super.delete("/preview");return this.data=await t.json(),this}getModels(){return this.get("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){}setModelTransformMatrix(t,e){return console.warn("File does not support model transformation"),Promise.resolve(this)}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.get(e).then((t=>t.json()))}searchProperties(t){return this.post("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.get("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.get("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.post("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return super.delete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.get(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.get(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}download(t,e){return this.httpClient.downloadFile(this.getEndpointPath("/downloads"),t,{signal:e,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResource(t,e,s){return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${t}`),e,{signal:s,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,r,i){return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${t}?requestId=${e}`),e,s,r,{signal:i,headers:this.headers}).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("File.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use File.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){await this.downloadResourceRange(s,t,e,r,i)}getReferences(t){return this.get("/references",t).then((t=>t.json()))}setReferences(t){return this.put("/references",t).then((t=>t.json()))}createJob(t,s){return new e("/jobs",this.httpClient,this.headers).post(this.appendVersionParam(""),{fileId:this.id,outputFormat:t,parameters:d(s)}).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}extractGeometry(t,e){return this.createJob("gltf"===t?"geometryGltf":"geometry",e)}extractProperties(t){return this.createJob("properties",t)}validate(t){return this.createJob("validation",t)}waitForDone(t,e,s){const r=Array.isArray(t)?t:[t];void 0===e&&(e=!0);return h((()=>this.checkout().then((t=>{var i;const a=r.filter((e=>{const s=t.status[e]||{};return["none","done","failed"].includes(s.state||"none")})),n=e?a.length===r.length:a.length>0;return(null===(i=null==s?void 0:s.onCheckout)||void 0===i?void 0:i.call(s,t,n))||n}))),s).then((()=>this))}getPermissions(){return this.get("/permissions").then((t=>t.json())).then((t=>t.map((t=>new y(t,this.id,this.httpClient)))))}getPermission(t){return this.get(`/permissions/${t}`).then((t=>t.json())).then((t=>new y(t,this.id,this.httpClient)))}createPermission(t,e,s){return this.post("/permissions",{actions:Array.isArray(t)?t:[t],grantedTo:e,public:s}).then((t=>t.json())).then((t=>new y(t,this.id,this.httpClient)))}deletePermission(t){return super.delete(`/permissions/${t}`).then((t=>t.json()))}async uploadVersion(t,e={waitForDone:!1}){const s=await this.httpClient.uploadFile(this.getEndpointPath("/versions"),t,(s=>{var r;return null===(r=e.onProgress)||void 0===r?void 0:r.call(e,s,t)}),{headers:this.headers}).then((t=>JSON.parse(t.responseText))).then((t=>new _(t,this.httpClient)));let r="";"none"!==this.versions[0].status.geometryGltf.state&&(r="gltf"),"none"!==this.versions[0].status.geometry.state&&(r="vsfx"),void 0===(e={...e}).geometry&&(e.geometry=""!==r),void 0===e.properties&&(e.properties="none"!==this.versions[0].status.properties.state);const i=[];return e.geometry&&i.push((await s.extractGeometry(r)).outputFormat),e.properties&&i.push((await s.extractProperties()).outputFormat),i.length>0&&(e.waitForDone?await s.waitForDone(i,!0,e):await s.checkout()),await this.checkout(),s}getVersions(){return this.get("/versions").then((t=>t.json())).then((t=>t.map((t=>new _(t,this.httpClient))))).then((t=>t.map((t=>t.id==t.originalFileId?t.useVersion(0):t))))}getVersion(t){return this.get(`/versions/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))).then((t=>t.id==t.originalFileId?t.useVersion(0):t))}async deleteVersion(t){const e=await super.delete(`/versions/${t}`),s=await e.json();return await this.checkout(),s}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return super.useVersion(t)}async deleteSource(){const t=await super.delete("/source");return this.data=await t.json(),this}async createSharedLink(t){const s=new e("/shares",this.httpClient,this.headers),r=await s.post("",{fileId:this.id,permissions:t}),i=await r.json();return await this.checkout(),new j(i,this.httpClient)}async getSharedLink(){if(!this.sharedLinkToken)return Promise.resolve(void 0);const t=new e("/shares",this.httpClient,this.headers),s=await t.get(`/${this.sharedLinkToken}`),r=await s.json();return new j(r,this.httpClient)}async deleteSharedLink(){const t=new e("/shares",this.httpClient,this.headers),s=await t.delete(`/${this.sharedLinkToken}`),r=await s.json();return await this.checkout(),r}}class b extends e{constructor(t,e,s){super("",s),this.projectId=e,this.data=t}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t,this.path=`/projects/${this.projectId}/roles/${t.name}`}get name(){return this.data.name}set name(t){this._data.name=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions=t||{}}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class $ extends e{constructor(t,e,s){super(`/projects/${e}/members/${t.id}`,s),this.data=t}get data(){return this._data}set data(t){this._data=t,this._data.user.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.user.userId}/avatar`,this._data.user.fullName=l(this._data.user),this._data.user.initials=u(this._data.user.fullName)}get id(){return this.data.id}get role(){return this.data.role}set role(t){this.data.role=t}get type(){return this.data.type}get user(){return this.data.user}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class A extends e{constructor(t,e){super(`/projects/${t.id}`,e),this.data=t}get authorization(){return this.data.authorization}get createdAt(){return this.data.createdAt}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.previewUrl=t.avatarUrl?`${this.httpClient.serverUrl}/projects/${this._data.id}/preview?updated=${t.updatedAt}`:"",this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName)}get description(){return this.data.description}set description(t){this.data.description=t}get endDate(){return this.data.endDate}set endDate(t){this.data.endDate=t instanceof Date?t.toISOString():t}get id(){return this.data.id}get memberCount(){return this.data.memberCount}get modelCount(){return this.data.modelCount}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get previewUrl(){return this._data.previewUrl}get public(){return this.data.public}set public(t){this.data.public=t}get startDate(){return this.data.startDate}set startDate(t){this.data.startDate=t instanceof Date?t.toISOString():t}get topicCount(){return this.data.topicCount}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.text())).then((t=>{try{return JSON.parse(t)}catch{return{id:this.id}}}))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.post("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await super.delete("/preview");return this.data=await t.json(),this}getRoles(){return this.get("/roles").then((t=>t.json())).then((t=>t.map((t=>new b(t,this.id,this.httpClient)))))}getRole(t){return this.get(`/roles/${t}`).then((t=>t.json())).then((t=>new b(t,this.id,this.httpClient)))}createRole(t,e,s){return this.post("/roles",{name:t,description:e,permissions:s||{}}).then((t=>t.json())).then((t=>new b(t,this.id,this.httpClient)))}deleteRole(t){return super.delete(`/roles/${t}`).then((t=>t.json()))}getMembers(){return this.get("/members").then((t=>t.json())).then((t=>t.map((t=>new $(t,this.id,this.httpClient)))))}getMember(t){return this.get(`/members/${t}`).then((t=>t.json())).then((t=>new $(t,this.id,this.httpClient)))}addMember(t,e){return this.post("/members",{userId:t,role:e}).then((t=>t.json())).then((t=>new $(t,this.id,this.httpClient)))}removeMember(t){return super.delete(`/members/${t}`).then((t=>t.json()))}getFilesInformation(){return new e("/bcf/3.0/projects",this.httpClient,this.headers).get(`/${this.id}/files_information`).then((t=>t.json())).then((t=>(t.forEach((t=>{const e=e=>(t.display_information.find((t=>t.field_display_name===e))||{}).field_value,s=`${this.httpClient.serverUrl}/files/${t.file.reference}/preview`,r=`${this.httpClient.serverUrl}/users/${e("Owner")}/avatar`,i=l(e("Owner First Name"),e("Owner Last Name"),e("Owner User Name")),a=u(i);t.display_information.push({field_display_name:"Preview URL",field_value:s}),t.display_information.push({field_display_name:"Owner Avatar URL",field_value:r}),t.display_information.push({field_display_name:"Owner Full Name",field_value:i}),t.display_information.push({field_display_name:"Owner Initials",field_value:a});const n=`${this.httpClient.serverUrl}/users/${e("Updated By")}/avatar`,o=l(e("Updated By First Name"),e("Updated By Last Name"),e("Updated By User Name")),h=u(o);t.display_information.push({field_display_name:"Updated By Avatar URL",field_value:n}),t.display_information.push({field_display_name:"Updated By Full Name",field_value:o}),t.display_information.push({field_display_name:"Updated By Initials",field_value:h});const d=e("Geometry Status"),p=e("GeometryGltf Status"),c="done"===d?"vsfx":"done"===p?"gltf":"";t.display_information.push({field_display_name:"Geometry Type",field_value:c})})),t)))}getModels(){return this.getFilesInformation().then((t=>t.map((t=>t.file.reference)))).then((t=>new e("/files",this.httpClient,this.headers).get(`?id=${t.join("|")}`))).then((t=>t.json())).then((t=>t.result.map((t=>new _(t,this.httpClient)))))}async addModel(t,s,r){const i=new e("/files",this.httpClient,this.headers),a=await i.get(`/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))),n=[{project:{id:this.id,name:this.name}}];return await a.createPermission(s,n,r),a}async removeModel(t){const s=new e("/files",this.httpClient,this.headers),r=await s.get(`/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))),i=await r.getPermissions();return await Promise.allSettled(i.filter((t=>t.grantedTo.some((t=>{var e;return(null===(e=t.project)||void 0===e?void 0:e.id)===this.id})))).map((t=>t.delete()))),r}}class U extends e{constructor(t,e){super("",e),this.data=t}get avatarUrl(){return this._data.avatarUrl}get canCreateProject(){return this.data.canCreateProject}set canCreateProject(t){this._data.canCreateProject=t}get createAt(){return this.data.createAt}get customFields(){return this.data.customFields}set customFields(t){this._data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.avatarUrl=t.avatarImage?`${this.httpClient.serverUrl}/users/${this._data.id}/avatar?updated=${t.lastModified}`:"",this._data.fullName=l(this._data),this._data.initials=u(this._data.fullName)}get email(){return this.data.email}set email(t){this._data.email=t}get emailConfirmationId(){return this.data.emailConfirmationId}get firstName(){return this.data.firstName}set firstName(t){this._data.firstName=t}get fullName(){return this.data.fullName}get id(){return this.data.id}get initials(){return this.data.initials}get isAdmin(){return this.data.isAdmin}set isAdmin(t){this._data.isAdmin=t}get isEmailConfirmed(){return this.data.isEmailConfirmed}get lastModified(){return this.data.lastModified}get lastName(){return this.data.lastName}set lastName(t){this._data.lastName=t}get lastSignIn(){return this.data.lastSignIn}get projectsLimit(){return this.data.projectsLimit}set projectsLimit(t){this._data.projectsLimit=t}get providerType(){return this.data.providerType}get storageLimit(){return this.data.storageLimit}set storageLimit(t){this._data.storageLimit=t}get storageUsed(){return this.data.storageUsed}get token(){return this.data.tokenInfo.token}get userName(){return this.data.userName}set userName(t){this._data.userName=t}async checkout(){if(this.httpClient.signInUserIsAdmin){const t=await this.get(`/users/${this.id}`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const t=await this.get("/user"),e=await t.json();this.data={id:this.id,...e}}}return this}async update(t){if(this.httpClient.signInUserIsAdmin){const e=await this.put(`/users/${this.id}`,{isAdmin:t.isAdmin,userBrief:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const e=await this.put("/user",t),s=await e.json();this.data={id:this.id,...s}}}return this}delete(){return this.httpClient.signInUserIsAdmin?super.delete(`/users/${this.id}`).then((t=>t.json())).then((t=>(this.id===this.httpClient.signInUserId&&(delete this.httpClient.headers.Authorization,this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1),t))):Promise.reject(new a(403))}save(){return this.update(this.data)}async setAvatar(t){if(t)if(this.httpClient.signInUserIsAdmin){const e=await this.post(`/users/${this.id}/avatar`,t),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const e=await this.post("/user/avatar",t),s=await e.json();this.data={id:this.id,...s}}}else await this.deleteAvatar();return this}async deleteAvatar(){if(this.httpClient.signInUserIsAdmin){const t=await super.delete(`/users/${this.id}/avatar`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const t=await super.delete("/user/avatar"),e=await t.json();this.data={id:this.id,...e}}}return this}async changePassword(t,e){if(this.httpClient.signInUserIsAdmin){const e=await this.put(`/users/${this.id}/password`,{new:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const s=await this.put("/user/password",{old:e,new:t}),r=await s.json();this.data={id:this.id,...r}}}return this}}class I extends e{constructor(t,e){super(`/oauth/clients/${t.clientId}`,e),this.data=t}get authUrl(){return this.data.authUrl}get accessTokenUrl(){return this.data.accessTokenUrl}get clientId(){return this.data.clientId}get createdAt(){return this.data.createdAt}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get redirectUrl(){return this.data.redirectUrl}set redirectUrl(t){this.data.redirectUrl=t}get secret(){return this.data.secret}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}async revoke(){return await this.post("/revoke"),this}}class P extends _{constructor(t,e,s){super(t.file,s),this.path=`/shares/${t.file.sharedLinkToken}`,this.headers={"InWeb-Password":e}}async checkout(){const t=await this.get("/info"),e=await t.json();return this.data=e.file,this}async update(t){const e=await this.put("/info",t);return this.data=await e.json(),this}getVersions(){return Promise.resolve(void 0)}useVersion(t){return this}}t.Assembly=c,t.ClashTest=p,t.Client=class extends g{constructor(t={}){super(),this._serverUrl="",this._httpClient=new v(""),this._user=null,this.eventEmitter=this,this.configure(t)}get serverUrl(){return this._serverUrl}get httpClient(){return this._httpClient}get options(){console.warn("Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead.");const t={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0};return{...t,data:t,defaults:()=>t,resetToDefaults:()=>{},saveToStorage:()=>{},loadFromStorage:()=>{}}}configure(t){return this._serverUrl=(t.serverUrl||"").replace(/\/+$/,""),this._httpClient=new v(this.serverUrl),this._user=null,this}version(){return this.httpClient.get("/version").then((t=>t.json())).then((t=>({...t,server:t.version,client:"26.1.1"})))}registerUser(t,e,s){return this.httpClient.post("/register",{email:t,password:e,userName:null!=s?s:(t+"").split("@").at(0)}).then((t=>t.json()))}resendConfirmationEmail(t,e){return this.httpClient.post("/register/email-confirmation",{email:t,password:e}).then((t=>t.json()))}confirmUserEmail(t){return this.httpClient.get(`/register/email-confirmation/${t}`).then((t=>t.json()))}async signInWithEmail(t,e){const s=btoa(unescape(encodeURIComponent(t+":"+e)));this.httpClient.headers.Authorization="Basic "+s;const r=await this.httpClient.get("/token"),i=await r.json();return this.setCurrentUser(i)}async signInWithToken(t){this.httpClient.headers.Authorization=t;const e=await this.httpClient.get("/user"),s=await e.json();return this.setCurrentUser(s)}signOut(){this.clearCurrentUser()}setCurrentUser(t){return this._user=new U(t,this.httpClient),this.httpClient.headers.Authorization=t.tokenInfo.token,this.httpClient.signInUserId=this._user.id,this.httpClient.signInUserIsAdmin=this._user.isAdmin,this._user}clearCurrentUser(){this._user=null,delete this.httpClient.headers.Authorization,this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1}getCurrentUser(){return this._user&&!this.httpClient.signInUserId&&(this._user=null),this._user}getIdentityProviders(){return this.httpClient.get("/identity").then((t=>t.json()))}getServerSettings(){return this.httpClient.get("/settings").then((t=>t.json()))}updateServerSettings(t){return this.httpClient.put("/settings",t).then((t=>t.json()))}getOAuthClients(t,e){const s=new URLSearchParams;t>0&&s.set("start",t.toString()),e>0&&s.set("limit",e.toString());let r=s.toString();return r&&(r="?"+r),this.httpClient.get(`/oauth/clients${r}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new I(t,this.httpClient)))})))}getOAuthClient(t){return this.httpClient.get(`/oauth/clients/${t}`).then((t=>t.json())).then((t=>new I(t,this.httpClient)))}createOAuthClient(t,e,s){return this.httpClient.post("/oauth/clients",{name:t,redirectUrl:e,description:s}).then((t=>t.json())).then((t=>new I(t,this.httpClient)))}deleteOAuthClient(t){return this.httpClient.delete(`/oauth/clients/${t}`).then((t=>t.json()))}getUsers(){return this.httpClient.get("/users").then((t=>t.json())).then((t=>t.map((t=>({id:t.id,...t.userBrief}))))).then((t=>t.map((t=>new U(t,this.httpClient)))))}getUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.get(`/users/${t}`).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new U(t,this.httpClient))):t===this.httpClient.signInUserId?this.httpClient.get("/user").then((t=>t.json())).then((e=>({id:t,...e}))).then((t=>new U(t,this.httpClient))):Promise.reject(new a(403))}createUser(t,e,s={}){const{isAdmin:r,userName:i,...a}=s;return this.httpClient.post("/users",{isAdmin:r,userBrief:{...a,email:t,userName:null!=i?i:(t+"").split("@").at(0)},password:e}).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new U(t,this.httpClient)))}deleteUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${t}`).then((t=>t.json())).then((e=>(t===this.httpClient.signInUserId&&this.clearCurrentUser(),e))):Promise.reject(new a(403))}getFiles(t,e,s,r,i,a,n,o){const h=new URLSearchParams;t>0&&h.set("start",t.toString()),e>0&&h.set("limit",e.toString()),s&&h.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.toLowerCase()),r&&h.set("ext",r)),i&&(Array.isArray(i)&&(i=i.join("|")),h.set("id",i)),void 0!==a&&h.set("sortBy",a?"desc":"asc"),n&&h.set("sortField",n),o&&h.set("shared","true");let d=h.toString();return d&&(d="?"+d),this.httpClient.get(`/files${d}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new _(t,this.httpClient)))})))}getFile(t){return this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient)))}async uploadFile(t,e={geometry:!0,properties:!1,waitForDone:!1}){const s=await this.httpClient.uploadFile("/files",t,(s=>{var r;this.emitEvent({type:"uploadprogress",data:s,file:t}),null===(r=e.onProgress)||void 0===r||r.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new _(t,this.httpClient))),r="string"==typeof e.geometry?e.geometry:"vsfx",i=[];return e.geometry&&i.push((await s.extractGeometry(r)).outputFormat),e.properties&&i.push((await s.extractProperties()).outputFormat),i.length>0&&(e.waitForDone?await s.waitForDone(i,!0,e):await s.checkout()),s}deleteFile(t){return this.httpClient.delete(`/files/${t}`).then((t=>t.json()))}downloadFile(t,e,s){return this.httpClient.downloadFile(`/files/${t}/downloads`,e,{signal:s}).then((t=>t.arrayBuffer()))}getJobs(t,e,s,r,i){const a=new URLSearchParams;s>0&&a.set("start",s.toString()),e>0&&a.set("limit",e.toString()),t&&(Array.isArray(t)&&(t=t.join("|")),"string"==typeof t&&(t=t.trim().toLowerCase()),t&&a.set("status",t)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),i&&a.set("sortField",i);let n=a.toString();return n&&(n="?"+n),this.httpClient.get(`/jobs${n}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new C(t,this.httpClient)))})))}getJob(t){return this.httpClient.get(`/jobs/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}createJob(t,e,s){return this.httpClient.post("/jobs",{fileId:t,outputFormat:e,parameters:d(s)}).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}deleteJob(t){return this.httpClient.delete(`/jobs/${t}`).then((t=>t.json()))}getAssemblies(t,e,s,r,i,a){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&n.set("id",r)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),a&&n.set("sortField",a);let o=n.toString();return o&&(o="?"+o),this.httpClient.get(`/assemblies${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new c(t,this.httpClient)))})))}getAssembly(t){return this.httpClient.get(`/assemblies/${t}`).then((t=>t.json())).then((t=>new c(t,this.httpClient)))}createAssembly(t,e,s){const{waitForDone:r}=null!=s?s:{};return this.httpClient.post("/assemblies",{name:e,files:t}).then((t=>t.json())).then((t=>new c(t,this.httpClient))).then((t=>r?t.waitForDone(s):t))}deleteAssembly(t){return this.httpClient.delete(`/assemblies/${t}`).then((t=>t.json()))}getProjects(t,e,s,r,i){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&a.set("id",r)),void 0!==i&&a.set("sortBy",i?"desc":"asc");let n=a.toString();return n&&(n="?"+n),this.httpClient.get(`/projects${n}`).then((t=>t.json())).then((i=>{if(Array.isArray(i)){let a=i;if(r&&(a=a.filter((t=>r.includes(t.id)))),s&&(a=a.filter((t=>t.name.includes(s)))),e>0){const s=t>0?t:0;a=a.slice(s,s+e)}return{allSize:i.length,start:t,limit:e,result:a,size:a.length}}return i})).then((t=>({...t,result:t.result.map((t=>new A(t,this.httpClient)))})))}getProject(t){return this.httpClient.get(`/projects/${t}`).then((t=>t.json())).then((t=>new A(t,this.httpClient)))}createProject(t,e,s,r){return this.httpClient.post("/projects",{name:t,description:e,startDate:s instanceof Date?s.toISOString():s,endDate:r instanceof Date?r.toISOString():r}).then((t=>t.json())).then((t=>new A(t,this.httpClient)))}deleteProject(t){return this.httpClient.delete(`/projects/${t}`).then((t=>t.text())).then((e=>{try{return JSON.parse(e)}catch{return{id:t}}}))}getSharedLink(t){return this.httpClient.get(`/shares/${t}`).then((t=>t.json())).then((t=>new j(t,this.httpClient)))}createSharedLink(t,e){return this.httpClient.post("/shares",{fileId:t,permissions:e}).then((t=>t.json())).then((t=>new j(t,this.httpClient)))}deleteSharedLink(t){return this.httpClient.delete(`/shares/${t}`).then((t=>t.json()))}getSharedFile(t,e){return this.httpClient.get(`/shares/${t}/info`,{headers:{"InWeb-Password":e}}).then((t=>t.json())).then((t=>new P(t,e,this.httpClient)))}},t.Endpoint=e,t.FetchError=a,t.File=_,t.Job=C,t.Member=$,t.Model=n,t.OAuthClient=I,t.Permission=y,t.Project=A,t.Role=b,t.SharedFile=P,t.SharedLink=j,t.User=U,t.parseArgs=d,t.statusText=r,t.userFullName=l,t.userInitials=u,t.version="26.1.1",t.waitFor=h}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Api=t.ODA.Api||{}))}(this,(function(t){"use strict";class e{constructor(t,e,s={}){this.path=t,this.httpClient=e,this.headers=s}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}getEndpointPath(t){return this.appendVersionParam(`${this.path}${t}`)}get(t,e){return this.httpClient.get(this.getEndpointPath(t),{signal:e,headers:this.headers})}post(t,e){return this.httpClient.post(this.getEndpointPath(t),e,{headers:this.headers})}put(t,e){return this.httpClient.put(this.getEndpointPath(t),e,{headers:this.headers})}delete(t){return this.httpClient.delete(this.getEndpointPath(t),{headers:this.headers})}useVersion(t){return this._useVersion=t,this}}const s={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};function r(t){return s[t]||`Error ${t}`}function i(t,e="400"){try{return JSON.parse(t).description}catch{return e}}class a extends Error{constructor(t,e){super(e||r(t)),this.name="FetchError",this.status=t,this.statusText=r(t)}}class n extends e{constructor(t,e){super(`${e.path}/downloads`,e.httpClient),this._data=t,this._file=e}get assembly(){return this._file}get data(){return this._data}set data(t){this._data=t}get database(){return this.data.database}get default(){return this.data.default}get file(){return this._file}get fileId(){return this.data.fileId}get geometry(){return this.data.geometry}get id(){return this.data.id}get name(){return this.data.name}get type(){return this.file.type}get version(){return this.data.version}getModels(){return Promise.resolve([this])}getModelTransformMatrix(t){return this.file.getModelTransformMatrix(t)}setModelTransformMatrix(t,e){return this.file.setModelTransformMatrix(t,e).then((()=>this))}getViewpoints(){return this._file.getViewpoints().then((t=>t.filter((({custom_fields:t={}})=>t.modelId===this.id||t.modelName===this.name))))}saveViewpoint(t){return this._file.saveViewpoint({...t,custom_fields:{...t.custom_fields,modelId:this.id,modelName:this.name}})}deleteViewpoint(t){return this._file.deleteViewpoint(t)}getSnapshot(t){return this._file.getSnapshot(t)}getSnapshotData(t,e){return this._file.getSnapshotData(t,e)}downloadResource(t,e,s){return this._file.downloadResource(t,e,s)}downloadResourceRange(t,e,s,r,i){return this._file.downloadResourceRange(t,e,s,r,i)}partialDownloadResource(t,e,s){return console.warn("Model.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Model.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){if(!e)return;let a=[];if(e.length)a=e.map((t=>({begin:Number(t.begin),end:Number(t.end),requestId:t.reqId})));else for(let s=0;s<e.size();s++){const r=e.get(s);a.push({begin:Number(r.begin),end:Number(r.end),requestId:t}),r.delete()}await this.downloadResourceRange(s,t,a,r,i)}getReferences(t){return this._file.getReferences(t)}}function o(t,e){return new Promise((s=>{let r=0;const i=()=>{clearTimeout(r),s(!0)};r=window.setTimeout((()=>{e.removeEventListener("abort",i),s(!1)}),t),e.addEventListener("abort",i,{once:!0})}))}async function h(t,e={}){var s,r,i;const a=e.timeout||6e5,n=e.interval||3e3,h=null!==(s=e.signal)&&void 0!==s?s:(new AbortController).signal,d=null!==(r=e.abortError)&&void 0!==r?r:new DOMException("Aborted","AbortError"),l=null!==(i=e.timeoutError)&&void 0!==i?i:new DOMException("Timeout","TimeoutError"),u=performance.now()+a;let p=a/n;do{if(await t(e))return Promise.resolve(e.result);if(await o(n,h)||h.aborted)return Promise.reject(d)}while(performance.now()<u&&--p>0);return Promise.reject(l)}function d(t){if("string"==typeof t){const e=t.indexOf("--");-1!==e&&(t=t.slice(e));const s=t.split("--").map((t=>t.split("=").map((t=>t.split(" "))).flat())).filter((t=>t[0])).map((t=>t.concat([""])));return Object.fromEntries(s)}return t||{}}function l(t,e="",s=""){var r;return t&&"string"!=typeof t?l(null!==(r=t.firstName)&&void 0!==r?r:t.name,t.lastName,t.userName):`${null!=t?t:""} ${null!=e?e:""}`.trim()||s}function u(t=""){const e=t.split(" ").filter((t=>t));return e.reduce(((t,s,r)=>(0!==r&&r!==e.length-1||(t+=s.charAt(0)),t)),"").toUpperCase()}class p extends e{constructor(t,e,s){super(`${e}/clashes/${t.id}`,s),this.data=t}get clearance(){return this.data.clearance}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName)}get id(){return this.data.id}get lastModifiedAt(){return this.data.lastModifiedAt}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get selectionSetA(){return this.data.selectionSetA}get selectionTypeA(){return this.data.selectionTypeA}get selectionSetB(){return this.data.selectionSetB}get selectionTypeB(){return this.data.selectionTypeB}get status(){return this.data.status}get tolerance(){return this.data.tolerance}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}getReport(){return this.get("/report").then((t=>t.json()))}}class c extends e{constructor(t,e){super(`/assemblies/${t.id}`,e),this.data=t}get activeVersion(){return this.data.activeVersion}get associatedFiles(){return this.data.associatedFiles}get created(){return this.data.created}get data(){return this._data}set data(t){var e,s;this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName),null!==(e=(s=this._data).associatedFiles)&&void 0!==e||(s.associatedFiles=[]),this._data.associatedFiles.forEach((t=>t.link=`${this.httpClient.serverUrl}/files/${t.fileId}`))}get files(){return this.data.files}get geometryType(){return"done"===this.status?"vsfx":""}get id(){return this.data.id}get name(){return this.data.name}set name(t){this.data.name=t}get originalAssemblyId(){return this.data.originalAssemblyId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl||""}get relatedJobs(){return this.data.relatedJobs}get status(){return this.data.status}get type(){return"assembly"}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}setPreview(t){return console.warn("Assembly does not support preview"),Promise.resolve(this)}deletePreview(){return console.warn("Assembly does not support preview"),Promise.resolve(this)}getModels(){return this.get("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){return this.data.transform[t]}setModelTransformMatrix(t,e){const s={...this.data.transform};return s[t]=e,this.update({transform:s})}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.get(e).then((t=>t.json()))}searchProperties(t){return this.post("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.get("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.get("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.post("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return super.delete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.get(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.get(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}downloadResource(t,e,s){return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${t}`),e,{signal:s,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,r,i){return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${t}?requestId=${e}`),e,s,r,{signal:i,headers:this.headers}).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("Assembly.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Assembly.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){await this.downloadResourceRange(s,t,e,r,i)}async getReferences(t){const s=new e("/files",this.httpClient,this.headers);return{id:"",references:await Promise.all(this.associatedFiles.map((t=>`/${t.fileId}/references`)).map((e=>s.get(e,t).then((t=>t.json()))))).then((t=>t.map((t=>t.references)))).then((t=>t.reduce(((t,e)=>[...e,...t]),[]))).then((t=>[...new Set(t.map(JSON.stringify))].map((t=>JSON.parse(t)))))}}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}getClashTests(t,e,s,r,i,a){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&n.set("id",r)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),a&&n.set("sortField",a);let o=n.toString();return o&&(o="?"+o),this.get(`/clashes${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new p(t,this.path,this.httpClient)))})))}getClashTest(t){return this.get(`/clashes/${t}`).then((t=>t.json())).then((t=>new p(t,this.path,this.httpClient)))}createClashTest(t,e,s,r,i,a){const{tolerance:n,clearance:o,waitForDone:h}=null!=a?a:{};return Array.isArray(r)||(r=[r]),Array.isArray(i)||(i=[i]),this.post("/clashes",{name:t,selectionTypeA:e,selectionTypeB:s,selectionSetA:r,selectionSetB:i,tolerance:n,clearance:o}).then((t=>t.json())).then((t=>new p(t,this.path,this.httpClient))).then((t=>h?t.waitForDone(a):t))}deleteClashTest(t){return super.delete(`/clashes/${t}`).then((t=>t.json()))}updateVersion(t,e={waitForDone:!1}){return Promise.reject(new Error("Assembly version support will be implemeted in a future release"))}getVersions(){return Promise.resolve(void 0)}getVersion(t){return Promise.reject(new a(404))}deleteVersion(t){return Promise.reject(new a(404))}setActiveVersion(t){return this.update({activeVersion:t})}createSharedLink(t){return Promise.reject(new Error("Assembly shared link will be implemeted in a future release"))}getSharedLink(){return Promise.resolve(void 0)}deleteSharedLink(){return Promise.reject(new a(404))}}class g{constructor(){this._listeners={}}addEventListener(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this}removeEventListener(t,e){if(void 0===this._listeners[t])return this;const s=this._listeners[t].filter((t=>t!==e));return 0!==s.length?this._listeners[t]=s:delete this._listeners[t],this}removeAllListeners(t){return t?delete this._listeners[t]:this._listeners={},this}emitEvent(t){if(void 0===this._listeners[t.type])return!1;return this._listeners[t.type].slice().forEach((e=>e.call(this,t))),!0}on(t,e){return this.addEventListener(t,e)}off(t,e){return this.removeEventListener(t,e)}emit(t,...e){return"string"==typeof t?this.emitEvent({type:t,args:e}):"object"==typeof t&&this.emitEvent(t)}}function m(t){if(!t.ok)switch(t.status){case 400:return t.text().then((t=>(console.error(t),Promise.reject(new a(400,i(t))))));case 500:return t.text().then((t=>(console.error(i(t,t)),Promise.reject(new a(500)))));default:return Promise.reject(new a(t.status))}return Promise.resolve(t)}function w(t,e={method:"GET"}){const s={...e.headers};let r;return delete s["Content-Type"],Object.keys(s).filter((t=>void 0===s[t])).forEach((t=>delete s[t])),"POST"!==e.method&&"PUT"!==e.method||(e.body instanceof FormData?r=e.body:e.body instanceof Blob?(r=new FormData,r.append("file",e.body)):e.body instanceof ArrayBuffer?(r=new FormData,r.append("file",new Blob([e.body]))):"object"==typeof e.body?(r=JSON.stringify(e.body),s["Content-Type"]="application/json"):"string"==typeof e.body&&(r=e.body,s["Content-Type"]="text/plain")),fetch(t,{...e,headers:s,body:r}).then(m)}function f(t,e={method:"GET"}){return new Promise(((s,r)=>{const n=new XMLHttpRequest;n.open(e.method,t,!0);for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);function o(t){return t.lengthComputable?t.loaded/t.total:1}n.upload.onprogress=t=>e.uploadProgress&&e.uploadProgress(o(t)),n.onprogress=t=>e.downloadProgress&&e.downloadProgress(o(t)),n.onloadend=t=>function(t){if(0===t.status)return Promise.reject(new a(0,"Network error"));if(t.status<200||t.status>299)switch(t.status){case 400:return console.error(t.responseText),Promise.reject(new a(400,i(t.responseText)));case 500:return console.error(i(t.responseText,t.responseText)),Promise.reject(new a(500));default:return Promise.reject(new a(t.status))}return Promise.resolve(t)}(t.target).then(s,r),n.send(e.body)}))}class v{constructor(t){this.headers={},this.signInUserId="",this.signInUserIsAdmin=!1,this.serverUrl=t}get(t,e={}){return w(`${this.serverUrl}${t}`,{...e,method:"GET",headers:{...this.headers,...e.headers}})}post(t,e,s={}){return w(`${this.serverUrl}${t}`,{...s,method:"POST",headers:{...this.headers,...s.headers},body:e})}put(t,e,s={}){return w(`${this.serverUrl}${t}`,{...s,method:"PUT",headers:{...this.headers,...s.headers},body:e})}delete(t,e={}){return w(`${this.serverUrl}${t}`,{...e,method:"DELETE",headers:{...this.headers,...e.headers}})}uploadFile(t,e,s,r={}){const i=new FormData;return i.append("file",e),f(`${this.serverUrl}${t}`,{method:"POST",headers:{...this.headers,...r.headers},body:i,uploadProgress:s})}async downloadFile(t,e,s={}){const r=await this.get(t,s),i=r.headers.get("Content-Length"),a=parseInt(i||"",10)||1;return new Response(new ReadableStream({async start(t){const s=r.body.getReader();let i=0;for(;;){const{done:r,value:n}=await s.read();if(r)break;t.enqueue(n),i+=n.length,e&&e(i/a,n)}t.close()}}))}async downloadFileRange(t,e,s,r,i={}){const a={...i.headers};a.Range="bytes="+s.map((t=>`${t.begin}-${t.end}`)).join(",");const n=await this.get(t,{...i,headers:a}),o=n.headers.get("content-length"),h=parseInt(o||"",10)||1;return new Response(new ReadableStream({async start(t){const e=n.body.getReader();let i=0,a=0,o=0;for(;;){const{done:n,value:d}=await e.read();if(n)break;t.enqueue(d),i+=d.length;let l=d.length,u=0;for(;l>0;){const t=s[a],e=t.end-t.begin-o;if(l<e){const e=d.subarray(u,u+l);r&&r(i/h,e,t.requestId),o+=l,l=0}else{const s=d.subarray(u,u+e);r&&r(i/h,s,t.requestId),u+=e,l-=e,a++,o=0}}}t.close()}}))}}class y extends e{constructor(t,e,s){super(`/files/${e}/permissions/${t.id}`,s),this.data=t}get actions(){return this.data.actions}set actions(t){this._data.actions=t}get data(){return this._data}set data(t){this._data=t}get id(){return this.data.id}get grantedTo(){return this.data.grantedTo}set grantedTo(t){this.data.grantedTo=t}get public(){return this.data.public}set public(t){this.data.public=t}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class C extends e{constructor(t,e){super(`/jobs/${t.id}`,e),this.data=t}get assemblyId(){return this.data.assemblyId}get authorId(){return this.data.authorId}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get done(){return"done"===this.data.status||"failed"===this.data.status}get fileId(){return this.data.fileId}get id(){return this.data.id}get lastUpdate(){return this.data.lastUpdate}get outputFormat(){return this.data.outputFormat}get parameters(){return this.data.parameters}get status(){return this.data.status}get statusMessage(){return this.data.statusMessage}get startedAt(){return this.data.startedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}waitForDone(t){return h((()=>this.checkout().then((e=>{var s;const r=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,r))||r}))),t).then((()=>this))}}class j extends e{constructor(t,e){super(`/shares/${t.token}`,e),this.data=t}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions={...this.data.permissions,...t}}get token(){return this.data.token}get url(){return this.data.url}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class _ extends e{constructor(t,e){super(`/files/${t.id}`,e),this.data=t}get activeVersion(){return this.data.activeVersion}get created(){return this.data.created}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){var e,s,r,i,a,n,o,h,d,p,c,g,m,w,f,v,y,C,j,_,b,$,A;this._data=t,this._data.previewUrl=t.preview?`${this.httpClient.serverUrl}${this.path}/preview?updated=${t.updatedAt}`:"","string"==typeof this._data.owner&&(this._data.owner={userId:this._data.owner}),null!==(e=(w=this._data).owner)&&void 0!==e||(w.owner={}),this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName),null!==(s=(f=this._data).status)&&void 0!==s||(f.status={}),null!==(r=(v=this._data.status).geometry)&&void 0!==r||(v.geometry={state:null!==(i=this._data.geometryStatus)&&void 0!==i?i:"none"}),null!==(a=(y=this._data.status).properties)&&void 0!==a||(y.properties={state:null!==(n=this._data.propertiesStatus)&&void 0!==n?n:"none"}),null!==(o=(C=this._data.status).validation)&&void 0!==o||(C.validation={state:null!==(h=this._data.validationStatus)&&void 0!==h?h:"none"}),null!==(d=(j=this._data).updatedBy)&&void 0!==d||(j.updatedBy={}),this._data.updatedBy.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`,this._data.updatedBy.fullName=l(this._data.updatedBy),this._data.updatedBy.initials=u(this._data.updatedBy.fullName),null!==(p=(_=this._data).versions)&&void 0!==p||(_.versions=[{...t}]),null!==(c=(b=this._data.status).geometryGltf)&&void 0!==c||(b.geometryGltf={state:"none"}),null!==(g=($=this._data).isFileDeleted)&&void 0!==g||($.isFileDeleted=!1),null!==(m=(A=this._data).sharedLinkToken)&&void 0!==m||(A.sharedLinkToken=null)}get exports(){return this.data.exports}get geometryType(){return"done"===this.status.geometryGltf.state?"gltf":"done"===this.status.geometry.state?"vsfx":""}get id(){return this.data.id}get isFileDeleted(){return this.data.isFileDeleted}get name(){return this.data.name}set name(t){this.data.name=t}get originalFileId(){return this.data.originalFileId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl}get size(){return this.data.size}get sizeTotal(){return this.data.sizeTotal}get sharedLinkToken(){return this.data.sharedLinkToken}get status(){return this.data.status}get type(){return this.data.type}get updatedAt(){return this.data.updatedAt}get updatedBy(){return this.data.updatedBy}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.post("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await super.delete("/preview");return this.data=await t.json(),this}getModels(){return this.get("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){}setModelTransformMatrix(t,e){return console.warn("File does not support model transformation"),Promise.resolve(this)}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.get(e).then((t=>t.json()))}searchProperties(t){return this.post("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.get("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.get("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.post("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return super.delete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.get(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.get(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}download(t,e){return this.httpClient.downloadFile(this.getEndpointPath("/downloads"),t,{signal:e,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResource(t,e,s){return this.httpClient.downloadFile(this.getEndpointPath(`/downloads/${t}`),e,{signal:s,headers:this.headers}).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,r,i){return this.httpClient.downloadFileRange(this.getEndpointPath(`/downloads/${t}?requestId=${e}`),e,s,r,{signal:i,headers:this.headers}).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("File.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use File.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,r,i){await this.downloadResourceRange(s,t,e,r,i)}getReferences(t){return this.get("/references",t).then((t=>t.json()))}setReferences(t){return this.put("/references",t).then((t=>t.json()))}createJob(t,s){return new e("/jobs",this.httpClient,this.headers).post(this.appendVersionParam(""),{fileId:this.id,outputFormat:t,parameters:d(s)}).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}extractGeometry(t,e){return this.createJob("gltf"===t?"geometryGltf":"geometry",e)}extractProperties(t){return this.createJob("properties",t)}validate(t){return this.createJob("validation",t)}waitForDone(t,e,s){const r=Array.isArray(t)?t:[t];void 0===e&&(e=!0);return h((()=>this.checkout().then((t=>{var i;const a=r.filter((e=>{const s=t.status[e]||{};return["none","done","failed"].includes(s.state||"none")})),n=e?a.length===r.length:a.length>0;return(null===(i=null==s?void 0:s.onCheckout)||void 0===i?void 0:i.call(s,t,n))||n}))),s).then((()=>this))}getPermissions(){return this.get("/permissions").then((t=>t.json())).then((t=>t.map((t=>new y(t,this.id,this.httpClient)))))}getPermission(t){return this.get(`/permissions/${t}`).then((t=>t.json())).then((t=>new y(t,this.id,this.httpClient)))}createPermission(t,e,s){return this.post("/permissions",{actions:Array.isArray(t)?t:[t],grantedTo:e,public:s}).then((t=>t.json())).then((t=>new y(t,this.id,this.httpClient)))}deletePermission(t){return super.delete(`/permissions/${t}`).then((t=>t.json()))}async uploadVersion(t,e={waitForDone:!1}){const s=await this.httpClient.uploadFile(this.getEndpointPath("/versions"),t,(s=>{var r;return null===(r=e.onProgress)||void 0===r?void 0:r.call(e,s,t)}),{headers:this.headers}).then((t=>JSON.parse(t.responseText))).then((t=>new _(t,this.httpClient)));let r="";"none"!==this.versions[0].status.geometryGltf.state&&(r="gltf"),"none"!==this.versions[0].status.geometry.state&&(r="vsfx"),void 0===(e={...e}).geometry&&(e.geometry=""!==r),void 0===e.properties&&(e.properties="none"!==this.versions[0].status.properties.state);const i=[];return e.geometry&&i.push((await s.extractGeometry(r)).outputFormat),e.properties&&i.push((await s.extractProperties()).outputFormat),i.length>0&&(e.waitForDone?await s.waitForDone(i,!0,e):await s.checkout()),await this.checkout(),s}getVersions(){return this.get("/versions").then((t=>t.json())).then((t=>t.map((t=>new _(t,this.httpClient))))).then((t=>t.map((t=>t.id==t.originalFileId?t.useVersion(0):t))))}getVersion(t){return this.get(`/versions/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))).then((t=>t.id==t.originalFileId?t.useVersion(0):t))}async deleteVersion(t){const e=await super.delete(`/versions/${t}`),s=await e.json();return await this.checkout(),s}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return super.useVersion(t)}async deleteSource(){const t=await super.delete("/source");return this.data=await t.json(),this}async createSharedLink(t){const s=new e("/shares",this.httpClient,this.headers),r=await s.post("",{fileId:this.id,permissions:t}),i=await r.json();return await this.checkout(),new j(i,this.httpClient)}async getSharedLink(){if(!this.sharedLinkToken)return Promise.resolve(void 0);const t=new e("/shares",this.httpClient,this.headers),s=await t.get(`/${this.sharedLinkToken}`),r=await s.json();return new j(r,this.httpClient)}async deleteSharedLink(){const t=new e("/shares",this.httpClient,this.headers),s=await t.delete(`/${this.sharedLinkToken}`),r=await s.json();return await this.checkout(),r}}class b extends e{constructor(t,e,s){super("",s),this.projectId=e,this.data=t}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t,this.path=`/projects/${this.projectId}/roles/${t.name}`}get name(){return this.data.name}set name(t){this._data.name=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions=t||{}}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class $ extends e{constructor(t,e,s){super(`/projects/${e}/members/${t.id}`,s),this.data=t}get data(){return this._data}set data(t){this._data=t,this._data.user.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.user.userId}/avatar`,this._data.user.fullName=l(this._data.user),this._data.user.initials=u(this._data.user.fullName)}get id(){return this.data.id}get role(){return this.data.role}set role(t){this.data.role=t}get type(){return this.data.type}get user(){return this.data.user}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}}class A extends e{constructor(t,e){super(`/projects/${t.id}`,e),this.data=t}get authorization(){return this.data.authorization}get createdAt(){return this.data.createdAt}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.previewUrl=t.avatarUrl?`${this.httpClient.serverUrl}/projects/${this._data.id}/preview?updated=${t.updatedAt}`:"",this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=u(this._data.owner.fullName)}get description(){return this.data.description}set description(t){this.data.description=t}get endDate(){return this.data.endDate}set endDate(t){this.data.endDate=t instanceof Date?t.toISOString():t}get id(){return this.data.id}get memberCount(){return this.data.memberCount}get modelCount(){return this.data.modelCount}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get previewUrl(){return this._data.previewUrl}get public(){return this.data.public}set public(t){this.data.public=t}get startDate(){return this.data.startDate}set startDate(t){this.data.startDate=t instanceof Date?t.toISOString():t}get topicCount(){return this.data.topicCount}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.text())).then((t=>{try{return JSON.parse(t)}catch{return{id:this.id}}}))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.post("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await super.delete("/preview");return this.data=await t.json(),this}getRoles(){return this.get("/roles").then((t=>t.json())).then((t=>t.map((t=>new b(t,this.id,this.httpClient)))))}getRole(t){return this.get(`/roles/${t}`).then((t=>t.json())).then((t=>new b(t,this.id,this.httpClient)))}createRole(t,e,s){return this.post("/roles",{name:t,description:e,permissions:s||{}}).then((t=>t.json())).then((t=>new b(t,this.id,this.httpClient)))}deleteRole(t){return super.delete(`/roles/${t}`).then((t=>t.json()))}getMembers(){return this.get("/members").then((t=>t.json())).then((t=>t.map((t=>new $(t,this.id,this.httpClient)))))}getMember(t){return this.get(`/members/${t}`).then((t=>t.json())).then((t=>new $(t,this.id,this.httpClient)))}addMember(t,e){return this.post("/members",{userId:t,role:e}).then((t=>t.json())).then((t=>new $(t,this.id,this.httpClient)))}removeMember(t){return super.delete(`/members/${t}`).then((t=>t.json()))}getFilesInformation(){return new e("/bcf/3.0/projects",this.httpClient,this.headers).get(`/${this.id}/files_information`).then((t=>t.json())).then((t=>(t.forEach((t=>{const e=e=>(t.display_information.find((t=>t.field_display_name===e))||{}).field_value,s=`${this.httpClient.serverUrl}/files/${t.file.reference}/preview`,r=`${this.httpClient.serverUrl}/users/${e("Owner")}/avatar`,i=l(e("Owner First Name"),e("Owner Last Name"),e("Owner User Name")),a=u(i);t.display_information.push({field_display_name:"Preview URL",field_value:s}),t.display_information.push({field_display_name:"Owner Avatar URL",field_value:r}),t.display_information.push({field_display_name:"Owner Full Name",field_value:i}),t.display_information.push({field_display_name:"Owner Initials",field_value:a});const n=`${this.httpClient.serverUrl}/users/${e("Updated By")}/avatar`,o=l(e("Updated By First Name"),e("Updated By Last Name"),e("Updated By User Name")),h=u(o);t.display_information.push({field_display_name:"Updated By Avatar URL",field_value:n}),t.display_information.push({field_display_name:"Updated By Full Name",field_value:o}),t.display_information.push({field_display_name:"Updated By Initials",field_value:h});const d=e("Geometry Status"),p=e("GeometryGltf Status"),c="done"===d?"vsfx":"done"===p?"gltf":"";t.display_information.push({field_display_name:"Geometry Type",field_value:c})})),t)))}getModels(){return this.getFilesInformation().then((t=>t.map((t=>t.file.reference)))).then((t=>new e("/files",this.httpClient,this.headers).get(`?id=${t.join("|")}`))).then((t=>t.json())).then((t=>t.result.map((t=>new _(t,this.httpClient)))))}async addModel(t,s,r){const i=new e("/files",this.httpClient,this.headers),a=await i.get(`/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))),n=[{project:{id:this.id,name:this.name}}];return await a.createPermission(s,n,r),a}async removeModel(t){const s=new e("/files",this.httpClient,this.headers),r=await s.get(`/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient))),i=await r.getPermissions();return await Promise.allSettled(i.filter((t=>t.grantedTo.some((t=>{var e;return(null===(e=t.project)||void 0===e?void 0:e.id)===this.id})))).map((t=>t.delete()))),r}}class U extends e{constructor(t,e){super("",e),this.data=t}get avatarUrl(){return this._data.avatarUrl}get canCreateProject(){return this.data.canCreateProject}set canCreateProject(t){this._data.canCreateProject=t}get createAt(){return this.data.createAt}get customFields(){return this.data.customFields}set customFields(t){this._data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.avatarUrl=t.avatarImage?`${this.httpClient.serverUrl}/users/${this._data.id}/avatar?updated=${t.lastModified}`:"",this._data.fullName=l(this._data),this._data.initials=u(this._data.fullName)}get email(){return this.data.email}set email(t){this._data.email=t}get emailConfirmationId(){return this.data.emailConfirmationId}get firstName(){return this.data.firstName}set firstName(t){this._data.firstName=t}get fullName(){return this.data.fullName}get id(){return this.data.id}get initials(){return this.data.initials}get isAdmin(){return this.data.isAdmin}set isAdmin(t){this._data.isAdmin=t}get isEmailConfirmed(){return this.data.isEmailConfirmed}get lastModified(){return this.data.lastModified}get lastName(){return this.data.lastName}set lastName(t){this._data.lastName=t}get lastSignIn(){return this.data.lastSignIn}get projectsLimit(){return this.data.projectsLimit}set projectsLimit(t){this._data.projectsLimit=t}get providerType(){return this.data.providerType}get storageLimit(){return this.data.storageLimit}set storageLimit(t){this._data.storageLimit=t}get storageUsed(){return this.data.storageUsed}get token(){return this.data.tokenInfo.token}get userName(){return this.data.userName}set userName(t){this._data.userName=t}async checkout(){if(this.httpClient.signInUserIsAdmin){const t=await this.get(`/users/${this.id}`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const t=await this.get("/user"),e=await t.json();this.data={id:this.id,...e}}}return this}async update(t){if(this.httpClient.signInUserIsAdmin){const e=await this.put(`/users/${this.id}`,{isAdmin:t.isAdmin,userBrief:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const e=await this.put("/user",t),s=await e.json();this.data={id:this.id,...s}}}return this}delete(){return this.httpClient.signInUserIsAdmin?super.delete(`/users/${this.id}`).then((t=>t.json())).then((t=>(this.id===this.httpClient.signInUserId&&(delete this.httpClient.headers.Authorization,this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1),t))):Promise.reject(new a(403))}save(){return this.update(this.data)}async setAvatar(t){if(t)if(this.httpClient.signInUserIsAdmin){const e=await this.post(`/users/${this.id}/avatar`,t),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const e=await this.post("/user/avatar",t),s=await e.json();this.data={id:this.id,...s}}}else await this.deleteAvatar();return this}async deleteAvatar(){if(this.httpClient.signInUserIsAdmin){const t=await super.delete(`/users/${this.id}/avatar`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const t=await super.delete("/user/avatar"),e=await t.json();this.data={id:this.id,...e}}}return this}async changePassword(t,e){if(this.httpClient.signInUserIsAdmin){const e=await this.put(`/users/${this.id}/password`,{new:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new a(403));{const s=await this.put("/user/password",{old:e,new:t}),r=await s.json();this.data={id:this.id,...r}}}return this}}class I extends e{constructor(t,e){super(`/oauth/clients/${t.clientId}`,e),this.data=t}get authUrl(){return this.data.authUrl}get accessTokenUrl(){return this.data.accessTokenUrl}get clientId(){return this.data.clientId}get createdAt(){return this.data.createdAt}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get redirectUrl(){return this.data.redirectUrl}set redirectUrl(t){this.data.redirectUrl=t}get secret(){return this.data.secret}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.get("");return this.data=await t.json(),this}async update(t){const e=await this.put("",t);return this.data=await e.json(),this}delete(){return super.delete("").then((t=>t.json()))}save(){return this.update(this.data)}async revoke(){return await this.post("/revoke"),this}}class P extends _{constructor(t,e,s){super(t.file,s),this.path=`/shares/${t.file.sharedLinkToken}`,this.headers={"InWeb-Password":e}}async checkout(){const t=await this.get("/info"),e=await t.json();return this.data=e.file,this}async update(t){const e=await this.put("/info",t);return this.data=await e.json(),this}getVersions(){return Promise.resolve(void 0)}useVersion(t){return this}}t.Assembly=c,t.ClashTest=p,t.Client=class extends g{constructor(t={}){super(),this._serverUrl="",this._httpClient=new v(""),this._user=null,this.eventEmitter=this,this.configure(t)}get serverUrl(){return this._serverUrl}get httpClient(){return this._httpClient}get options(){console.warn("Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead.");const t={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0};return{...t,data:t,defaults:()=>t,resetToDefaults:()=>{},saveToStorage:()=>{},loadFromStorage:()=>{}}}configure(t){return this._serverUrl=(t.serverUrl||"").replace(/\/+$/,""),this._httpClient=new v(this.serverUrl),this._user=null,this}version(){return this.httpClient.get("/version").then((t=>t.json())).then((t=>({...t,server:t.version,client:"26.1.3"})))}registerUser(t,e,s){return this.httpClient.post("/register",{email:t,password:e,userName:null!=s?s:(t+"").split("@").at(0)}).then((t=>t.json()))}resendConfirmationEmail(t,e){return this.httpClient.post("/register/email-confirmation",{email:t,password:e}).then((t=>t.json()))}confirmUserEmail(t){return this.httpClient.get(`/register/email-confirmation/${t}`).then((t=>t.json()))}async signInWithEmail(t,e){const s=btoa(unescape(encodeURIComponent(t+":"+e)));this.httpClient.headers.Authorization="Basic "+s;const r=await this.httpClient.get("/token"),i=await r.json();return this.setCurrentUser(i)}async signInWithToken(t){this.httpClient.headers.Authorization=t;const e=await this.httpClient.get("/user"),s=await e.json();return this.setCurrentUser(s)}signOut(){this.clearCurrentUser()}setCurrentUser(t){return this._user=new U(t,this.httpClient),this.httpClient.headers.Authorization=t.tokenInfo.token,this.httpClient.signInUserId=this._user.id,this.httpClient.signInUserIsAdmin=this._user.isAdmin,this._user}clearCurrentUser(){this._user=null,delete this.httpClient.headers.Authorization,this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1}getCurrentUser(){return this._user&&!this.httpClient.signInUserId&&(this._user=null),this._user}getIdentityProviders(){return this.httpClient.get("/identity").then((t=>t.json()))}getServerSettings(){return this.httpClient.get("/settings").then((t=>t.json()))}updateServerSettings(t){return this.httpClient.put("/settings",t).then((t=>t.json()))}getOAuthClients(t,e){const s=new URLSearchParams;t>0&&s.set("start",t.toString()),e>0&&s.set("limit",e.toString());let r=s.toString();return r&&(r="?"+r),this.httpClient.get(`/oauth/clients${r}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new I(t,this.httpClient)))})))}getOAuthClient(t){return this.httpClient.get(`/oauth/clients/${t}`).then((t=>t.json())).then((t=>new I(t,this.httpClient)))}createOAuthClient(t,e,s){return this.httpClient.post("/oauth/clients",{name:t,redirectUrl:e,description:s}).then((t=>t.json())).then((t=>new I(t,this.httpClient)))}deleteOAuthClient(t){return this.httpClient.delete(`/oauth/clients/${t}`).then((t=>t.json()))}getUsers(){return this.httpClient.get("/users").then((t=>t.json())).then((t=>t.map((t=>({id:t.id,...t.userBrief}))))).then((t=>t.map((t=>new U(t,this.httpClient)))))}getUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.get(`/users/${t}`).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new U(t,this.httpClient))):t===this.httpClient.signInUserId?this.httpClient.get("/user").then((t=>t.json())).then((e=>({id:t,...e}))).then((t=>new U(t,this.httpClient))):Promise.reject(new a(403))}createUser(t,e,s={}){const{isAdmin:r,userName:i,...a}=s;return this.httpClient.post("/users",{isAdmin:r,userBrief:{...a,email:t,userName:null!=i?i:(t+"").split("@").at(0)},password:e}).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new U(t,this.httpClient)))}deleteUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${t}`).then((t=>t.json())).then((e=>(t===this.httpClient.signInUserId&&this.clearCurrentUser(),e))):Promise.reject(new a(403))}getFiles(t,e,s,r,i,a,n,o){const h=new URLSearchParams;t>0&&h.set("start",t.toString()),e>0&&h.set("limit",e.toString()),s&&h.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.toLowerCase()),r&&h.set("ext",r)),i&&(Array.isArray(i)&&(i=i.join("|")),h.set("id",i)),void 0!==a&&h.set("sortBy",a?"desc":"asc"),n&&h.set("sortField",n),o&&h.set("shared","true");let d=h.toString();return d&&(d="?"+d),this.httpClient.get(`/files${d}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new _(t,this.httpClient)))})))}getFile(t){return this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new _(t,this.httpClient)))}async uploadFile(t,e={geometry:!0,properties:!1,waitForDone:!1}){const s=await this.httpClient.uploadFile("/files",t,(s=>{var r;this.emitEvent({type:"uploadprogress",data:s,file:t}),null===(r=e.onProgress)||void 0===r||r.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new _(t,this.httpClient))),r="string"==typeof e.geometry?e.geometry:"vsfx",i=[];return e.geometry&&i.push((await s.extractGeometry(r)).outputFormat),e.properties&&i.push((await s.extractProperties()).outputFormat),i.length>0&&(e.waitForDone?await s.waitForDone(i,!0,e):await s.checkout()),s}deleteFile(t){return this.httpClient.delete(`/files/${t}`).then((t=>t.json()))}downloadFile(t,e,s){return this.httpClient.downloadFile(`/files/${t}/downloads`,e,{signal:s}).then((t=>t.arrayBuffer()))}getJobs(t,e,s,r,i){const a=new URLSearchParams;s>0&&a.set("start",s.toString()),e>0&&a.set("limit",e.toString()),t&&(Array.isArray(t)&&(t=t.join("|")),"string"==typeof t&&(t=t.trim().toLowerCase()),t&&a.set("status",t)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),i&&a.set("sortField",i);let n=a.toString();return n&&(n="?"+n),this.httpClient.get(`/jobs${n}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new C(t,this.httpClient)))})))}getJob(t){return this.httpClient.get(`/jobs/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}createJob(t,e,s){return this.httpClient.post("/jobs",{fileId:t,outputFormat:e,parameters:d(s)}).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}deleteJob(t){return this.httpClient.delete(`/jobs/${t}`).then((t=>t.json()))}getAssemblies(t,e,s,r,i,a){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&n.set("id",r)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),a&&n.set("sortField",a);let o=n.toString();return o&&(o="?"+o),this.httpClient.get(`/assemblies${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new c(t,this.httpClient)))})))}getAssembly(t){return this.httpClient.get(`/assemblies/${t}`).then((t=>t.json())).then((t=>new c(t,this.httpClient)))}createAssembly(t,e,s){const{waitForDone:r}=null!=s?s:{};return this.httpClient.post("/assemblies",{name:e,files:t}).then((t=>t.json())).then((t=>new c(t,this.httpClient))).then((t=>r?t.waitForDone(s):t))}deleteAssembly(t){return this.httpClient.delete(`/assemblies/${t}`).then((t=>t.json()))}getProjects(t,e,s,r,i){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),r&&(Array.isArray(r)&&(r=r.join("|")),"string"==typeof r&&(r=r.trim()),r&&a.set("id",r)),void 0!==i&&a.set("sortBy",i?"desc":"asc");let n=a.toString();return n&&(n="?"+n),this.httpClient.get(`/projects${n}`).then((t=>t.json())).then((i=>{if(Array.isArray(i)){let a=i;if(r&&(a=a.filter((t=>r.includes(t.id)))),s&&(a=a.filter((t=>t.name.includes(s)))),e>0){const s=t>0?t:0;a=a.slice(s,s+e)}return{allSize:i.length,start:t,limit:e,result:a,size:a.length}}return i})).then((t=>({...t,result:t.result.map((t=>new A(t,this.httpClient)))})))}getProject(t){return this.httpClient.get(`/projects/${t}`).then((t=>t.json())).then((t=>new A(t,this.httpClient)))}createProject(t,e,s,r){return this.httpClient.post("/projects",{name:t,description:e,startDate:s instanceof Date?s.toISOString():s,endDate:r instanceof Date?r.toISOString():r}).then((t=>t.json())).then((t=>new A(t,this.httpClient)))}deleteProject(t){return this.httpClient.delete(`/projects/${t}`).then((t=>t.text())).then((e=>{try{return JSON.parse(e)}catch{return{id:t}}}))}getSharedLink(t){return this.httpClient.get(`/shares/${t}`).then((t=>t.json())).then((t=>new j(t,this.httpClient)))}createSharedLink(t,e){return this.httpClient.post("/shares",{fileId:t,permissions:e}).then((t=>t.json())).then((t=>new j(t,this.httpClient)))}deleteSharedLink(t){return this.httpClient.delete(`/shares/${t}`).then((t=>t.json()))}getSharedFile(t,e){return this.httpClient.get(`/shares/${t}/info`,{headers:{"InWeb-Password":e}}).then((t=>t.json())).then((t=>new P(t,e,this.httpClient)))}},t.Endpoint=e,t.FetchError=a,t.File=_,t.Job=C,t.Member=$,t.Model=n,t.OAuthClient=I,t.Permission=y,t.Project=A,t.Role=b,t.SharedFile=P,t.SharedLink=j,t.User=U,t.parseArgs=d,t.statusText=r,t.userFullName=l,t.userInitials=u,t.version="26.1.3",t.waitFor=h}));
@@ -1,3 +1,5 @@
1
+ import { EventEmitter2 } from "@inweb/eventemitter2";
2
+
1
3
  class Endpoint {
2
4
  constructor(path, httpClient, headers = {}) {
3
5
  this.path = path;
@@ -257,9 +259,9 @@ async function waitFor(func, params = {}) {
257
259
  var _a, _b, _c;
258
260
  const timeout = params.timeout || 6e5;
259
261
  const interval = params.interval || 3e3;
260
- const signal = (_a = params.signal) !== null && _a !== void 0 ? _a : (new AbortController).signal;
261
- const abortError = (_b = params.abortError) !== null && _b !== void 0 ? _b : new DOMException("Aborted", "AbortError");
262
- const timeoutError = (_c = params.timeoutError) !== null && _c !== void 0 ? _c : new DOMException("Timeout", "TimeoutError");
262
+ const signal = (_a = params.signal) !== null && _a !== undefined ? _a : (new AbortController).signal;
263
+ const abortError = (_b = params.abortError) !== null && _b !== undefined ? _b : new DOMException("Aborted", "AbortError");
264
+ const timeoutError = (_c = params.timeoutError) !== null && _c !== undefined ? _c : new DOMException("Timeout", "TimeoutError");
263
265
  const end = performance.now() + timeout;
264
266
  let count = timeout / interval;
265
267
  do {
@@ -282,9 +284,9 @@ function parseArgs(args) {
282
284
  function userFullName(firstName, lastName = "", userName = "") {
283
285
  var _a;
284
286
  if (firstName && typeof firstName !== "string") {
285
- return userFullName((_a = firstName.firstName) !== null && _a !== void 0 ? _a : firstName.name, firstName.lastName, firstName.userName);
287
+ return userFullName((_a = firstName.firstName) !== null && _a !== undefined ? _a : firstName.name, firstName.lastName, firstName.userName);
286
288
  }
287
- return `${firstName !== null && firstName !== void 0 ? firstName : ""} ${lastName !== null && lastName !== void 0 ? lastName : ""}`.trim() || userName;
289
+ return `${firstName !== null && firstName !== undefined ? firstName : ""} ${lastName !== null && lastName !== undefined ? lastName : ""}`.trim() || userName;
288
290
  }
289
291
 
290
292
  function userInitials(fullName = "") {
@@ -368,7 +370,7 @@ class ClashTest extends Endpoint {
368
370
  const checkDone = () => this.checkout().then((test => {
369
371
  var _a;
370
372
  const ready = [ "done", "failed" ].includes(test.status);
371
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, test, ready);
373
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, test, ready);
372
374
  return cancel || ready;
373
375
  }));
374
376
  return waitFor(checkDone, params).then((() => this));
@@ -402,7 +404,7 @@ class Assembly extends Endpoint {
402
404
  this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
403
405
  this._data.owner.fullName = userFullName(this._data.owner);
404
406
  this._data.owner.initials = userInitials(this._data.owner.fullName);
405
- (_a = (_b = this._data).associatedFiles) !== null && _a !== void 0 ? _a : _b.associatedFiles = [];
407
+ (_a = (_b = this._data).associatedFiles) !== null && _a !== undefined ? _a : _b.associatedFiles = [];
406
408
  this._data.associatedFiles.forEach((file => file.link = `${this.httpClient.serverUrl}/files/${file.fileId}`));
407
409
  }
408
410
  get files() {
@@ -539,7 +541,7 @@ class Assembly extends Endpoint {
539
541
  const checkDone = () => this.checkout().then((assembly => {
540
542
  var _a;
541
543
  const ready = [ "done", "failed" ].includes(assembly.status);
542
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, assembly, ready);
544
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, assembly, ready);
543
545
  return cancel || ready;
544
546
  }));
545
547
  return waitFor(checkDone, params).then((() => this));
@@ -567,7 +569,7 @@ class Assembly extends Endpoint {
567
569
  return this.get(`/clashes/${testId}`).then((response => response.json())).then((data => new ClashTest(data, this.path, this.httpClient)));
568
570
  }
569
571
  createClashTest(name, selectionTypeA, selectionTypeB, selectionSetA, selectionSetB, params) {
570
- const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !== void 0 ? params : {};
572
+ const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !== undefined ? params : {};
571
573
  if (!Array.isArray(selectionSetA)) selectionSetA = [ selectionSetA ];
572
574
  if (!Array.isArray(selectionSetB)) selectionSetB = [ selectionSetB ];
573
575
  return this.post("/clashes", {
@@ -602,56 +604,17 @@ class Assembly extends Endpoint {
602
604
  activeVersion: version
603
605
  });
604
606
  }
605
- async createSharedLink(permissions) {
607
+ createSharedLink(permissions) {
606
608
  return Promise.reject(new Error("Assembly shared link will be implemeted in a future release"));
607
609
  }
608
- async getSharedLink() {
610
+ getSharedLink() {
609
611
  return Promise.resolve(undefined);
610
612
  }
611
- async deleteSharedLink() {
613
+ deleteSharedLink() {
612
614
  return Promise.reject(new FetchError(404));
613
615
  }
614
616
  }
615
617
 
616
- class EventEmitter2 {
617
- constructor() {
618
- this._listeners = {};
619
- }
620
- addEventListener(type, listener) {
621
- if (this._listeners[type] === undefined) this._listeners[type] = [];
622
- this._listeners[type].push(listener);
623
- return this;
624
- }
625
- removeEventListener(type, listener) {
626
- if (this._listeners[type] === undefined) return this;
627
- const listeners = this._listeners[type].filter((x => x !== listener));
628
- if (listeners.length !== 0) this._listeners[type] = listeners; else delete this._listeners[type];
629
- return this;
630
- }
631
- removeAllListeners(type) {
632
- if (type) delete this._listeners[type]; else this._listeners = {};
633
- return this;
634
- }
635
- emitEvent(event) {
636
- if (this._listeners[event.type] === undefined) return false;
637
- const invoke = this._listeners[event.type].slice();
638
- invoke.forEach((listener => listener.call(this, event)));
639
- return true;
640
- }
641
- on(type, listener) {
642
- return this.addEventListener(type, listener);
643
- }
644
- off(type, listener) {
645
- return this.removeEventListener(type, listener);
646
- }
647
- emit(type, ...args) {
648
- if (typeof type === "string") return this.emitEvent({
649
- type: type,
650
- args: args
651
- }); else if (typeof type === "object") return this.emitEvent(type); else return false;
652
- }
653
- }
654
-
655
618
  function handleFetchError(response) {
656
619
  if (!response.ok) {
657
620
  switch (response.status) {
@@ -1000,7 +963,7 @@ class Job extends Endpoint {
1000
963
  const checkDone = () => this.checkout().then((job => {
1001
964
  var _a;
1002
965
  const ready = [ "done", "failed" ].includes(job.status);
1003
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, job, ready);
966
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, job, ready);
1004
967
  return cancel || ready;
1005
968
  }));
1006
969
  return waitFor(checkDone, params).then((() => this));
@@ -1082,32 +1045,32 @@ class File extends Endpoint {
1082
1045
  if (typeof this._data.owner === "string") this._data.owner = {
1083
1046
  userId: this._data.owner
1084
1047
  };
1085
- (_a = (_p = this._data).owner) !== null && _a !== void 0 ? _a : _p.owner = {};
1048
+ (_a = (_p = this._data).owner) !== null && _a !== undefined ? _a : _p.owner = {};
1086
1049
  this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
1087
1050
  this._data.owner.fullName = userFullName(this._data.owner);
1088
1051
  this._data.owner.initials = userInitials(this._data.owner.fullName);
1089
- (_b = (_q = this._data).status) !== null && _b !== void 0 ? _b : _q.status = {};
1090
- (_c = (_r = this._data.status).geometry) !== null && _c !== void 0 ? _c : _r.geometry = {
1091
- state: (_d = this._data.geometryStatus) !== null && _d !== void 0 ? _d : "none"
1052
+ (_b = (_q = this._data).status) !== null && _b !== undefined ? _b : _q.status = {};
1053
+ (_c = (_r = this._data.status).geometry) !== null && _c !== undefined ? _c : _r.geometry = {
1054
+ state: (_d = this._data.geometryStatus) !== null && _d !== undefined ? _d : "none"
1092
1055
  };
1093
- (_e = (_s = this._data.status).properties) !== null && _e !== void 0 ? _e : _s.properties = {
1094
- state: (_f = this._data.propertiesStatus) !== null && _f !== void 0 ? _f : "none"
1056
+ (_e = (_s = this._data.status).properties) !== null && _e !== undefined ? _e : _s.properties = {
1057
+ state: (_f = this._data.propertiesStatus) !== null && _f !== undefined ? _f : "none"
1095
1058
  };
1096
- (_g = (_t = this._data.status).validation) !== null && _g !== void 0 ? _g : _t.validation = {
1097
- state: (_h = this._data.validationStatus) !== null && _h !== void 0 ? _h : "none"
1059
+ (_g = (_t = this._data.status).validation) !== null && _g !== undefined ? _g : _t.validation = {
1060
+ state: (_h = this._data.validationStatus) !== null && _h !== undefined ? _h : "none"
1098
1061
  };
1099
- (_j = (_u = this._data).updatedBy) !== null && _j !== void 0 ? _j : _u.updatedBy = {};
1062
+ (_j = (_u = this._data).updatedBy) !== null && _j !== undefined ? _j : _u.updatedBy = {};
1100
1063
  this._data.updatedBy.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`;
1101
1064
  this._data.updatedBy.fullName = userFullName(this._data.updatedBy);
1102
1065
  this._data.updatedBy.initials = userInitials(this._data.updatedBy.fullName);
1103
- (_k = (_v = this._data).versions) !== null && _k !== void 0 ? _k : _v.versions = [ {
1066
+ (_k = (_v = this._data).versions) !== null && _k !== undefined ? _k : _v.versions = [ {
1104
1067
  ...value
1105
1068
  } ];
1106
- (_l = (_w = this._data.status).geometryGltf) !== null && _l !== void 0 ? _l : _w.geometryGltf = {
1069
+ (_l = (_w = this._data.status).geometryGltf) !== null && _l !== undefined ? _l : _w.geometryGltf = {
1107
1070
  state: "none"
1108
1071
  };
1109
- (_m = (_x = this._data).isFileDeleted) !== null && _m !== void 0 ? _m : _x.isFileDeleted = false;
1110
- (_o = (_y = this._data).sharedLinkToken) !== null && _o !== void 0 ? _o : _y.sharedLinkToken = null;
1072
+ (_m = (_x = this._data).isFileDeleted) !== null && _m !== undefined ? _m : _x.isFileDeleted = false;
1073
+ (_o = (_y = this._data).sharedLinkToken) !== null && _o !== undefined ? _o : _y.sharedLinkToken = null;
1111
1074
  }
1112
1075
  get exports() {
1113
1076
  return this.data.exports;
@@ -1286,7 +1249,7 @@ class File extends Endpoint {
1286
1249
  return [ "none", "done", "failed" ].includes(jobStatus.state || "none");
1287
1250
  }));
1288
1251
  const ready = waitAll ? readyJobs.length === waitJobs.length : readyJobs.length > 0;
1289
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, file, ready);
1252
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, file, ready);
1290
1253
  return cancel || ready;
1291
1254
  }));
1292
1255
  return waitFor(checkDone, params).then((() => this));
@@ -1312,7 +1275,7 @@ class File extends Endpoint {
1312
1275
  }) {
1313
1276
  const result = await this.httpClient.uploadFile(this.getEndpointPath("/versions"), file, (progress => {
1314
1277
  var _a;
1315
- return (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
1278
+ return (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file);
1316
1279
  }), {
1317
1280
  headers: this.headers
1318
1281
  }).then((xhr => JSON.parse(xhr.responseText))).then((data => new File(data, this.httpClient)));
@@ -1706,7 +1669,7 @@ class Project extends Endpoint {
1706
1669
  const permissions = await file.getPermissions();
1707
1670
  await Promise.allSettled(permissions.filter((permission => permission.grantedTo.some((x => {
1708
1671
  var _a;
1709
- return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id;
1672
+ return ((_a = x.project) === null || _a === undefined ? undefined : _a.id) === this.id;
1710
1673
  })))).map((permission => permission.delete())));
1711
1674
  return file;
1712
1675
  }
@@ -2115,14 +2078,14 @@ class Client extends EventEmitter2 {
2115
2078
  return this.httpClient.get("/version").then((response => response.json())).then((data => ({
2116
2079
  ...data,
2117
2080
  server: data.version,
2118
- client: "26.1.1"
2081
+ client: "26.1.3"
2119
2082
  })));
2120
2083
  }
2121
2084
  registerUser(email, password, userName) {
2122
2085
  return this.httpClient.post("/register", {
2123
2086
  email: email,
2124
2087
  password: password,
2125
- userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").at(0)
2088
+ userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0)
2126
2089
  }).then((response => response.json()));
2127
2090
  }
2128
2091
  resendConfirmationEmail(email, password) {
@@ -2228,7 +2191,7 @@ class Client extends EventEmitter2 {
2228
2191
  userBrief: {
2229
2192
  ...rest,
2230
2193
  email: email,
2231
- userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").at(0)
2194
+ userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0)
2232
2195
  },
2233
2196
  password: password
2234
2197
  }).then((response => response.json())).then((data => ({
@@ -2287,7 +2250,7 @@ class Client extends EventEmitter2 {
2287
2250
  data: progress,
2288
2251
  file: file
2289
2252
  });
2290
- (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
2253
+ (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file);
2291
2254
  })).then((xhr => JSON.parse(xhr.responseText))).then((data => new File(data, this.httpClient)));
2292
2255
  const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
2293
2256
  const jobs = [];
@@ -2358,7 +2321,7 @@ class Client extends EventEmitter2 {
2358
2321
  return this.httpClient.get(`/assemblies/${assemblyId}`).then((response => response.json())).then((data => new Assembly(data, this.httpClient)));
2359
2322
  }
2360
2323
  createAssembly(files, name, params) {
2361
- const {waitForDone: waitForDone} = params !== null && params !== void 0 ? params : {};
2324
+ const {waitForDone: waitForDone} = params !== null && params !== undefined ? params : {};
2362
2325
  return this.httpClient.post("/assemblies", {
2363
2326
  name: name,
2364
2327
  files: files
@@ -2446,7 +2409,7 @@ class Client extends EventEmitter2 {
2446
2409
  }
2447
2410
  }
2448
2411
 
2449
- const version = "26.1.1";
2412
+ const version = "26.1.3";
2450
2413
 
2451
2414
  export { Assembly, ClashTest, Client, Endpoint, FetchError, File, Job, Member, Model, OAuthClient, Permission, Project, Role, SharedFile, SharedLink, User, parseArgs, statusText, userFullName, userInitials, version, waitFor };
2452
2415
  //# sourceMappingURL=client.module.js.map