胶州空管前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1 lines
1.2 MiB

var version="2024-10-16-16-6",Glodon$1=window.Glodon=window.Glodon||{};Glodon$1.Version=version,function(){function e(e,t){let i=t.split("."),n=e,o=i.length;for(let e=0;e<o;e++)void 0===n[i[e]]&&(n[i[e]]={}),n=n[i[e]];return n}e(Glodon$1,"Web.Lang.Utility.Namespace").ensureNamespace=e}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Common"),t=function(e){"string"==typeof e&&(e=JSON.parse(res)),this.code=e.code,this.message=e.message};t.prototype={getErrorCode:function(){return this.code},getErrorMessage:function(){return this.message}},e.Error=t}(),function(e){const t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Common.Flexible");let i=!1,n=!1,o="37.5px";var s,r=e.document,a=r.documentElement,l=r.querySelector('meta[name="viewport"]');if(e.addEventListener("resize",(function(){clearTimeout(s),s=setTimeout(d,300)}),!1),e.addEventListener("pageshow",(function(e){e.persisted&&(clearTimeout(s),s=setTimeout(d,300))}),!1),!l)if((l=r.createElement("meta")).setAttribute("name","viewport"),l.setAttribute("content","initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"),a.firstElementChild)a.firstElementChild.appendChild(l);else{var h=r.createElement("div");h.appendChild(l),r.write(h.innerHTML)}function d(){let t=e.screen.availWidth||375,s=e.screen.availHeight||667;i=t>s;var r=navigator.userAgent,a=/(?:Android)/.test(r),l=/(?:Firefox)/.test(r),h=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1;n=/(?:iPad|PlayBook)/.test(r)||a&&!/(?:Mobile)/.test(r)||l&&/(?:Tablet)/.test(r)||h;var d=Math.min(t,s);t=d<=320?320:d>320&&d<=414?d:d>414&&d<1024?420:450,o=t/10+"px"}d();t.getIsHorizontal=()=>i,t.getIsTablet=()=>n,t.getFontSize=()=>o}(window);class Vector3{constructor(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}clone(){return new this.constructor(this.x,this.y,this.z)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}distanceToSquared(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}}class Box3{constructor(e,t){this.min=e||new Vector3(1/0,1/0,1/0),this.max=t||new Vector3(-1/0,-1/0,-1/0)}getSize(){return new Vector3(this.max.x-this.min.x,this.max.y-this.min.y,this.max.z-this.min.z)}setFromCenterAndSize(e,t){let i=new Vector3(t.x,t.y).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}getCenter(){return new Vector3(this.min.x+this.max.x,this.min.y+this.max.y,this.min.z+this.max.z).multiplyScalar(.5)}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}union(e){return this.min.min(e.min),this.max.max(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}expandByPoint(e){return this.min.min(e),this.max.max(e),this}setFromPoints(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Algorithm");e.MeanShift=class{constructor(e,t){this.points=e,this.searchRangeSquared=t**2,this.EPSILON_SQR=.1,this.clusters=[]}setSearchRange(e){this.searchRangeSquared=e**2}setPoints(e){this.points=e}meanShift(e){let t=e.clone(),i=[];for(;;){let e=this.rangeSearch(t);i=this.connect(i,e);let n=this.mean(e);if(t.distanceToSquared(n)<=this.EPSILON_SQR)break;t=n}return i}mean(e){let t=new Vector3;for(const i of e)t.add(i);return t.multiplyScalar(1/e.length),t}rangeSearch(e){let t=[];for(const i of this.points)e.distanceToSquared(i)<=this.searchRangeSquared&&t.push(i);return t}clustering(e,t){0===this.clusters.length?this.clusteringPrepare():this.clusteringAfter(e,t),this.clusters.forEach((e=>{this.resetPointStatus(e.points)}))}clusteringPrepare(){for(const e of this.points){if(e.stopMoving)continue;const t=this.meanShift(e),i=t.length,n=`${t[0].index}_${i}`;this.mergeClusters({points:t,center:this.mean(t),id:n,parent:null,children:[]})}}clusteringAfter(e,t){this.tmpPoints=this.points,this.points=[];let i=[...this.clusters];if(this.clusters=[],!1!==e){for(let e=0;e<i.length;e++){const n=i[e];let o=[];t||this.resetClusterPoints(n.points),this.points=n.points,this.clusteringZoomIn(n,o),this.clusters.push.apply(this.clusters,o)}this.clusters.forEach((e=>{this.resetPointStatus(e.points)}))}else this.clusteringZoomOut(i,t)}clusteringZoomIn(e,t){for(const i of e.points){if(i.stopMoving)continue;const n=this.meanShift(i),o=n.length,s=`${n[0].index}_${o}`;this.mergeClustersInTarget({points:n,center:this.mean(n),id:s,parent:e.id,children:[]},t)}}clusteringZoomOut(e,t){for(let i=0;i<e.length;i++){const n=e[i];t||this.resetClusterPoints(n.points),n.center=this.mean(n.points),this.updateClusterBbox(n),n.children=[],n.parent=null,n.isMerged=!1}for(let t=0;t<e.length;t++){const i=Object.assign({},e[t]);if(!0===i.isMerged)continue;let n=[i.id];for(let o=t+1;o<e.length;o++){const t=e[o];if(!0===t.isMerged)continue;i.center.distanceToSquared(t.center)<=4*this.searchRangeSquared&&(t.isMerged=!0,i.points=this.connect(i.points,t.points,!0),n.push(t.id))}if(i.isMerged=!0,n.length>1){i.center=this.mean(i.points),this.updateClusterBbox(i);const e=i.points.length,t=`${i.points[0].index}_${e}`;i.id=t,i.children=n}this.clusters.push(i)}this.clusters.forEach((e=>{delete e.isMerged,this.resetPointStatus(e.points)}))}mergeClusters(e){let t=!1;for(const i of this.clusters){const n=e.center.distanceToSquared(i.center)<=4*this.searchRangeSquared,o=i.parent==i.parent;if(n&&o){i.points=this.connect(i.points,e.points,!0),i.center=this.mean(i.points),this.updateClusterBbox(i);const n=i.points.length,o=`${i.points[0].index}_${n}`;i.id=o,i.children=[],t=!0;break}}!1===t&&(this.updateClusterBbox(e),this.clusters.push(e))}mergeClustersInTarget(e,t){let i=!1;for(const n of t){if(e.center.distanceToSquared(n.center)<=4*this.searchRangeSquared){n.points=this.connect(n.points,e.points,!0),n.center=this.mean(n.points),this.updateClusterBbox(n);const t=n.points.length,o=`${n.points[0].index}_${t}`;n.id=o,n.children=[],i=!0;break}}!1===i&&(this.updateClusterBbox(e),t.push(e))}removeNodeFromParents(e,t){let i=t.indexOf(e);i>=0&&t.splice(i,1)}updateClusterBbox(e){let t=(new Box3).setFromPoints(e.points);e.bbox=t}connect(e,t,i){let n=[...e];for(const e of t)e.stopMoving&&!i||n.push(e),e.stopMoving=!0;return n}resetPointStatus(e){for(const t of e)t.stopMoving=!1}resetClusterPoints(e){for(let t=0;t<e.length;t++)for(let i=0;i<this.tmpPoints.length;i++)if(e[t].index===this.tmpPoints[i].index){e[t]=this.tmpPoints[i];break}}}}();class Vector2{constructor(e,t){this.x=e||0,this.y=t||0}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}normalize(){return this.multiplyScalar(1/this.length())}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}addScalar(e){return this.x+=e,this.y+=e,this}rotateAround(e,t){var i=Math.cos(t),n=Math.sin(t),o=this.x-e.x,s=this.y-e.y;return this.x=o*i-s*n+e.x,this.y=o*n+s*i+e.y,this}setLength(e){return this.multiplyScalar(e/this.length())}angle(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}distanceToSquared(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}}class Box2{constructor(e,t){this.min=e||new Vector2(1/0,1/0),this.max=t||new Vector2(-1/0,-1/0)}getSize(){return new Vector2(this.max.x-this.min.x,this.max.y-this.min.y)}setFromCenterAndSize(e,t){let i=new Vector2(t.x,t.y).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}getCenter(){return new Vector2(this.min.x+this.max.x,this.min.y+this.max.y).multiplyScalar(.5)}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}union(e){return this.min.min(e.min),this.max.max(e.max),this}expandByPoint(e){return this.min.min(e),this.max.max(e),this}}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Algorithm");class t{constructor(){}}t.toThreeJsBox2=function(e,t=0){let i=[];for(const n of e){let e=Math.min(t,100)/100,o=Math.max(n[1][1]-n[0][1],n[1][0]-n[0][0])*e,s=new Vector2(n[0][0],n[0][1]),r=new Vector2(n[1][0],n[1][1]),a=new Box2(s,r),l=a.getSize();i.push((new Box2).setFromCenterAndSize(a.getCenter(),l.addScalar(2*o)))}let n=0;for(const e of i)e.indices=[n++];return i},t.toDrawingBox2=function(e){let t=[];for(const i of e){let e=[];e.push([i.min.x,i.min.y]),e.push([i.max.x,i.max.y]),t.push(e)}return t},t.merge=function(e,t){let i=e.length;for(let n=0;n<=i;n++){if(n===i){e.push(t);break}let o=e[n];if(o.intersectsBox(t)){o.union(t),o.indices=o.indices.concat(t.indices);break}}},t.mergeBoundingBox=function(e){let i=e,n=[];for(;;){for(let e=0;e<i.length;e++)t.merge(n,i[e]);if(n.length===i.length)break;i=n.slice(0,n.length),n=[]}return n},e.BoundingBoxUtil=t}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Type").inheritPrototype=function(e,t){var i=function(e){function t(){}return t.prototype=e,new t}(t.prototype);i.constructor=e,e.prototype=i},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.HttpRequest"),t={},i=function(e,t){var i=Object.assign({type:"get",cache:!0,headers:{"Content-type":"application/x-www-form-urlencoded"},data:null,async:!0,success:null,failure:null},e);const n=e=>{i.success&&i.success(e.responseText,e.responseXML)},o=e=>{i.failure&&i.failure(e)},s=(e,t)=>{var n;(n=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")).onreadystatechange=function(){if(4==n.readyState){var i=n.status;if(i>=200&&i<300||304==i||0===i&&"file:"===window.location.protocol){let{responseText:t,responseXML:i}=n;e({responseText:t,responseXML:i})}else t(i)}},n.open(i.type,i.url,i.async);for(let e in i.headers)n.setRequestHeader(e,i.headers[e]);n.send(i.data)};t?CLOUD.Storage.IndexedDBHelper.loadWithStorage("InfoData",i.url,(()=>new Promise(s)),n,o):s(n,o)},n=function(e,i,n){if(void 0===t[e]){let o=document.createElement("script");o.type="text/javascript",o.src=e,document.head.appendChild(o),t[e]={callbacks:[],failCallbacks:[]},t[e].callbacks.push(i),t[e].failCallbacks.push(n),o.readyState?o.onreadystatechange=function(){"loaded"==o.readyState||"complete"==o.readyState?(o.onreadystatechange=null,t[e].callbacks.map((e=>{e&&e()})),t[e]=!0):"uninitialized"==o.readyState&&(o.onreadystatechange=null,t[e].failCallbacks.map((e=>{e&&e()})),t[e]=!1)}:(o.onload=function(){t[e].callbacks.map((e=>{e&&e()})),t[e]=!0},o.onerror=function(){t[e].failCallbacks.map((e=>{e&&e()})),t[e]=!1})}else!0===t[e]?i&&i():!1===t[e]?n&&n():(t[e].callbacks.push(i),t[e].failCallbacks.push(n))},o=function(e,t,n){let o;return o="string"==typeof e?{url:e,status:t}:e,new Promise((function(e,s){i(Object.assign({},o,{success:function(i){try{var n=JSON.parse(i)}catch(t){return e(i)}"success"==n.code||"noCode"==o.status||"bimfaceservice-0000"==n.code?e("noCode"==t?n:n.data):s(`requestError,dataCode:${n.code}, dataMessage:${n.message}`)},failure:e=>{s(e)}}),n)}))},s={singleModel:"fileId",integrateModel:"integrateId",compareModel:"compareId"};e.ajax=i,e.promiseJSONRequest=o,e.getScript=n,e.getScripts=function(e,t){e.length<=1?n(e.shift(),t):Promise.all(e.map((e=>new Promise(((t,i)=>{n(e,(()=>{t()}))}))))).then((()=>{t&&t()}))},e.promiseJsonFunction=function(e){if("Fast"===(e.loadMode||"Fast"))return o(e.url,e.status,e.enableStorage);{let{APIHost:t,path:i,fileId:n,viewToken:r,modelType:a}=e;return o(`${t}/data/v1/databag/resource-stream?${s[a]||"fileId"}=${n}&view_token=${r}&path=${i}`,e.status,e.enableStorage)}},e.getUrl=function(e){if("Strict"==(e.loadMode||"Fast")){let{APIHost:t,path:i,fileId:n,viewToken:o,modelType:r,workerType:a}=e;return`${t}/data/v1/databag/resource-stream?${a?"workerType="+a+"&":""}${s[r]||"fileId"}=${n}&view_token=${o}&path=${i}`}return e.url}}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.FullScreen");e.fullScreen=function(e){if(!e)return!1;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen()},e.exitFullScreen=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()},e.onFullScreenChanged=function(e){var t=function(){e&&e()};document.onfullscreenchange=t,"onwebkitfullscreenchange"in document?document.onwebkitfullscreenchange=t:document.documentElement.onwebkitfullscreenchange=t,document.onmozfullscreenchange=t,document.onmsfullscreenchange=t},e.isFullScreen=function(){return document.webkitIsFullScreen||!!document.mozFullScreenElement||!!document.msFullScreenElement||!1}}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.ClientHelper"),t=null;if(e.getIsDesktop)return;var i=function(e,t,i){i=i||"asc";var n=!1;return t?t.indexOf(".")>-1&&(n=!0):t="name",e=e.sort((function(e,o){if(n){var r=s(e,t),a=s(o,t);return"asc"==i?r.localeCompare(a):a.localeCompare(r)}return"asc"==i?e[t].localeCompare(o[t]):o[t].localeCompare(e[t])})),o(e,t,n)};var n=function(e,t){return function(i,n){var o,r;t?(o=s(i,e),r=s(n,e)):(o=i[e],r=n[e]);var a,l,h=1,d=0,c=0,u=String.alphabet;function p(e,t,i){if(i){for(a=t;(i=p(e,a))<76&&i>65;)++a;return+e.slice(t-1,a)}return(i=u&&u.indexOf(e.charAt(t)))>-1?i+76:(i=e.charCodeAt(t)||0)<45||i>127?i:i<46?65:i<48?i-1:i<58?i+18:i<65?i-11:i<91?i+11:i<97?i-37:i<123?i+5:i-63}if((o+="")!=(r+=""))for(;h;)if(l=p(o,d++),h=p(r,c++),l<76&&h<76&&l>66&&h>66&&(l=p(o,d,d),h=p(r,c,d=a),c=a),l!=h)return l<h?-1:1;return 0}},o=function(e,t,i){let n=[],o=[],r=[],a=[];return e.map((function(e,l){var h;h=i?s(e,t):e[t],/^[a-zA-Z]*$/.test(h.slice(0,1))?n.push(e):/^[\u4e00-\u9fa5]*$/.test(h.slice(0,1))?o.push(e):/^\d+(\.\d+)?$/.test(h.slice(0,1))?r.push(e):a.push(e)})),a.concat(r,n,o)},s=function(e,t){var i=t.split("."),n=e;return i.map((function(e,t){n=n[e]})),n};e.getIsDesktop=function(){if("Mobile"===t)return!1;if("Web"===t)return!0;var e=navigator.userAgent,i=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||i,o=/(?:Android)/.test(e),s=/(?:Firefox)/.test(e),r=(/(?:Chrome|CriOS)/.test(e),/(?:iPad|PlayBook)/.test(e)||o&&!/(?:Mobile)/.test(e)||s&&/(?:Tablet)/.test(e)),a=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1;return!(/(?:iPhone)/.test(e)&&!r||o||n||r||a)},e.getIsMac=()=>/macintosh|mac os x/i.test(navigator.userAgent),e.getIsChrome=()=>/(?:Chrome|CriOS)/.test(navigator.userAgent),e.setNavigatorType=function(e){t=e},e.getIsIphone=function(){var e=navigator.userAgent;return/(?:iPhone)/.test(e)},e.getIsTablet=function(){var e=navigator.userAgent,t=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),n=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1;return/(?:iPad|PlayBook)/.test(e)||t&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e)||n},e.getDeviceType=function(){var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),o=/(?:Firefox)/.test(e),s=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||o&&/(?:Tablet)/.test(e),r=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1,a=/(?:iPhone)/.test(e)&&!s;return s||r?"PAD":a||n||i?"MOBILE":"PC"},e.getBrowserType=function(){var e=navigator.userAgent,t="";return e.indexOf("Opera")>-1||e.indexOf("OPR")>-1?t="Opera":e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1||window.ActiveXObject||"ActiveXObject"in window?t="IE":e.indexOf("Edge")>-1?t="Edge":e.indexOf("Firefox")>-1?t="Firefox":e.indexOf("Safari")>-1&&-1==e.indexOf("Chrome")?t="Safari":e.indexOf("Safari")>-1&&e.indexOf("Chrome")>-1&&(t="Chrome"),t},e.getBrowserVersion=function(){var e,t={},i=navigator.userAgent.toLowerCase();return(e=i.match(/rv:([\d.]+)\) like gecko/))||(e=i.match(/msie ([\d\.]+)/))?t.ie=e[1]:(e=i.match(/edge\/([\d\.]+)/))?t.edge=e[1]:(e=i.match(/firefox\/([\d\.]+)/))?t.firefox=e[1]:(e=i.match(/(?:opera|opr).([\d\.]+)/))?t.opera=e[1]:(e=i.match(/chrome\/([\d\.]+)/))?t.chrome=e[1]:(e=i.match(/version\/([\d\.]+).*safari/))&&(t.safari=e[1]),t.ie?t.ie:t.edge?t.edge:t.firefox?t.firefox:t.chrome?t.chrome:t.opera?t.opera:t.safari?t.safari:"Unkonwn"},e.formatTime=(e="",t=(new Date).getTime())=>{let i,n,o;e=e||"YYYY-mm-dd HH:MM:SS",n=10==t.toString().length?new Date(1e3*parseInt(t)):new Date(parseInt(t));const s={Y:n.getFullYear().toString(),m:(n.getMonth()+1).toString(),d:n.getDate().toString(),H:n.getHours().toString(),M:n.getMinutes().toString(),S:n.getSeconds().toString()};for(var r in s)i=new RegExp("("+r+"+)").exec(e),i&&(o=1==i[1].length?s[r]:s[r].padStart(i[1].length,"0"),e=e.replace(i[1],o));return e},e.getDesktopType=function(){var e=navigator.userAgent.toLowerCase(),t="",i="";return e.indexOf("win")>-1?(t="Windows",e.indexOf("windows nt 5.0")>-1?t="Windows 2000":e.indexOf("windows nt 5.1")>-1||e.indexOf("windows nt 5.2")>-1?t="Windows XP":e.indexOf("windows nt 6.0")>-1?t="Windows Vista":e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?t="Windows 7":e.indexOf("windows nt 6.2")>-1||e.indexOf("windows 8")>-1?t="Windows 8":e.indexOf("windows nt 6.3")>-1?t="Windows 8.1":(e.indexOf("windows nt 6.2")>-1||e.indexOf("windows nt 10.0")>-1)&&(t="Windows 10"),e.indexOf("win64")>-1?i="win64":e.indexOf("win32")>-1&&(i="win32")):e.indexOf("mac")>-1?t="Mac":e.indexOf("x11")>-1||e.indexOf("unix")>-1||e.indexOf("sunname")>-1||e.indexOf("bsd")>-1?t="Unix":e.indexOf("linux")>-1&&(t="Linux"),{name:t,type:i}},e.getIsIE=function(){return!(!window.ActiveXObject&&!("ActiveXObject"in window))},e.formatURL=function(e){var t=function(e){return e.replace("viewToken.json","").replace(/\.\//g,"/").replace(/\/\//g,"/")};if(e.indexOf("://")>-1){var i=e.split("://");e=i[0]+"://"+t(i[1])}else e="//"===e.slice(0,2)?"//"+t(e.slice(2)):"./"!=e.slice(0,2)?t(e):"."+t(e.slice(1));return e},e.sortByName=i,e.sortByRules=function(e,t,i){i=i||"asc";var s=!1;return t?t.indexOf(".")>-1&&(s=!0):t="name",e=e.sort(n(t,s)),o(e,t,s)},e.PointToLineDistance=function(e,t,i,n,o,s){let r,a,l,h,d=0;const c=Math.sqrt((i-e)*(i-e)+(n-t)*(n-t));if(0===c)return[0,{x:i,y:n}];const u=Math.sqrt((o-e)*(o-e)+(s-t)*(s-t));if(0===u)return[0,{x:o,y:s}];const p=Math.sqrt((i-o)*(i-o)+(n-s)*(n-s));if(0===p)return d=c,[d,{x:i,y:n}];if(c<u){if(n===s?r=i<o?0:Math.PI:(h=(o-i)/p,h-1>1e-5&&(h=1),r=Math.acos(h),n>s&&(r=2*Math.PI-r)),h=(e-i)/c,h-1>1e-5&&(h=1),a=Math.acos(h),n>t&&(a=2*Math.PI-a),l=a-r,l<0&&(l=-l),l>Math.PI&&(l=2*Math.PI-l),l>Math.PI/2)return[c,{x:i,y:n}];if(i===o)return[u*Math.sin(l),{x:i,y:t}];if(n===s)return[u*Math.sin(l),{x:e,y:n}];let d=0,g=0;const m=(s-n)/o-i,f=-1/m,w=t-e*f;return d=(s-o*m-w)/(f-m),g=f*d+w,[c*Math.sin(l),{x:d,y:g}]}if(n===s?r=i<o?Math.PI:0:(h=(i-o)/p,h-1>1e-5&&(h=1),r=Math.acos(h),s>n&&(r=2*Math.PI-r)),h=(e-o)/u,h-1>1e-5&&(h=1),a=Math.acos(h),s>t&&(a=2*Math.PI-a),l=a-r,l<0&&(l=-l),l>Math.PI&&(l=2*Math.PI-l),l>Math.PI/2)return[u,{x:o,y:s}];if(i===o)return[u*Math.sin(l),{x:i,y:t}];if(n===s)return[u*Math.sin(l),{x:e,y:n}];let g=0,m=0;const f=(s-n)/o-i,w=-1/f,v=t-e*w;return g=(s-o*f-v)/(w-f),m=w*g+v,[u*Math.sin(l),{x:g,y:m}]},e.isWebGLAvailable=function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},e.isWebGL2Available=function(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}},e.sortByGroupName=function(e,t,n,o){let s=((e,t)=>e.reduce(((e,i)=>({...e,[i[t]]:[...e[i[t]]||[],i]})),{}))(e,t),r=[];for(let e in s)r=[...r,...i(s[e],n,o)];return r}}();var Cursor={pan:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABjRJREFUWAnFlstvU1cQxu/1fcR2HMd52DV5kVABUZ4tkIqIx6KRKBKbCqJukKjURbtghSr4S1gg0U2zQqjbthISYkElVCoEIZAQkiYpCXm/4zh+u7+xcoxDbCe0UjvS6B7fO2fmOzPfzLGm/c+i/4v4uXvT/9RPrpNiPpSdY9tIfovKbwmeylGW+xfluNgOsTFQEy1B1R55JyoSQyNoElWA5LlnZpQzbHeJ+iZBJHAZWurz+by2bSfD4XDK7/d/YllWgPWTqampYb7HUQEhgERVZljmFzlVPlHB5buNusvKysrr6uouezyer3UklUrFq6qq3IZhOBYXF58C5Ifl5eUxPqVXV1cX2bOGhtGimVApxG6HCAAJ7kQ9LpfLGQgEWg8ePHj+2rVrrZcuXXItLCykL1686Llx44YvFovVjo2NnaysrLxcXV39LeqLx+PDW1tbm+xXZWG5W4plwMLcS+DGAwcOfEPaewmUxrHW1dXlGR4ettfX1/XS0lK9ubk51tTU5Ozt7fU2NjYat2/f/hzbUTLShw9Virx8yJcBOb2w24WWE7znzJkzX1y/fj1ACSycagQ00un01uvXr9fcbrfe2trqXllZMQFjnjt3zkVJyvr7+xcTicQQ/FjFT8EsqLbCZpcIEAlkojplSJ89e1bDafjx48fh48ePl0HIyhcvXlhwwWhoaNCmp6ejb9++TbS3tyf53klJTuJDyigHVbxi+U4KZUAspDyukpISN+lsOnz48McAcFFrg/o72traTE4XHhkZCQHEcejQIWtoaChO3TXs3PPz85XPnj2bZ+8A79bxJR2xqwz5AGCXQSuI7Wg0Gie19cFgsAUQFt2QJNAGWUmfOHFCuGDCBcfp06ftN2/epMmCduTIEclchNbUKNkc+ie+pEUFxA4pBEAZGbSbTRYkSFVtbW2NnG50dNSizuaxY8eMpaWlyPj4+BYzwQSk/vLlyzCg06dOnfKQhcDAwMBcJBJ5yjtpyV1ZKARA1SuTBRxE6ILG+vr6jpaWFpPej7569WrdNE2ts7PTRUa0jY0NHXBO6Yry8nIDW3NtbS08MTERB/wMJJ0AgOoIdcDsKM2+YKGCqyHkJAslkNCi5BU1NTV+0u2h9hanN7q7u03mgwMSGl6v10EWLDTT3pDTJlPBwcHBWUA8gcBR/EtHZCVfBgSAOHCj3m21IdMqJ68j0KcdHR0G7ZkisF5RUZEJLMGx3SFOp1OHsFF4EmZ+TJOFKQwSaJYL7wOQ4OJIWqeCIdQCu78jnd9zmnaItQSjY2Shivq7JTijF9PCQocIT4JkbGZubu4JlpKFogAEVClaSeDenp6er65evVrNpPsIVjfMzs7WcPpysqAz/zErLtwdDpkNz58/n8dyFF7IU7KQacl8GZB3mSlIBj5jCnZduHChRGbA0aNHTUhlAiRGKRIAlItqT4GgMVo0DJARWnKUDdKSBQEoDrioYenMzEyAU/hhv0XNbSacRurj2223dwqIFAqFUnTKJu3bDykHtwFkypBhKy9yRT5Iu2xMTk7+To2dt27dsql925UrV5yc3BbN3bDXWuYCJIzBoezJ1Z73S6DeS3oESJqaLfCcg0R+xoFfLiJasjjzlJftJyM58uDBgyFK95D/CuO8FiLmLYHaqgBkyEINl0E/wz1QRTqDcEEXcinjYk9mh3b//n0H+hst+QuZXMa+IAlzfeWCSBF4NZlMUpVJH/1cS3sKFwplMOvn3r17oTt37gzRgr+SgT/4ICM5O4z2ciAgxFgQy//AENNsnAvHA5BaukBXU4/vO4SMaY8ePQr39fVtMrZ/JvhdhtkKRjsupb0AiFMFQoAkSWF4c3NzhFrq1LYGcunyR0X+mIixCExPS+CbN2+uwZ2fCP4jo3iaT1uoHCYr2U3ZN/kXYic1F/bLv2MfF5Hcjt1Mui8J3ow6uIgSZMkiWArm9/O8S+8/5ORC5BC66zLaLwD2vvuPwFoGlQCRu8LNPVANKYNMRjcl2qBz/oIzKqj8GZG6Z8rIc4d8CADZKPaiUjoZQnJniMpazRQplbSZUjm1vMvOf9ZZ+VAAslHtkaeURcCIym9RFUw9hUOieUU5y/txHy9z9+euiwbdh9//zuRvyW3yFM73IK0AAAAASUVORK5CYII=",orbit:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAB55JREFUWAntlltM1PkVx2eG28ww3EdA5CKgSBXEKO6Klxq3dsFbDTZa120Tre1ufdjY1sRoNqm1aaPxYetjEy/RxLrbpGiiVWQbUPfBW8CqRHe1UapVizCIIMMwwMz0852d34RycdOnvvSXnPld/7/zPed8z/mNxfI/btb/Qr/OjhbzeYjBaDF7b+y/CcBIhTHcNFJszM33QcYBZDjSazwSENPxm7lgvF3tSYmUxiHxiB1JiIxj6bUvRVI8iAwg/ogM0QuIwOnMuG0iALpYIiVSmoi4CgsLv52YmPhOfHx8ZUxMTGYoFEq0Wq2DwWCw3e/33+7v7//86dOnFwcHB19zvh8RIAERCMmYNh4AY7msdiIpRUVFNampqb9IS0vLqKmpCVRXV2fk5ubakpOTLT6fz/LkyZPQ+fPnXzU0NIRe0l69evXJo0ePPufbXsSLyDvjgpgIgNzuSElJmVRQUPA7FK3Ys2dP/Jw5cxzHjh3zXL58OeTxeBKHh4cT4uLifADzLV++3Lpp0yZ3S0uLd//+/UPd3d0NDx48+A3e8HBXXwSE4QbTr9tIABobkeuds2fP3mO323926tSphMOHD3vOnTvnwOK/9vX1Xezt7f2KcY/D4UgDYInL5VrG+LsrVqzwbd++3b1t27ZOADy4d+/eB4Do5D4DYkJOmJiLZC4kIyEhoRgQdZWVlYP0lzIyMr7D+gwkH8lBsiO95jPS09Ory8vLL61atcrT2dkZ2rBhQ0dZWdln7BUjaYiILD1jmhZNzNPz8vLKmE9GpiBTp02b9j59ISKlbkSXpY4QzbWeh5TNnDnzjwLR1dUVWrJkSTcc2sa67hKZFd5o00RuFwChc+Xk5JRkZ2efY9yIq3voffDqPr1YLTIppQTWpKTCpaZUFOOHsb6F0FX29PS4Nm7caL969WoZYOoCgYBSVOcUhnATAGO90KWB9iCuLiC9Sl+8eNHAmlJJIgLpvAtXT83Pz38PoGsYl5KOHvjgYy8MgN4CQb9C6fs7duxIrK+vt6C8DWI+ipzRXWpWXSiRNSnFxcXrsrKyNpw5cybl9OnTqeT6Cz76O3u6WEBd7H+rpKTkL4sXL160evXq+awtGBoa+pBaUO/1epV2utwKniDZUUiWuDHKdvfu3Tg88wV78qIBwPBr5Zkw+S3I5rly5coAFoXUa87625yZguRgbdW8efNCR48e1ZFo03zhwoW9KFzEuVxEpKzAS7tXrlzZifLg3Llz/8Ga7hKXxBkZHaP4hasd+f5zFAaqqqqUBRb18+fP76HCbW9tbf01S8FJkyatgtX+LVu2hM/onBpzy82bN2OoDSvx2LHS0tIavDcbhFnwxwkQq81my2H9o9jY2D7WWwD1KZ8G5FYbLiqnvP4gKSnJtm/fvm5deuDAgW5y26Z1wJWzFMelOQsWLBABx7RZs2bZuVyZE4v7n0PCH5MJVbW1tX7usaxbt65vzZo11aT2T7XPOekO/wQpIJOx9NDZs2cbKDou2G+BAwkUnqsDAwNHtc9ZeDX8L5CLyWPatWvXhrTPxtDjx49bKT5/ev36dXDnzp1yt2X37t1pmmudMt3KkjIh/EgpFjqk2LxNrNoUM9B3KoasVSCKaa5irFiPxwFxQxzhnGrFFHFnAk69xX4mIr02ZYCaQWPjknJevCwywgIQC8xtYl+vmx9vePFU0/37938ESf3t7e2248ePD+CpAaxeDQceck6PzxDnAnjuZXNzc9X69evtW7du7SOt9/HNjch9yoagipApREKUCh++h/z2xIkTacSs/+HDh9+HSF9GPqKzOAGZJ0IS82zy+3lHR0c9Z/7JnpTrYt0ZrisVFRV/4Ow8Fafbt29/wPpLRO+CUjtoPMA43GzkcidkrIWxdizwPXv2bAYKGtlVBZMMQqIeisxN5TVWNzPXi6diJU/qTmWWSBaC/X+jFtRi/YdwQBxRRZXycPxHA7BikU2uu3PnzrKDBw+mNzU1JXHBZFkQ+UhKVEh0iaw1l0mpA0ni7XgHj7QzDkDoLjz1ZwxpY26Um5D/x8Mgt6lZyeXnkKjgxo0b2YcOHXLz/ueotqu8Yq2UyjqBl+gNkeJkSvi06dOnfwKHPnK73VP5Y3IRg7w83V3sy0PmHRCAcBvtAS3KNSE+bsZ9i65fv+44cuSIWw8Lbv8h8S9yOp129mRxAkDzKc9L+If0k8zMzI/Xrl2bRg1JqqurK+JfVAyuv8Q5pa6Uh++mjzZjtVnQ3Fjlogi5qfu/Iv2qd+3aFUeqOU+ePNnV2Niov14O3gAH7vVjrXfp0qXWzZs3u2/duuXbu3fvIFbXkxkfA1x/RnyIwhaOO320jQagjXB1pJdrxeRksuJdrPkl1qfzf9BKfU9VeYUrFhRZ+CMa5P9g14ULF2IIXxfe+z3F5gLf6jkfE3fWom08ANo0IMy778QbSbh5Ge5/l3JaQQiyqenxPNte4txBhWsmg5ra2tq+4HulmVJy3LizHm0TAdAB7RmyCYgeIInqhbwjDuiMCBVOT3rFWkpNdsjtUcYzHtPeBECHtW/EsF6KNRY4NcVVSqRspBjCjYk756LtmwBEDzIwQEb2Zn+kMjM2e//v3+iBfwN/OI2ZyYaa1QAAAABJRU5ErkJggg==",measure:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAbCAYAAAH3zbSEAAAAAXNSR0IArs4c6QAAAn5JREFUSA29lr9uGkEQxu8A47MTKSf5j2RbjnDhAAUVVKbhBeiiNHmLPIxbt64i+QF4A3iBpEiUIkWUCEVBcSz/uXy/1S1aH3fxcoKM9LG7szv77c7MzhEEQRAKFWEutXkvCKoMqkmS3Foly+vCa6ugjdwBm907imoo+8QqwjCMavp5axVqzWTUarWuNKg6E/MurJvCS2F+lHR2Q+0XFkSiuU6VjxrRbaHg3OyyIJVut3sj7cHCjBTWOZ+zkzJKrLMa2UnGISvyJtAZy/F4vDDf6/VMUAaaOVyYDYKv6OpsPZ1Ok06nc6Hxs5yFharNfr9/qdmGkOvuIksTBjH/KVpQpJ9MJhF+fCha8ITe2EXcOU/+pdfGhrmQIC8E7mLuDEgzmwrufFGfI99iiIcJNv27FGqeliPuOhwOyekTwZu9KSPSeSAslRg8r7NljbhXLNBOBR/ZZhFOiRW7Tz4Wdo0y6QSmhrArfBd8xKzFcE+M33ws7Box7mN4qmh8sEqfVmXnFTHzjpuzaaWMkbEvbUg4ZjrzG7Uku49Qi2c4x01yH0PK4p013FJIfmWt4jg+H41G76SHpWzlyG5rxnwETqkaVFAeS7vdfi8duX8k8D0r7UfZ5gqbGtKUbKBxQ+CFLlWFtd5LcC+BfCHwQCkJPFDqifuB1rC0wAHwFiFK6KCoyb0fUQgIB8EDqwAeO9D+5MWesEHqQmyLXUv9mUC5XZXA8TzdjPYnt+QfxU6K3yiFVZMSPurljxSG9JjsdWUdYxEeC3VcC0zVVrtugQc+kyzN7M3cW6+iz/7iasJnWGH+n0JmcQJT4vj3t2Yx75Tsperwx9hm2DpuD5l9Gdd/AVIlXMI9fgkPAAAAAElFTkSuQmCC",section:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABBpJREFUWAntVUtLG1EUniRjEo2amKjVxBiFqlAXRUVFEBFKF6KLgii47kIKXVX36rra0lXRnd1IFftYqFAoBFyJ2AdUixqoMU18a3ylSZwk/b6pCRmfP6AZuJlz7znfd8797rkTQUg9KQVSCqQUSClwgwKxWEzV0NBgrq6u/tbf36/m/IZw2cUYxhJD7G0Y9XWEJGlsbKw5Ozv7qlKp7h8eHuoGBgZuLYAxjCWGWHKQ67o8VxISMDMz8yASiUyUlZUZV1ZWhNra2jvRaPTAarVGpqamHsF+AVLHObFbrVY/a21t/eDz+TSwc+bn57fKy8uF1dXVQ41G09HS0vIZvNGLhVyqjMmR4LEkSZ/a2tqMw8PDMgZzQzgc1kxPT7cj+WRzc7ODPg7aXKOPMYwliD5ykIucVymhKKCjo4MJXoFspKurS+jr6xOysrLkAtLS0rSwtfANIaEwODgo1NTUyIM21+hjDGMJIpYc5CInuZlDJjz/kQtgo9TV1VnW1tZGIftTVCr09PQkxwk4U7Xb7S5ErJ2EFx+u0RcKhQyMTfaTi5zkZg7mijenHNjZ2aluamoK4ux0ycBkGzvQYGeyHNzZdQ+SZzL2Oj9zMBdzMkb+qaysVB0dHaVXVVU9B/l7Vjs0NKTg4K4sFksIBDsjIyMKHydjY2MCfUjOY1I0N7nISW7mYC7mJE4hFSSKVVRUvMvPz39LQlwp4fj4mHGJJzc3943T6RR6e3uFhYUFgTeENtfgG00EwiCWHOQiJ7mZIzlGPJ/wegS0Wu02Agx2u33GYDD40LlPlpeX9YzBmUUxwkVFRU7s1DQ7O9uOpCb6cM38BQUFkzabzQmlwhjyUXZ3dwsulytYWlr62mw2f8f6b+bA9yEAmHwlE1KxOx0Ohx7yWJDADhkdfr+/en19vQsAa319/T1cJz9IbPDdxTsfI50FoLA/GNvAufD2iqJompubW0LP+IqLi8dMJtMX+NzAebKzs/fQzMGJiYkIsYlmWVpaimEHUcgYCgQCQZBIOp3uBIAf+/v7FbA/Go3GDRTBZpWADeN9iiL8SLoF28PkiDvd3d214mv4EB+ilzj3n/D9wvdhHfaex+MJxZOzgIQCnPBBs6hxVbR6vT4bUxtIefUkyOzC2sbBwUEMdgZGJpLLUsMfwtGdYARycnJUwWCwEDZVEjE2wOPF2lFJSUkY/Iqv4aUC4kXgLe7s7GShcgtsqJm2h/k+uldaXFwkToNzl/Gbm5tsrAh8MfjEvLw8M46NuDOc+R7m7GTpYnKsXVaAi3ywKxWaCCch6kAi4ljC2L1Cvn+Ryl/2ElTQZWRkaFE8TkwK4ZMsQQlF98dRimsYX+SbAAJxfQJer/cYf0LB8fFxhXzJ8XGbMYwlhtibkscxqXdKgf9bgb8e4D98kWiZrgAAAABJRU5ErkJggg==",rotate:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABUhJREFUWAntVmssZGcY/s6YGYPBYC3WfRsqS2tTiawUcUuUSFRdE3GtS2ormuxqJEK1iR9t0jaSjVtRIUII5U9VdhsjVSl1DSK2a+LaDcZl3OZiZk6fz8ZkzVKxPzZp6kuO855z3u99nu95L4OQ63WtwLUC/3cFmNcRIDMz03Rra0skEAiER0dHips3b8rq6up2GIZhrxrvUgIsy3KioqLeR/APARimUChcNRoNTIHa0NBQe3x8zCiVSgO1Ws2YmJisarXaYfh0ubq6/lJZWXlwGaELCZSVlXFHR0fvczicInNzc7PAwECBj48Px9nZmQCYQAGyvb1NhEIhsbKyInw+n6yurpLZ2Vl2YGBAvrCwwPB4vEYjI6MvW1tb1y8ici6B6OjoOzhxN8CcsrKyDHEqIhaLWRBiKKiBgQExNjYmUIHFycnh4SEjl8uJqakp8fT0ZAMCAhh3d3fS1dWlefLkiRyHyOru7m4/L0WvEEhMTPRCXoeys7OFLi4uTEVFBQVg7ezsjmxsbGQikUiFQMc4kQx3KrEAlzlSZQQ/7vr6unBzc9Nsd3eXk5aWRtzc3EhxcTHdc7+zs7Nen8QZAjU1NbzHjx9PJycnvw1H0tzcTLy8vKT29vbzAOjFyf/AXQK5VVBFg2ct8s/A5oAED8+2qA8f7P1AJpO9NzMzc8vJyYmTnp5OCgoKlI6Ojneqqqok8NUtrs6CMT4+7ge53vL29iYPHz5kkfdZSP0Nl8sVA3gXEivj4+OP9U9xGqO/v//vlZWVWZDqsrCw8PLz8/tseHg4fGxsjBcSEsIfGhr6tL29vTAhIUFzukdHAJu5TU1N9yA7B8yJtbX1HgroE+R5IiUl5egi0NNA9B4cHKzGjV6HANpBGlZsbW2tRkZG7gUFBTGTk5OB6BCaskNcJ4tKd7JQRAaQ6HBpaYnx8PAgGxsbgsXFRem/gUNaUWRk5HdQ50wqaUCcUgXya8vLy3ykkSAuLVo1UsR7gfjir44ATqtB1Y/jpGq0EImJieHPzc39FhsbG3QeAN67geQo/JMaGhqELweldlJS0q2enh6aCu/Q0FCmr6+PxWwQY1ZQhXRLR4DKh7V49+7dP6urqwmKh3nw4MEN5P9ngI2iNSMpEXrBDkOeJ8LDw28joAj9bkQj5ufnm2FoJcfFxfXu7+8v4HtYYWEht6ioiHbDhqWl5U9IrUKHDuOMdMgbH3kLRK8/Qs+7gwyDjiD19fWap0+ftkdERGSinz/Gvm9LSkoM6QDKy8tjUagSTEQrlUolxCnVyLcAs4BgIJG2tjaCmSAFga9B/ofc3FzZhQToB7SiMWQNQLAvnj179g7qQAibBZnK+fn55wcHB1+hlTgAIrDJ1NQULViCaUnoUKLpGxwcJKh+ggJUA3gJs+MRWrQlIyNDql/MZxSgBKjEvb29/LW1tduwY1E0CSBhgUD5GFDWExMT30N2k/LycoJnUlpaSjB4TsjQsQyZtbgOHBwctqGMGG39I2JM5eTk7OmDU7xXCNCXdAGc09LSQn/tbPHoiUADeGcOu2x6evojgAoxLQl+cFhfX99NFDH9cdqBz1/w6Yf/7xhQS7BlkJ1OznPXhQROvSmRxsZGPlpO2dHRwdnZ2bFH8ByJRJID+a0BrESxxaFYJZBZhj5X4p0cLad4eeCcxtO/X0pAfwMlhBF9A3MjRiqVfg41RCjOd1NTU59DYq2+/2XPukl4mePpdwoCEpu1tbVt+Edkxd/fPxwdIH8dcBrzygToJlpMWHso1l9RrGNmZmZnWov6vLEFIldO4xsjdw30n1DgH4y0hp8mM/gUAAAAAElFTkSuQmCC",translate:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABLxJREFUWAntVllIZEcUvd1jOxrbNW7jihoRxQWhjaKixiUS42DEBZn8iCGifghxIWAQhsjgR0JIPiL4pRkTFDU/CsK4oOJCUHFBUVEEcUSNg6Ktjt3a7cupgtdp5fXrkTDkx4LuV6+We86799xbRfTQHjzwP3tAcR/8oqIij/Pz8xfY461Wq+svLy81RqPxCfq/9fT0vLmPLXGtUuxYe1ZVValPT0836urqvi4sLHx6cnKyEBQU9HtmZuYPZ2dnf7W1tdlZsyE1b9UDgiAo8vPz47C5VK/XV/b19XE7JSUl1NjYSDExMVRTU0MHBwcVIPgYk64RERE/ol1IAd4ds+qB4uLiGGyazMvLq3RwcKCZmRmysbGhtLQ0WllZ4faysrLo6Ojo19jY2F/S09Ofr66u9nR3dz+6Cyb1LktgdHTUxtbW9llSUpKqtLSUysrKaGhoyAQq9lNSUugRWkVFBdXW1pK/v/9nS0tLPlKAd8dkCWxsbNgGBgbqxC9lQAsLCwQhUlhYGCkUClpbWyPmmcTERAKoidzOzk4hwidrny22tuA6ODh4XKvVGkQgjUZD4+PjHAgCpOHhYROo2EcYCCL9tqOjw55PyvzJEigvLzeoVKp1X1/f16Jxc1DWZ2QMBgMxYru7u7S/v0+urq4UGRnptbi4+JEMNp+SJQAXCzCuBYHesbExDhQXF2cC8vLyooCAAC5MSIALc2RkhBtm5EColOlIjoQsAbYRIbh0c3P7E57QswxgQKmpqSQCsQyYnp7mGNnZ2TQ/P8/7TBPX19eV0JEDH7DwJ5kqLPchqE8hwJdTU1NPUe0mXVxcPt7b23vCwJ2dnQmVj3JzcykkJITXAmQLgShlZGSQUqnkqQoh2kA7r+bm5rYt4EsPI4ft8TVabBT6+/uFnJycNw0NDT8D8AZVD/wE4fj4mD/l/iYmJoSCgoKXra2tKmkkC1mAiucCl9v7+fnxr0TFc0cqfoWvNIgZwIRmrYWHh5NOp/scaWoxGyQ1AOEJUPVmfX09F1xCQgI1NTWpMa4Ss8EaOJt3cnKim5sbR/wsnhOSBLD3xMfH5zkq2t+szq+vr1N0dDShvrOaTzgF3wWfLi4uuBawXlJrzIgkAZRdPWL7Cqfdd1FRUbuIP0+10NBQ6uzsJHt7ix69RWxra4twVL9F6IRbE2YvkgRY/qMIaeG6Xm9v79r4+PjN5uZmQaz9Zvtlu4ODg+Tp6bmJrLi2tFCSAFsskkD6Dbi7u1cnJycvtbS0CF1dXZZs3RpHBtHs7KwRafoHbOluTZq9vNN9ADlvh7Neg1i+mJycxOGYpGQnH8t9qXZ4eMhPRWTBLLT0JUK6BRI3UmstekBczDyBO8ElyvEMYv8N7gEDy8vLV9XV1bwCokiJS+nq6ooGBgaIzaFE73t4eHyPydeWwNlGqx4wWUeHFRRcRoKRjlU4dJ5BZG4oTEoA8WXsIIJQdXD7NrzzE4TczbTEPsLcjnn/XgTYRnbTQXH5EMXqEwB8AaEmIDQfgJjRzs7uAEt6AdiHGrCNS+yFHDizd28CbBOAFe3t7Y/hcjUU7oifE7yiBwktps8cHR3fImz/xoZtel+NkWFewdOqnt4Xhwe7/8kD/wDeTzMCbKkf6QAAAABJRU5ErkJggg==",zoom:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAA6pJREFUWAntVltIk2EY/rZ/bO7gNCx1aswrYzSGkKAYIUE3mg6TlPBwIcEoJnRVkCFOJAblTeAo5lUIEi5spLCbBCUSBIOh1KAbldIxSZdzOZ079L6jf/yb23/q0n7Yvu89Ps/3fkdC/n9nvQLUvxSgp6enqqKiwt3Q0DC/trYWEpNLKiYIY/r7+y/s7e3NG43G69iiLCaXKAI2m00TCAQ8bW1tNWNjYwRblFEvhoSgGACRt7S0zNvt9iTzQxn1aBeUUIgzAEpbW1tdg4ODyVgsxsRPyahHO/rxzSvh64hJodSOo6Oje3TMxMQEqa6uJuvr68RisdBqUlBQ8Gp2dtYqkUgSaWWejiyP/pTa5XKpzGbzVzB4gUzZzMyMrry8POWn0+kIRVGko6PDD6ABUH5Ff2jDKQeWP96l6uzsPFSpVK8B6ObW1tZdrVaLI02lxhZl1KMd/dCfBTdt4k0Ay9nb2xsqLCwM+P3+Mhw180MZ9WhHPz7lx3jeBBhgVDweN+YigHrwE3S4CSYQDAZlJycnNbkIoB7tDLKcXcEE1Go1EtDnIaBHOycqw0EwAZhbKhqNlsEdwEhDCBJCPdozDByCYALHx8cy+BVnVwAJoR7tHJgZZsEEYKtpEomEoqSkJCMRyqhHe4aBQxBEAA4gCWy1S9mjpzFQj3b0o3VcrSACCwsLFJTYxEYA7ejHBUzbWZniSOByeQBJn0NAem7b29uJ1Wqlc6Rbh8NB3G53WoZOTKFQPJybm3sBizPJNNB9VgLT09PK/f19M8zrk5WVlctw4eCFRMfmbeEiIk6nM1FXV/elsrLyaVFR0fuurq5IrgBWAliBqamp4nA4fOPg4MC2tLRkaGpqkgwMDBCp9PTswSIk4+PjZHFxMdnY2OiDY9mm0Wg+dHd3/xJVAWSMJCYnJ1Wwx6/AVWxbXl6+VlpaKhseHiYAkB4UECQjIyNkZ2cnVl9f/xEuKJtcLv/c19d3mA8cg1krkM4OHZgOeSgUqoHz/tHq6upt6CtHR0eJXq8nm5ubZGhoCG/EiMlkegs34jPof4OyR5k5cvV5E8BgIEEBcBWQsGxsbNz3+Xzn4A1A4G1ADAZDEB4nLwHcCeA/ADyeCzBbJ4gABsOUSGFKzkcikVu7u7uPvV7vxdra2u9wENmVSuU7KPlPKDnnS4gmIpjAXxISWOVaWIhXgdAdAHwDC/AT7BJ8B+TcbjRgdiuKAE3C4/HIt7e31XAP/G5ubo4KBc8mczblP8eTrmVjlSb0AAAAAElFTkSuQmCC",add:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjFweCIgaGVpZ2h0PSIyMXB4IiB2aWV3Qm94PSIwIDAgMjEgMjEiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+5b2i54q257uT5ZCIPC90aXRsZT4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xMSw1IEwxMSwxMCBMMTYsMTAgTDE2LDExIEwxMSwxMSBMMTEsMTYgTDEwLDE2IEwxMCwxMSBMNSwxMSBMNSwxMCBMMTAsMTAgTDEwLDUgTDExLDUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTYzLjYlIiB5PSItNjMuNiUiIHdpZHRoPSIyMjcuMyUiIGhlaWdodD0iMjI3LjMlIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJmaWx0ZXItMiI+CiAgICAgICAgICAgIDxmZU1vcnBob2xvZ3kgcmFkaXVzPSIxIiBvcGVyYXRvcj0iZGlsYXRlIiBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93U3ByZWFkT3V0ZXIxIj48L2ZlTW9ycGhvbG9neT4KICAgICAgICAgICAgPGZlT2Zmc2V0IGR4PSIwIiBkeT0iMCIgaW49InNoYWRvd1NwcmVhZE91dGVyMSIgcmVzdWx0PSJzaGFkb3dPZmZzZXRPdXRlcjEiPjwvZmVPZmZzZXQ+CiAgICAgICAgICAgIDxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUdhdXNzaWFuQmx1cj4KICAgICAgICAgICAgPGZlQ29tcG9zaXRlIGluPSJzaGFkb3dCbHVyT3V0ZXIxIiBpbjI9IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0ib3V0IiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVDb21wb3NpdGU+CiAgICAgICAgICAgIDxmZUNvbG9yTWF0cml4IHZhbHVlcz0iMCAwIDAgMCAwICAgMCAwIDAgMCAwICAgMCAwIDAgMCAwICAwIDAgMCAwLjUgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9IuWFtuS7luWKn+iDvSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCI+CiAgICAgICAgICAgIDx1c2UgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMSIgZmlsdGVyPSJ1cmwoI2ZpbHRlci0yKSIgeGxpbms6aHJlZj0iI3BhdGgtMSI+PC91c2U+CiAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMTEuNSw0LjUgTDExLjUsOS41IEwxNi41LDkuNSBMMTYuNSwxMS41IEwxMS41LDExLjUgTDExLjUsMTYuNSBMOS41LDE2LjUgTDkuNSwxMS41IEw0LjUsMTEuNSBMNC41LDkuNSBMOS41LDkuNSBMOS41LDQuNSBMMTEuNSw0LjUgWiIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",occlusion:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAbCAYAAAH3zbSEAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAHaADAAQAAAABAAAAGwAAAABRO+PxAAADA0lEQVRIDbWWzW5SQRTHuQUpYhNbPwpipLcYaNPEBFrcdGP6AG7rW/AMvoE7l76AMXHhyoUvUEi61hhxVRottYmmfhb/v8kMXO7l41LtSQ5zvs/MmXOGm0iMgEsB2cOUGK8ncEIjqNfrjh+9LlhxVuvckL/nefOpkL+H9fzu7i5ZMjAWlm3mFBYoqsLfVukWdrRvDGR96qTBVTkvB/kovbW1Re7toObw8LC3ubn5GdndoMLSGJc8PFut1v2wgeR7RhlWOJ5tJ5rNpuP7K8WZ6MlZk4rfL4Tyz0v2sx9iQCRrtdoTnf9Rt9tda7fbX1Bl7HF3RF8Z2EaolUaj0aMMGxsbz6VNY5G2zlwxVzIJCb5k7dNsmwgV4YGwv33R44Ai3RK+xcBsm44gYtwVvyFn4xnjx247Y6qtCHmha2sCToOvMuhMMxqrT0qzoC38KBQKj3O5XLbT6byRrD+HztP3/cVSqfQxn88XZfMaefn4+LhXqVReiC4I5xCGIEVrUwbuV7pl9GXr5ItmB6MgTTPgRHPIYIUCXRcyYtzrH+EoYBd3hPeEtKGZWarKJZsp0zoOSILdNeF3CFprVWgaWus0WJTBB6LQTmz1SBgHONopGVMq1vs4Hs5GY1fk0DyCs0J21J3FCnJuR854FnqZ42Q8o6pMBpWNm/1Mtgc4gjjRbo4XmcAgiMjiAvEc4hOJwzN0270iDAv/PerrZ5L7Qpor7kmwy1ar1afusXSzgQydi8UztEZSkmnQXorfEfpCEo4bOKkiwAFW9LQfkcwBNDJ0QmwS/C8U7cm2RfvCWZPJxQANspzJZB6sr6+/UqITEBoZOiE25mfRvp9L4oNfFOhnBSpDGUnAyVZZbXwaL0lWjBjyhBRd1guEG4p9YI7qkthPgBPxv5zsP6xU7qoOtOdikZR2/oYgqIC/ACAP+Uwjlal5EC6CV64y+ZgrTxiZw/A3U5iXzxCE9WHeGpt8kWRDkSYwY4JO8Biozp10EGJ2itLyQtwUUm/Wf51ThYgA0/BJ+I71L+HkiMry77z4AAAAAElFTkSuQmCC"};Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.MouseMotion").setCursor=function(e){let t,i=!1,n=e.getDomElement(),o=!1,s=!1,r=!1,a=null;function l(){i&&"walk"==e.getViewer().getEditorManager().editor.name||(n.addClass("motion-zoom"),t=Date.now(),setTimeout((()=>{Date.now()-t>180&&n.removeClass("motion-zoom")}),200))}function h(e){const t=e.keyCode||e.which||e.charCode;17==t?o=!0:18==t&&(s=!0)}function d(e){const t=e.keyCode||e.which||e.charCode;17==t?o=!1:18==t&&(s=!1)}function c(t){e._opt.enableZoomRect||o||s||(a={x:t.clientX,y:t.clientY})}function u(t){if(a&&!r&&!o&&!s&&!(Math.abs(a.x-t.clientX)<2&&Math.abs(a.y-t.clientY)<2)){if(i){let i=e.getUseLeftHandedInput();if("walk"==e.getViewer().getEditorManager().editor.name)1==t.buttons&&n.addClass("motion-rotate");else{let o=e._getIsCursorEnabled();1==t.buttons?o&&n.addClass(i?"motion-rotate":"motion-translate"):n.addClass(i?"motion-translate":"motion-rotate")}}else 1==t.buttons&&n.addClass("motion-translate");r=!0}}function p(e){a=!1,r=!1,n.removeClass("motion-translate"),n.removeClass("motion-rotate")}return Glodon$1.Bimface.Viewer.Viewer3D&&"Viewer3D"===e.viewerType&&(i=!0),document.addEventListener("keydown",h),document.addEventListener("keyup",d),n.addEventListener("mousedown",c),n.addEventListener("mousemove",u),n.addEventListener("mousewheel",l,!1),n.addEventListener("DOMMouseScroll",l,!1),n.addEventListener("mouseup",p),function(){n.removeEventListener("mousemove",u),n.removeEventListener("mousewheel",l),n.removeEventListener("DOMMouseScroll",l),n.removeEventListener("mousedown",c),n.removeEventListener("mouseup",p),document.removeEventListener("keydown",h),document.removeEventListener("keyup",d)}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom").create=function(e,t){var i=document.createElement(e);return i.setAttribute("class",t),i},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom").createNS=function(e,t){var i=document.createElementNS("http://www.w3.org/2000/svg",e);return i.setAttribute("class",t),i},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom").select=function(e){return e.indexOf("#")>-1?document.getElementById(e.replace("#",""))||[]:e.indexOf(".")>-1?document.getElementsByClassName(e.replace(".","")):document.getElementsByTagName(e)},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom").drag=function(e){let t=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop(),i=Object.assign({element:null,handle:null,axis:"all",cursor:"move",distance:0,start:null,move:null,stop:null,bBoxDetection:!1},e),n=i.element;if(!n)return!1;let o,s=i.handle||n,r=!1,a=this;this.resize=function(e,t,n){t=t||{x:0,y:0};let o=e.getBoundingClientRect(),s=e.parentElement.getBoundingClientRect(),r=o.left-s.left,a=o.top-s.top;var l=e.offsetWidth,h=e.offsetHeight,d=e.parentElement.offsetWidth,c=e.parentElement.offsetHeight,u=Math.min(r+t.x,d-l),p=Math.min(a+t.y,c-h),g=r+t.x<0?0:u>0&&u||0,m=a+t.y<0?0:p>0&&p||0;n&&0!=g&&0!=m||(e.style.left=`${g}px`,e.style.top=`${m}px`,e.style.transform="none",i.record&&i.record(g,m))};let l=function(e){var n,r,a=e;if(t){if(n=a.button,!((r=navigator.userAgent).indexOf("compatible")>-1&&r.indexOf("MSIE")>-1&&!isOpera?1==n:0==n))return;o={x:a.clientX,y:a.clientY},document.addEventListener("mousemove",h)}else o={x:a.touches[0].clientX,y:a.touches[0].clientY},s.addEventListener("touchmove",h);i.start&&i.start(o)},h=function(e){var s=e;if(t)var l={x:s.clientX,y:s.clientY};else l={x:s.touches[0].clientX,y:s.touches[0].clientY};var h={x:l.x-o.x,y:l.y-o.y};r?(i.move&&i.move(o,l,h),o=l,function(e){let t=n.getBoundingClientRect(),o=n.parentElement.getBoundingClientRect(),s=t.left-o.left,r=t.top-o.top;if(i.bBoxDetection)a.resize(n,e);else{let t=s+e.x,o=r+e.y;switch(i.axis){case"x":n.style.left=`${t}px`;break;case"y":n.style.top=`${o}px`;break;default:n.style.left=`${t}px`,n.style.top=`${o}px`}}}(h)):r=function(e){return Math.pow(e.x,2)+Math.pow(e.y,2)>Math.pow(i.distance,2)&&(i.start&&i.start(o),!0)}(h),e.preventDefault(),e.stopPropagation()},d=function(){r&&i.end&&i.end(o),r=!1,document.removeEventListener("mousemove",h),s.removeEventListener("touchmove",h)};t?(s.style.cursor=i.cursor,s.style.userSelect="none",s.addEventListener("mousedown",l),document.addEventListener("mouseup",d)):(s.addEventListener("touchend",d),s.addEventListener("touchstart",l))},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.sizable=function(t){let i=Object.assign({element:null,axis:"all",minWidth:100,minHeight:100,distance:0,start:null,sizable:null,stop:null},t),n=i.element;if(!n)return!1;let o,s=!1,r=e.create("div","bf-resize");var a,l;let h=function(e){a=n.clientWidth,l=n.clientHeight;var t,i,s=e;(t=s.button,(i=navigator.userAgent).indexOf("compatible")>-1&&i.indexOf("MSIE")>-1&&!isOpera?1==t:0==t)&&(o={x:s.clientX,y:s.clientY},document.addEventListener("mousemove",d),document.addEventListener("touchmove",d))},d=function(e){var t=e,r={x:t.clientX,y:t.clientY},h={x:r.x-o.x,y:r.y-o.y};s?(i.sizable&&i.sizable(o,r,h),function(e){var t=n.offsetLeft,o=n.offsetTop,s=a+e.x<i.minWidth?i.minWidth:a+e.x,r=l+e.y<i.minHeight?i.minHeight:l+e.y;switch(i.resize&&i.resize(s,r),n.style.left=`${t}px`,n.style.top=`${o}px`,i.axis){case"x":n.style.width=`${s}px`;break;case"y":n.style.height=`${r}px`;break;default:n.style.width=`${s}px`,n.style.height=`${r}px`}}(h)):s=function(e){return Math.pow(e.x,2)+Math.pow(e.y,2)>Math.pow(i.distance,2)&&(i.start&&i.start(o),!0)}(h)},c=function(){s&&i.end&&i.end(o),s=!1,document.removeEventListener("mousemove",d),document.removeEventListener("touchmove",d)};n.addClass("bf-sizable"),n.appendChild(r),r.addEventListener("mousedown",h),r.addEventListener("touchstart",h),document.addEventListener("mouseup",c),document.addEventListener("touchend",c)}}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=function(t){let i=this,n=Object.assign({element:null,min:0,max:100,cur:50,step:1,isShowProgress:!0,input:null,change:null,currentColor:"#11dab7",defaultColor:"#999"},t);this._opt=n;let o=e.create("div","bf-range"),s=e.create("input","bf-input-range");i.input=s,s.setAttribute("type","range"),s.setAttribute("step",n.step),s.setAttribute("min",n.min),s.setAttribute("max",n.max),s.setAttribute("value",n.cur);let r=e.create("span","bf-range-min");r.innerText=n.min;let a=e.create("span","bf-range-cur");i.cur=a,a.innerText=n.cur;let l=e.create("span","bf-range-max");l.innerText=n.max;let h=e.create("span","bf-range-progress");o.appendChild(s),n.isShowProgress&&(o.appendChild(r),o.appendChild(a),o.appendChild(l)),o.appendChild(h),n.element.appendChild(o),i.setProgress(n.cur),s.addEventListener("input",(function(){i.setProgress(this.value),n.input&&n.input(this.value)})),s.addEventListener("change",(function(){i.setProgress(this.value),n.change&&n.change(this.value)}))};t.prototype.setProgress=function(e){var t=this._opt,i=t.max-t.min,n=this.input,o=this.cur,s=(e-t.min)/i*100;n.value=e,n.style.background=`linear-gradient(to right,${t.currentColor} 0%,${t.currentColor} ${s}%,${t.defaultColor} ${s}%, ${t.defaultColor} 100%)`,o.innerText=e},t.prototype.reset=function(){this.setProgress(this._opt.cur)},e.range=t}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=function(e){this._opt=Object.assign({element:null,min:0,max:100,from:null,to:null,step:1,currentColor:"#11dab7",defaultColor:"#999",change:null,callback:null},e),this._opt.from=this._opt.from||this._opt.min,this._opt.to=this._opt.to||this._opt.max,this.init()};t.prototype={init:function(){var t=e.create("div","bf-multiple-range"),i=e.create("div","bf-range-track"),n=e.create("span","bf-slider bf-slider-min");n.id="minSlider",n.type="minimum";var o=e.create("span","bf-slider bf-slider-max");o.id="maxSlider",o.type="maximum",this._state={from:this._opt.from,to:this._opt.to},i.style.backgroundColor=this._opt.currentColor,t.style.backgroundColor=this._opt.defaultColor,t.appendChild(i),t.appendChild(n),t.appendChild(o),this._opt.element.appendChild(t),this._track=i,this._sliders={min:n,max:o},this._element=t,this.bindEvent(),this.update(!1)},bindEvent:function(){var e,t,i=this,n=!1,o=function(i){i=i||event;t=i.screenX,e=this,n=!0};this._sliders.min.addEventListener("mousedown",o),this._sliders.max.addEventListener("mousedown",o),document.addEventListener("mousemove",(function(o){if(n){var s=(o=o||event).screenX-t,r=Math.round(s/i._pix/i._opt.step)*i._opt.step;0!=r&&(t=r*i._pix+t,"minimum"==e.type?i._state.from+=r:i._state.to+=r,i.recalculate(e),i.update(!0))}})),document.addEventListener("mouseup",(function(){n?(n=!1,e=null,i._opt.callback&&i._opt.callback()):(e=null,n=!1)}))},update:function(e){var t=this._sliders.min.offsetWidth,i=this._sliders.max.offsetWidth;if(!this._pix){var n=(this._element.offsetWidth-t-i)/(this._opt.max-this._opt.min);this._pix=n}var o=(this._state.from-this._opt.min)*this._pix,s=(this._state.to-this._opt.min)*this._pix+t+i;this._track.style.left=`${o+t/2}px`,this._track.style.width=s-o-t/2-i/2+"px",this._sliders.min.style.left=`${o}px`,this._sliders.max.style.left=`${s}px`,this._opt.change&&e&&this._opt.change(this._state)},recalculate:function(e){this._state.to>=this._opt.max&&(this._state.to=this._opt.max),this._state.from<=this._opt.min&&(this._state.from=this._opt.min),e&&("maximum"==e.type&&this._state.to<=this._state.from&&(this._state.to=this._state.from),"minimum"==e.type&&this._state.from>=this._state.to&&(this._state.from=this._state.to))},getProgress:function(){return this._state},setProgress:function(e){this._state=e,this.recalculate(),this.update(!1)}},e.multipleRange=t}(),HTMLElement.prototype.tap=function(e){var t;this.addEventListener("touchstart",(function(e){t=Date.now()})),this.addEventListener("touchend",(function(i){Date.now()-t<200&&e(i)}))},function(){var e;(window.ActiveXObject||"ActiveXObject"in window)&&(HTMLElement.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)},window.Element&&((e=Element.prototype).matches=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.msMatchesSelector||function(e){for(var t=this,i=(t.parentNode||t.document).querySelectorAll(e),n=-1;i[++n]&&i[n]!=t;);return!!i[n]}),window.Element&&function(e){e.closest=e.closest||function(e){for(var t=this;t.matches&&!t.matches(e);)t=t.parentNode;return t.matches?t:null}}(Element.prototype))}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.UUID").createUUID=function(){let e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("")},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility").throttle=function(e,t){let i=null,n=Date.now();return null==t&&(t=30),function(){let o=Date.now(),s=t-(o-n);const r=this,a=arguments;clearTimeout(i),s<=0?(e.apply(r,a),n=Date.now()):i=setTimeout(e,s)}};const UtilityNS=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility");UtilityNS.DataUtil={assertType(e,t){const i=t=>Object.prototype.toString.call(e)===`[object ${t}]`;switch(t){case"obj":case"Obj":case"object":case"Object":return i("Object");case"arr":case"Arr":case"array":case"Array":return i("Array");case"num":case"Num":case"number":case"Number":return i("Number");case"func":case"Func":case"function":case"Function":return i("Function");case"str":case"Str":case"string":case"String":return i("String");default:return i(t)}},assertParamsType(...e){if(e.length>1){const[t]=e.splice(e.length-1,1);let i=!0;return e.every((e=>(i=this.assertType(e,t),i))),i}},hasProperty(e,t){return!!this.assertType(e,"obj")&&e.hasOwnProperty(t)},hasProperties(e,...t){if(!t)return!1;let i=!0;return t.every((t=>i=this.hasProperty(e,t))),i},hasChildProperty(e,...t){if(!t||0===t.length)return!1;let i=e;for(let e=0;e<t.length;e++){let n=t[e];if(!this.hasProperty(i,n))return!1;i=i[n]}return!0},getChildProperty(e,...t){if(this.hasChildProperty(e,...t)){let i=e;return t.forEach((e=>i=i[e])),i}},limitTransformationDecimal(e){for(let t=0;t<e.length;t++)t<=11?e[t]=Number(e[t].toFixed(6)):t>11&&t<=14&&(e[t]=Number(e[t].toFixed(3)));return e}};var DataUtil=UtilityNS.DataUtil;Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Utils").Transformation={getTranslation(e){const t=this._getDecompose(e);return{x:t.position.x,y:t.position.y,z:t.position.z}},getQuaternion(e){const t=this._getDecompose(e);return{x:t.quaternion._x,y:t.quaternion._y,z:t.quaternion._z,w:t.quaternion._w}},getScaling(e){const t=this._getDecompose(e);return{x:t.scale.x,y:t.scale.y,z:t.scale.z}},quaternionToEulerAngles(e,t){const i=new THREE.Euler,n=new THREE.Quaternion(e.x,e.y,e.z,e.w),o=i.setFromQuaternion(n,t||"XYZ");return{x:o._x,y:o._y,z:o._z,order:o._order}},eulerAnglesToQuaternion(e){const t=new THREE.Quaternion,i=new THREE.Euler(e.x,e.y,e.z,e.order),n=t.setFromEuler(i);return{x:n._x,y:n._y,z:n._z,w:n._w}},_getDecompose(e){const t=new THREE.Matrix4,i=new THREE.Vector3,n=new THREE.Quaternion,o=new THREE.Vector3;return t.fromArray(e),t.decompose(i,n,o),{position:i,quaternion:n,scale:o}}};const UtilityNS$1=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility");UtilityNS$1.performance={throttleAndDebounce(e,t=300){let i=null,n=null;return function(...o){n&&(clearTimeout(n),n=null),n=setTimeout((()=>{clearTimeout(i),i=null,e(...o)}),t),i||(i=setTimeout((()=>{e(...o),clearTimeout(i),i=null}),t))}},throttle(e,t=300){let i=null;return function(...n){i||(i=setTimeout((()=>{e(...n),clearTimeout(i),i=null}),t))}},debounce(e,t=300){let i=null;return function(...n){i&&(clearTimeout(i),i=null),i=setTimeout((()=>{e(...n)}),t)}}},UtilityNS$1.performance,function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang");let t=function(){this.container={}};t.prototype.addEvent=function(e,t,i){return"string"==typeof e&&"function"==typeof t&&(void 0===this.container[e]?this.container[e]=[t]:!0===i?this.container[e].unshift(t):this.container[e].push(t)),this},t.prototype.fireEvent=function(e){if(e&&this.container[e]){var t=Array.prototype.slice.call(arguments);t.shift();for(var i=[...this.container[e]],n=i.length,o=0;o<n;o++){var s=i[o];if(!0===s.apply(null,t))return this}}return this},t.prototype.removeEvent=function(e,t){if("function"==typeof t&&"string"==typeof e){var i=this.container[e];if(i instanceof Array){for(var n=0,o=i.length;n<o;n+=1)if(i[n]===t){i.splice(n,1);break}0==i.length&&delete this.container[e]}return this}},e.EventManager=t}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Geometry"),t=function(e,t,i){this.x=e,this.y=t,this.z=i};t.prototype={get:function(){return{x:this.x,y:this.y,z:this.z}},set:function(e,t,i){this.x=e,this.y=t,this.z=i}},e.Point3d=t}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Geometry");e.BoundingBox=function(t,i){var n={},o=new e.Point3d,s=new e.Point3d;return o.set(t.x,t.y,t.z),s.set(i.x,i.y,i.z),n.min=o,n.max=s,n}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Graphics.Utility").RGBToHex=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t};var hostConfig=window.hostConfig||{APIHost:"https://api.bimface.com",resourceHost:"https://m.bimface.com",staticHost:"https://static.bimface.com",dataEnvType:"BIMFACE",securityApi:!0};function addNonenumerableProperty(e,t,i){!e[t]&&Object.defineProperty(e,t,{value:i,enumerable:!1})}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Graphics.Utility.Relation");e.getViews=function(e,t,i){Glodon$1.Web.Lang.Utility.HttpRequest.ajax({url:`${hostConfig.resourceHost}/${e}/metadata/views.json`,success:function(n){var o=JSON.parse(n).viewList;n=[];for(var s in o){var r=o[s];r.viewType==t&&(r.preview.path=`${hostConfig.resourceHost}/${e}/${r.preview.path}`,n.push(r))}i&&i(n)}})},e.getDrawingSheets=function(e,t,i,n=null,o={}){Glodon$1.Web.Lang.Utility.HttpRequest.ajax({url:Glodon$1.Web.Lang.Utility.HttpRequest.getUrl({url:`${hostConfig.resourceHost}/${e}/metadata/drawings.json`,path:"metadata/drawings.json",...o}),success:function(e){for(var o=JSON.parse(e).drawingList,s=0;s<o.length;s++){var r=o[s];if(n){if(r.fileId==n&&r.viewInfo.id==t){i&&i(r);break}}else if(r.viewInfo.id==t){i&&i(r);break}}}})},e.point2DToPoint3D=function(e,t){if("DrawingSheet"==t.viewType)return function(e,t){if("DrawingSheet"!=t.viewType)return null;var i=t.viewInfo;let n=i.preview.width,o=i.preview.height,s=i.outline[0],r=i.outline[2],a=i.outline[1],l=i.outline[3],h=r-s,d=l-a;function c(e){return"FloorPlan"==e||"CeilingPlan"==e}function u(t,i,r,l,c){let u=e.x/n,p=(o-e.y)/o;if("Elevation"==c.viewType){p=(n-e.x)/n,u=e.y/o;var g=c.viewPoint.viewDirection;1!=Math.round(g[0])&&-1!=Math.round(g[1])||(u=(o-e.y)/o)}let m=(t-s)/h,f=(i-s)/h;if(u<m||u>f)return null;let w=(r-a)/d,v=(l-a)/d;if(p<w||p>v)return null;let y=(u-m)/(f-m),b=(p-w)/(v-w),E=((c.outline[2]-c.outline[0])*y+c.outline[0])*c.viewPoint.scale,x=((c.outline[3]-c.outline[1])*b+c.outline[1])*c.viewPoint.scale;return new THREE.Vector3(E,x,0)}let p=(i=t).portsAndViews;for(var g=0;g<p.length;g++){let e=p[g];if(!c(e.viewType))continue;let t=u(e.viewport[0],e.viewport[3],e.viewport[1],e.viewport[4],e);if(null!=t){if(c(e.viewType))null!==t&&(t.z=e.elevation);else if("Elevation"==e.viewType){var m=e.viewPoint.viewDirection,f=e.cropBox;0!=Math.round(m[0])?null!==t&&(t.z=t.y,t.y=t.x,t.x=m[0]<0?f[3]:f[0]):0!=Math.round(m[1])&&null!==t&&(t.z=t.y,t.y=m[1]<0?f[4]:f[1])}return t}}return null}(e,t);if("FloorPlan"!=t.viewType)return console.warn("Not support yet!"),null;var i=t.preview.width,n=t.preview.height,o=t.outline[0],s=t.outline[2],r=t.outline[1],a=t.outline[3],l=s-o,h=a-r,d=(0-o)/l,c=a/h,u=(e.x-i*d)/i,p=(n*c-e.y)/n;return u=u*l*t.viewPoint.scale,p=p*h*t.viewPoint.scale,new Glodon$1.Web.Geometry.Point3d(u,p,t.elevation)},e.point3DToPoint2D=function(e,t){let i=[];if(function(e,t,i){if("DrawingSheet"!=t.viewType)return!1;var n=t.preview.width,o=t.preview.height,s=t.outline[0],r=t.outline[2],a=t.outline[1],l=t.outline[3];let h=t.portsAndViews;for(let t in h){let d=h[t];if("FloorPlan"!==d.viewType)continue;let c=d.viewPoint.scale,u=d.outline[0]*c,p=d.outline[2]*c,g=d.outline[1]*c,m=d.outline[3]*c;if(e.x<u||e.x>p)continue;if(e.y<g||e.y>m)continue;let f=(e.x-u)/(p-u),w=(e.y-g)/(m-g),v=d.viewport[3]-d.viewport[0],y=d.viewport[4]-d.viewport[1];i(n*((d.viewport[0]+v*f-s)/(r-s)),o-o*((d.viewport[1]+y*w-a)/(l-a)),d)}return!0}(e,t,(function(e,t,n){i.append({x:e,y:t})})))return 0==i.length?null:i;if("FloorPlan"!=t.viewType)return console.warn("Not support yet!"),null;var n=t.preview.width,o=t.preview.height,s=t.outline[0],r=t.outline[2],a=t.outline[1],l=t.outline[3],h=r-s,d=l-a,c=(0-s)/(r-s),u=l/(l-a),p=e.x/(h*t.viewPoint.scale),g=e.y/(d*t.viewPoint.scale);return{x:p=p*n+n*c,y:g=o*u-g*o,z:0}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Graphics.Utility").ImageContainer=function(e){var t=new Image;return new Promise((function(i,n){t.onload=function(){i(t)},t.onerror=function(e){n(e)},t.crossOrigin="anonymous",t.src=e,!0===t.complete&&i(t)}))},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Graphics"),t=Glodon$1.Web.Graphics.Utility.RGBToHex,i=function(e,t,i,n){this.red=e,this.green=t,this.blue=i,this.alpha=n},n=function(e,t){/^#[0-9a-fA-F]{6}$/.test(e)&&(this.red=parseInt(e.slice(1,3),16),this.green=parseInt(e.slice(3,5),16),this.blue=parseInt(e.slice(5),16)),"number"==typeof t?(t>1&&(t=1),t<0&&(t=0),this.alpha=t):this.alpha=1},o=function(){arguments.length<4?n.apply(this,arguments):i.apply(this,arguments)};o.prototype={getRGB:function(){return`rgba(${this.red},${this.green},${this.blue})`},getRGBA:function(){return`rgba(${this.red},${this.green},${this.blue},${this.alpha})`},getHEX:function(){return`${t(this.red)}${t(this.green)}${t(this.blue)}`},getAlpha:function(){return this.alpha},fromObject:function(e){return this.red=e.red,this.green=e.green,this.blue=e.blue,this.alpha=e.alpha,this}},e.Color=o}(),SVGElement.prototype.getClass=HTMLElement.prototype.getClass=function(e){return this.getAttribute("class")},SVGElement.prototype.hasClass=HTMLElement.prototype.hasClass=function(e){let t=this.getClass();return!!t&&(t&&t.split(" ")).indexOf(e)>-1},SVGElement.prototype.addClass=HTMLElement.prototype.addClass=function(e){let t=this.getClass();var i=t&&t.split(" ");return t?-1==i.indexOf(e)&&(i.push(e),t=i.join(" "),this.setAttribute("class",`${t}`)):this.setAttribute("class",`${e}`),this},SVGElement.prototype.removeClass=HTMLElement.prototype.removeClass=function(e){if(!this.hasClass(e))return this;let t=this.getClass().replace(e,"").trim();return t?this.setAttribute("class",`${t}`):this.removeAttribute("class"),this},SVGElement.prototype.toggleClass=HTMLElement.prototype.toggleClass=function(e,t){this.getClass();var i=this.hasClass(e);return null!=t?(t&&!i&&this.addClass(e),t||this.removeClass(e)):i?this.removeClass(e):this.addClass(e),!i},addNonenumerableProperty(Array.prototype,"getObjectByAttribute",(function(e,t){for(var i=this,n=i.length,o=0;o<n;o++)if(i[o][e]==t)return i[o];return!1})),addNonenumerableProperty(Array.prototype,"removeObjectByAttribute",(function(e,t){for(var i=this,n=i.length,o=0;o<n;o++)if(i[o][e]==t)return i=i.splice(o,1);return!1})),addNonenumerableProperty(Array.prototype,"getAllObjectByAttribute",(function(e,t){for(var i=this,n=i.length,o=0,s=[];o<n;o++)i[o][e]==t&&s.push(i[o]);return s})),addNonenumerableProperty(Array.prototype,"removeByValue",(function(e){for(var t=this,i=t.length-1;i>=0;i--)t[i]==e&&t.splice(i,1);return t})),addNonenumerableProperty(Array.prototype,"insert",(function(e,t){return this.splice(e,0,t),this})),addNonenumerableProperty(Array.prototype,"insertAfter",(function(e,t){let i=e.length;for(;i>0&&-1==this.indexOf(e[i-1]);)i--;return i<1?this.splice(e.length,0,t):this.splice(i,0,t),{res:this,index:i}})),addNonenumerableProperty(Array.prototype,"unique",(function(e){for(var t=[],i=0;i<e.length;i++)t.indexOf(-1===e[i])&&t.push(e[i]);return t})),SVGElement.prototype.setCss=HTMLElement.prototype.setCss=function(e){if(e)for(var t in e)this.style[t]=e[t]},SVGElement.prototype.getCss=HTMLElement.prototype.getCss=function(){return this.style},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Authentication").AuthenticationConfig=function(){return{APIHost:hostConfig.APIHost,viewToken:null,enableStorage:!1}};class IndexedDBHelper{constructor(e){this.indexedDB=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,this.indexedDB||console.log("IndexedDB not supported"),this._db=null,this._opt=e}open(e,t){const i=e||this._opt.name,n=t||this._opt.version||1,o=this.indexedDB.open(i,n);return new Promise(((e,t)=>{o.onsuccess=t=>{this._db=o.result,e(this._db)},o.onupgradeneeded=e=>{let t=this._db=e.target.result;(this._opt.storeList||[]).forEach((e=>!t.objectStoreNames.contains(e)&&t.createObjectStore(e)))},o.onerror=e=>{t(e)}}))}getDB(){return new Promise(((e,t)=>{this._db?e(this._db):this.open().then(e).catch(t)}))}addObject(e,t,i){return new Promise(((n,o)=>{this.getDB().then((s=>{const r=s.transaction(e,"readwrite");r.objectStore(e).put(t,i).onsuccess=e=>{n(e.target.result)},r.onerror=e=>{o(e)}})).catch(o)}))}getObject(e,t){return new Promise(((i,n)=>{this.getDB().then((o=>{const s=o.transaction(e,"readonly");s.objectStore(e).get(t).onsuccess=e=>{let t=e.target.result;t?i(t):n(e)},s.onerror=e=>{n(e)}})).catch(n)}))}deleteObject(e,t){return new Promise(((i,n)=>{this.getDB().then((o=>{const s=o.transaction(e,"readwrite");s.objectStore(e).delete(t).onsuccess=e=>{i(e.target.result)},s.onerror=e=>{n(e)}})).catch(n)}))}clearStore(e){return new Promise(((t,i)=>{this.getDB().then((n=>{const o=n.transaction(e,"readwrite");o.objectStore(e).clear().onsuccess=e=>{t(e.target.result)},o.onerror=e=>{i(e)}})).catch(i)}))}deleteDB(e){return new Promise((t=>{this.indexedDB.deleteDatabase(e),t()}))}getAllKeys(e){return new Promise(((t,i)=>{this.getDB().then((n=>{const o=n.transaction(e,"readonly");o.objectStore(e).getAllKeys().onsuccess=e=>t(e.target.result),o.onerror=i})).catch(i)}))}getAll(e){return new Promise(((t,i)=>{this.getDB().then((n=>{const o=n.transaction(e,"readonly");o.objectStore(e).getAll().onsuccess=e=>t(e.target.result),o.onerror=i})).catch(i)}))}}class LoaderStorageManager extends IndexedDBHelper{constructor(){super({name:"Bf_Loader",version:1,storeList:["d","t"]})}getDatabagInfo(e,t){return new Promise(((i,n)=>{t?this.getObject("d",e).then((e=>this.addTemp(e,t).then((()=>i(e))).catch(n))).catch(n):this.getObject("d",e).then(i).catch(n)}))}addDatabagInfo(e,t){return new Promise(((i,n)=>{const o=e.modelId,s=()=>Promise.all([this.addObject("d",e,o),this.addTemp(e,t)]).then(i).catch(n);this.getDatabagInfo(o).then((t=>{t.databagId!==e.databagId&&this.deleteDB(`Bf_${data.databagId}`),s()})).catch((()=>{s()}))}))}deleteDatabagInfo(e){return new Promise(((t,i)=>{this.deleteObject("d",e).then(t).catch(i)}))}addTemp(e,t){return new Promise(((i,n)=>{this.clearStore("t").then((()=>{this.addObject("t",e,t).then(i).catch(n)})).catch(n)}))}getTemp(e){return new Promise(((t,i)=>{this.getObject("t",e).then(t).catch(i)}))}deleteStorageByModelId(e){return new Promise((t=>{this.getDatabagInfo(e).then((i=>{let n="gisView"===i.renderType?`Bg_${i.modelId}`:`Bf_${i.databagId}`;Promise.allSettled([this.deleteDB(n),this.deleteDatabagInfo(e)]).then(t)})).catch(t)}))}getStoredModelIds(){return this.getAllKeys("d")}getStoredModelInfo(){return new Promise(((e,t)=>{this.getAll("d").then((t=>{let i=t.map((e=>{let{modelId:t,name:i,renderType:n}=e;return{modelId:t,name:i,type:n}}));e(i)})).catch(t)}))}}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Authentication");Glodon$1.Web;let t=Glodon$1.Web.Lang.Utility.HttpRequest;var i=function(e){this.config=e};i.prototype.authenticate=function(e,i){let n=this,o=n.config;const s=()=>{const s=n.config.securityApi;let r=`${o.APIHost}/inside/databag`,a="post",l=o.viewToken;s||(r=`${r}?viewToken=${o.viewToken}`,a="get",l=void 0),t.ajax({url:r,type:a,data:l,headers:{"Content-type":"text/plain;charset=UTF-8"},async:!0,success:function(t){var s=JSON.parse(t);"success"==s.code?(s.data.viewToken=o.viewToken,n.data=s.data,e&&e(s.data)):i&&i(s)},failure:e=>{var t=JSON.parse(e);i&&i(t)}})};o.enableStorage?(new LoaderStorageManager).getTemp(o.viewToken).then((t=>{t.viewToken=o.viewToken,n.data=t,e&&e(t)})).catch(s):s()},e.AuthenticationManager=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data").MetaDataManagerConfig=function(){return{APIHost:hostConfig.APIHost,resourceHost:hostConfig.resourceHost,viewToken:null,modelId:null,modelType:"singleModel",dataEnvType:hostConfig.dataEnvType||"BIMFACE"}};var CLOUD$1=window.CLOUD=window.CLOUD||{};const adaptMiniMapGridData=function(e){return e.map((e=>{const t={positions:[]},i=e.end.x-e.start.x,n=e.end.y-e.start.y,o=e.end.z-e.start.z,s=Math.sqrt(Math.pow(i,2)+Math.pow(n,2)+Math.pow(o,2)),r=i/s,a=n/s,l=o/s,h={x:e.start.x-r,y:e.start.y-a,z:e.start.z-l},d={x:e.end.x+r,y:e.end.y+a,z:e.end.z+l};t.positions.push(h,d);const c=[{startPoint:e.start,endPoint:e.end,lineType:"Line"}];return{id:e.id,name:e.name,label:t,geometry:c}}))};function skipVueObserver(e){DataUtil.assertType(e,"obj")&&(Object.defineProperty(e,"_isVue",{enumerable:!1,value:"ForSkipVueObserver"}),Object.defineProperty(e,"__v_skip",{enumerable:!1,value:"ForSkipVueObserver"}))}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data");var t=Glodon$1.Web.Lang.Utility.HttpRequest.promiseJSONRequest,i=Glodon$1.Web.Lang.Utility.HttpRequest.ajax,n={getFamilyTypes:function(e){const i=`${e.resourcePath}${e.databagId}/metadata/familyInfo.json`;return t(i)},getFamilyData:function(e){const i=`${e.relativeUrl}/metadata/assetProperties.json`;return t(i)},getAreas:function(e){var i=`${e.relativeUrl}/data/spaces.json`;return t(i)},getMepSystem:function(e,i){if("integrateModel"==i.modelType)var n=`${i.relativeUrl}/metadata/${e}/mepsystem.json`;else n=`${i.relativeUrl}/metadata/mepsystem.json`;return t(n,"noCode")},getTreeOldData:function(e){if("singleModel"==e.modelType)var i=`${e.relativeUrl}/data/tree.json`;else i=`${e.relativeUrl}/data/specialtyTree.json`;return t(i)},getTreeNewData:function(e){var i=`${e.relativeUrl}/data/tree.json`;return t(i)},getSectionData:function(e){var i=`${e.relativeUrl}/metadata/sectionCut.json`;return t(i)},getObjectData:function(e,t){return new Promise((function(i,n){if(t._objectData)i(t._objectData);else{let n=new Glodon$1.Bimface.Data.ObjectPropertyManager(`${e.relativeUrl}/property`);n.load((function(){t._objectData=n,i(t._objectData)}))}}))},getMaterialProperty:function(e,i){var n=i.split(".");if("singleModel"==e.modelType)var o=`${e.relativeUrl}/metadata/materialmap.json`;else o=`${e.relativeUrl}/metadata/${n[0]}/materialmap.json`;return t(o,"noCode")},getMaterialPropertyItem:function(e,i,n){var o=i.split("."),s="singleModel"==e.modelType?`${e.relativeUrl}/metadata/materials/${n}.json`:`${e.relativeUrl}/metadata/${o[0]}/materials/${n}.json`;return t(s,"noCode")},getAreaProperty:function(e,i){var n=e.split("_");if("singleModel"==i.modelType)var o=`${i.relativeUrl}/metadata/areas.json`;else o=`${i.relativeUrl}/metadata/${n[0]}/areas.json`;return t(o,"noCode")},getRoomProperty:function(e,i){var n=e.split("_");if("singleModel"==i.modelType)var o=`${i.relativeUrl}/metadata/rooms.json`;else o=`${i.relativeUrl}/metadata/${n[0]}/rooms.json`;return t(o,"noCode")},getFiles:function(e){var i=`${e.relativeUrl}/data/files.json`;return t(i)},getDrawingsheets:function(e,i){var n=`${e.relativeUrl}/metadata/drawings.json`;return t(n,"noCode")},getMapInfo:function(e,t){this._opt;var n={},o=[];this._helper;2===t||"integrateModel"!==e.modelType?i({url:`${e.relativeUrl}/metadata/axisgrids/grids.json.gz`,async:!1,success:function(e){var t=CLOUD$1.AxisGridManager.adaptGridData(JSON.parse(e));n.Grids=t.grids}}):i({url:`${e.relativeUrl}/metadata/grids.json`,async:!1,success:function(e){var t=JSON.parse(e);n.Grids=adaptMiniMapGridData(t.grids)}}),i({async:!1,url:`${e.relativeUrl}/metadata/levels.json`,success:function(e){n.Levels=JSON.parse(e).levels}}),i({async:!1,url:`${e.relativeUrl}/resource/v3/maps/output.json`,dataType:"text",success:function(t){var i=JSON.parse(t);for(var n in i){var s=i[n];null==s.id&&(s.id=n),s.path=`${e.relativeUrl}/resource/v3/maps/${s.id}.png`,s.name=n,o.push(s)}}});let s=n.Levels;if(s){let e=e=>{let t=!1;return o.some((i=>(t=i.id.toString()===e.toString(),t))),t};for(let t=0;t<s.length;t++)e(s[t].id)||(s.splice(t,1),t--)}return{axisGrid:n,floors:o}},getMapInfoAsync:function(e,i){return new Promise(((n,o)=>{let s={Grids:[]},r=[];const a="integrateModel"===e.modelType&&2!==i,l=`${e.relativeUrl}/metadata/${a?"grids.json":"axisgrids/grids.json.gz"}`;Promise.allSettled([t(l,"noCode"),t(`${e.relativeUrl}/metadata/levels.json`,"noCode"),t(`${e.relativeUrl}/resource/v3/maps/output.json`,"noCode")]).then((t=>{let[i,o,l]=t;if(i.value)if(a)s.Grids=adaptMiniMapGridData(i.value.grids);else{var h=CLOUD$1.AxisGridManager.adaptGridData(i.value);s.Grids=h.grids}s.Levels=o.value.levels,(t=>{for(var i in t){var o=t[i];null==o.id&&(o.id=i),o.path=`${e.relativeUrl}/resource/v3/maps/${o.id}.png`,o.name=i,r.push(o)}let a=s.Levels;if(a){let e=e=>{let t=!1;return r.some((i=>(t=i.id.toString()===e.toString(),t))),t};for(let t=0;t<a.length;t++)e(a[t].id)||(a.splice(t,1),t--)}n({axisGrid:s,floors:r})})(l.value)})).catch(o)}))},getLevels:function(e,i){let n=`${i.relativeUrl}/metadata/levels.json`;return e&&(n=`${i.relativeUrl}/metadata/${e}/levels.json`),t(n,"noCode")},getExplosionFloorsInfo:function(e){let t={};return i({async:!1,url:`${e.relativeUrl}/metadata/levels.json`,success:function(e){const i=JSON.parse(e);t.levels=i.levels,t.version=i.version}}),t.version&&t.version>1||i({async:!1,url:`${e.relativeUrl}/resource/v3/maps/output.json`,dataType:"text",success:function(e){const i=JSON.parse(e);t.floors=i}}),t},getLinksJson:function(e){var i=`${e.relativeUrl}/metadata/links.json`;return"singleModel"==e.modelType&&(i=`${e.relativeUrl}/metadata/rvtLinks.json`),t(i,"noCode")},getFloors:function(e){let i=`${e.relativeUrl}/data/spaces.json`;return t(i,"noCode")},getViews:function(e){var t={data:null,resourceHost:"./"};return i({url:`${e.relativeUrl}/metadata/views.json`,async:!1,success:function(e){t.data=e}}),t},getViewsById:function(e){var t={data:null,resourceHost:"./"};return i({url:`${e.relativeUrl}/metadata/${e.fileId}/views.json`,async:!1,success:function(e){t.data=e}}),t},getViewData:function(e){let i=`${e.relativeUrl}/metadata/viewStates/${e.viewId}.json`;return t(i,"noCode")},getRooms:function(e){let i=`${e.resourceHost}/${e.databagId}/metadata/rooms.json`;return t(i,"noCode")},getRoomBoundary:function(e,i){let n=`${i.resourceHost}/${i.databagId}/metadata/roomsboundary/${e}.json`;return t(n,"noCode")},getAllDrawingsheets:function(e){var i=`${e.relativeUrl}/metadata/drawings.json`;return t(i,"noCode")},decodeElementId:function(e,t){if(/^[0-9]*\.*[0-9]*$/.test(t))return Promise.resolve(t);var i=t.split("."),n=i[0];return this.getFiles(e).then((function(e){for(let t of e)for(let e of t.linkedBy)if(e==n)return t.fileId+"."+i[1]})).then((function(e){return e}))},getCategoryVisibility:function(e){var i=`${e.relativeUrl}/metadata/categoryVisibility.json`;return t(i,"noCode")},getText:function(e){var i=`${e.relativeUrl}/metadata/text.json`;return t(i,"noCode")},getSegmentGroups:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentGroups?view_token=${e.viewToken}`;return t(i,"noCode")},getSegmentFromGroups:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentGroups/${i}/segments?view_token=${e.viewToken}`;return t(n,"noCode")},getSegmentTree:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentTree?view_token=${e.viewToken}`;return t(i,"noCode")},getSegmentById:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segments/${i}?view_token=${e.viewToken}`;return t(n,"noCode")},getSegmentElementIds:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segments/${i}/elementIds?view_token=${e.viewToken}`;return t(n,"noCode")},getPartialElementsMetadata:function(e,i){var n=`${e.relativeUrlWithoutDatabagId}/${i}/metadata/partial_elements_metadata.json`;return t(n,"noCode")},getPartialElementsMetadataFile:function(e,t){return`${e.relativeUrlWithoutDatabagId}/${t}/metadata/partial_elements_metadata.json`},getDatabagResource:function(e,t){return`${e.relativeUrlWithoutDatabagId}/${t}/resource/v3/model`},getModelGroup:function(e,i){var n=`${e.relativeUrl}/metadata/modelSetsTree.json`;return t(n,"noCode")},getManifest:function(e){var i=`${e.relativeUrl}/manifest.json`;return t(i,"noCode")},getNestedComponents:function(e){var i=`${e.relativeUrl}/metadata/nestedComponents.json`;return t(i,"noCode")},getObjectMap:function(e){var i=`${e.relativeUrl}/metadata/objectMap.json.gz`;return t(i,"noCode")},getWalkthrough:function(e){var i=`${e.relativeUrl}/data_ext/walkthrough.json`;return t(i,"noCode")},getProjectInfo:function(e){var i=`${e.relativeUrl}/metadata/project.json`;return t(i,"noCode")},getModelInfo:function(e){var i=`${e.relativeUrl}/resource/v3/model/config.json`;return t(i,"noCode")},getBimtileInfo:function(e,i){return t(`${e}/resource/v3/model/${i}`,"noCode")},getFeatureStyle:function(e){var i=`${e.relativeUrl}/resource/v3/model/featureStyle.json`;return t(i,"noCode")},getDimensions:function(e,i){let n=`${i.relativeUrl}/metadata/ModelDimensions.json`;return"integrateModel"==i.modelType&&(n=`${i.relativeUrl}/metadata/${e}/ModelDimensions.json`),t(n,"noCode")},getLevelmapping:function(e){var i=`${e.relativeUrl}/metadata/levelmapping.json`;return t(i,"noCode")},getDrawingTree:function(e,i){var n=`${i.relativeUrl}/metadata/drawingsTree.json`;return"integrateModel"==i.modelType&&(n=`${i.relativeUrl}/metadata/${e}/drawingsTree.json`),t(n,"noCode")},getViewsTree:function(e,i){var n=`${i.relativeUrl}/metadata/viewsTree.json`;return"integrateModel"==i.modelType&&(n=`${i.relativeUrl}/metadata/${e}/viewsTree.json`),t(n,"noCode")}};e.OfflineDataProdiver=n}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data.OfflineDataProdiver");function i(e){this._config=e}i.prototype={getFamilyTypes:function(e,i){t.getFamilyTypes(this._config).then((function(t){var i=JSON.parse(t),n=i.Types||i.types;for(let e=0,t=n.length;e<t;e++)n[e].id=n[e].Id||n[e].id,n[e].name=n[e].Name||n[e].name,delete n[e].Id,delete n[e].Name;e&&e(n)})).catch((function(e){i&&i(e)}))},getFamilyProperty:function(e,i,n){if(!e)return console.warn("familyTypeId must not be empty!."),void(n&&n());t.getFamilyData(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getComponentProperty:function(e,i,n){var o=this;if(!e)return console.warn("elementId must not be empty!."),void(n&&n());var s=null;t.getObjectData(this._config,this).then((function(i){return s=i,t.decodeElementId(o._config,e)})).then((function(e){var t=s.getBoundingBox(e),n=s.getElementProperties(e);let o={};for(var r of n[0].items)o[r.key]=r.value;i({boundingBox:t,elementId:o.ID,familyGuid:"",guid:o.GUID,name:o.name||o.familyType,properties:n})}))},getMaterialProperty:function(e,i,n){var o=this;t.decodeElementId(o._config,e).then((function(e){t.getMaterialProperty(o._config,e).then((function(s){var r=e.split("."),a=[];if(s[r="singleModel"==o._config.modelType?r[0]:r[1]]){for(var l of s[r])a.push(t.getMaterialPropertyItem(o._config,e,l));Promise.all(a).then((e=>{i&&i(e)}))}else n&&n(s)}))}))},getAreas:function(e,i){t.getAreas(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getMepSystem:function(e,i,n){var o=this;t.getMepSystem(e,o._config).then((function(e){i&&i(e,o._config.modelType)})).catch((function(e){n&&n(e)}))},getTreeOldData:function(e,i){var n=this;t.getTreeOldData(n._config).then((function(t){e&&e(t,n._config.modelType,"old")})).catch((function(e){i&&i(e)}))},getTreeNewData:function(e,i){var n=this;t.getTreeNewData(n._config).then((function(t){var i=!0,o=e=>{"familyType"===e.type?e.items&&0!==e.items.length||(i=!1):e.items&&e.items.length>0&&o(e.items[0])};t&&t.length>0&&o(t[0]),e&&e(t,n._config.modelType,i?void 0:"old")})).catch((function(e){i&&i(e)}))},getSectionData:function(e,i){t.getSectionData(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getRoomProperty:function(e,i,n){var o=this;t.getRoomProperty(e,this._config).then((function(n){var s="singleModel"==o._config.modelType?e:e.split("_")[1];for(var r of n)if(r.id==s)return void t.getObjectData(o._config,o).then((function(t){e="singleModel"==o._config.modelType?e:`${e.split("_")[0]}.${e.split("_")[1]}`;var n=t.getElementProperties(e);n.splice(0,1),r.properties=n,i&&i(r)}))}))},getAreaProperty:function(e,i,n){var o=this;t.getAreaProperty(e,this._config).then((function(n){var s="singleModel"==o._config.modelType?e:e.split("_")[1];for(var r of n.areas)r.id==s&&t.getObjectData(o._config,o).then((function(t){e="singleModel"==o._config.modelType?e:`${e.split("_")[0]}.${e.split("_")[1]}`;var n=t.getElementProperties(e);n.splice(0,1),r.properties=n,i&&i(r)}))}))},getModelGroup:function(e,i){t.getModelGroup(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getFiles:function(e,i){t.getFiles(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getLinkGraph:function(e,i){t.getFiles(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDrawingsheets(e,i,n,o){var s=this;t.getDrawingsheets(this._config,e).then((function(e){n&&n(e,s._config.modelType,s._config.dataEnvType)}))},getLinksJson(e,i,n,o){var s=this;e=e||s._config.modelId,t.getLinksJson(this._config,e).then((function(e){n&&n(e,s._config.modelType)})).catch((function(e){o&&o(e)}))},getFloors:function(e,i){var n=this;t.getFloors(this._config).then((function(t){for(let e of t.data)e.miniMap=`${n._config.databagId}/resource/v3/maps/${e.name}.png`;e&&e(t.data)}))},getElementByConditions:function(e,i,n){var o=this;t.getObjectData(this._config,o).then((function(t){n&&n(t.getElementByConditions(e,i,o._config))}))},getMapInfo:function(e,i){var n=t.getMapInfo(this._config,i);e&&e(n)},getMapInfoAsync:function(e,i,n){t.getMapInfoAsync(this._config,n).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getExplosionFloorsInfo:function(e,i){const n=t.getExplosionFloorsInfo(this._config);e&&e(n)},getLevels:function(e,i,n){t.getLevels(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getViews:function(e){var i=t.getViews(this._config);e&&e(i)},getViewsById:function(e,i){var n=this._config;n.fileId=e;var o=t.getViewsById(n);i&&i(o)},getViewData:function(e,i){var n=Object.assign({},this._config);n.viewId=e,t.getViewData(n).then((function(e){"[object Function]"===Object.prototype.toString.call(i)&&i(e)})).catch((function(e){"[object Function]"===Object.prototype.toString.call(failure)&&failure(e)}))},getRooms:function(e,i){t.getRooms(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getRoomBoundary:function(e,i,n){t.getRoomBoundary(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getAllDrawingsheets:function(e,i,n,o){var s=this;t.getAllDrawingsheets(this._config).then((function(e){n&&n(e,s._config.modelType)})).catch((function(e){n&&n({drawingList:[]},s._config.modelType)}))},getCategoryVisibility:function(e,i){t.getCategoryVisibility(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getText:function(e,i){t.getText(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getSegmentGroups:function(e,i){t.getSegmentGroups(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getSegmentFromGroups:function(e,i,n){t.getSegmentFromGroups(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getSegmentTree:function(e,i){t.getSegmentTree(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getSegmentById:function(e,i,n){t.getSegmentById(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getSegmentElementIds:function(e,i,n){t.getSegmentElementIds(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getPartialElementsMetadata:function(e,i,n){t.getPartialElementsMetadata(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getPartialElementsMetadataFile:function(e){return t.getPartialElementsMetadataFile(this._config,e)},getDatabagResource:function(e){return t.getDatabagResource(this._config,e)},getManifest:function(e,i){t.getManifest(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getNestedComponents:function(e,i){t.getNestedComponents(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getObjectMap:function(e,i){t.getObjectMap(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getWalkthrough:function(e,i){t.getWalkthrough(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getProjectInfo:function(e,i){var n=this;t.getProjectInfo(n._config).then((function(t){e&&e(t,n._config.modelType)})).catch((function(e){i&&i(e)}))},getModelInfo:function(e,i){t.getModelInfo(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getBimtileInfo:function(e,i,n,o){const s=`${this._config.relativeUrlWithoutDatabagId}/${e}`;t.getBimtileInfo(s,i).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))},getFeatureStyle:function(e,i){t.getFeatureStyle(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDimensions:function(e,i,n){t.getDimensions(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getLevelmapping:function(e,i){t.getLevelmapping(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDrawingTree:function(e,i){t.getDrawingTree(e,this._config).then((function(e){i&&i(e)})).catch((function(e){i&&i({})}))},getViewsTree:function(e,i){t.getViewsTree(e,this._config).then((function(e){i&&i(e)})).catch((function(e){i&&i({})}))}},e.OfflineDataManager=i}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=(e,t)=>Glodon$1.Web.Lang.Utility.HttpRequest.promiseJSONRequest(e,t,CLOUD$1.EnableStorage),i=e=>Glodon$1.Web.Lang.Utility.HttpRequest.promiseJsonFunction(e),n=e=>Glodon$1.Web.Lang.Utility.HttpRequest.getUrl(e),o=Glodon$1.Web.Lang.Utility.HttpRequest.ajax,s={getMepSystem:function(e,t){if("integrateModel"==t.modelType)var n=`${t.resourceHost}/${t.databagId}/metadata/${e}/mepsystem.json`;else n=`${t.resourceHost}/${t.databagId}/metadata/mepsystem.json`;let o={url:n,path:"integrateModel"==t.modelType?`metadata/${e}/mepsystem.json`:"metadata/mepsystem.json",status:"noCode",...t.httpDefaultParams};return i(o)},getTreeNewData:function(e){let t={url:`${e.resourceHost}/${e.databagId}/data/tree.json`,path:"data/tree.json",status:"noCode",...e.httpDefaultParams};return i(t)},getTreeOldData:function(e){if("singleModel"==e.modelType)var i=`${e.APIHost}/data/v2/files/${e.modelId}/tree?v=2.0&view_token=${e.viewToken}`;else i=`${e.APIHost}/data/v2/integrations/${e.modelId}/tree?view_token=${e.viewToken}&treeType=specialty`;return t(i)},getSectionData:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/sectionCut.json`,path:"metadata/sectionCut.json",status:"noCode",...e.httpDefaultParams};return i(t)},getDrawingList:function(e){e=e;return{fromSingleModel:function(i,n){var o=`${e.APIHost}/data/v2/files/${i}/drawingsheets?elementId=${n}&view_token=${e.viewToken}`;return t(o)},fromIntegrateModel:function(i,n,o){var s=`${e.APIHost}/data/v2/integrations/${i}/drawingsheets?fileIdHash=${n}&elementId=${o}&view_token=${e.viewToken}`;return t(s)}}},getAreas:function(e){if("singleModel"==e.modelType)var i=`${e.APIHost}/data/v2/files/${e.modelId}/floors?includeRoom=true&includeArea=true&view_token=${e.viewToken}`;else i=`${e.APIHost}/data/v2/integrations/${e.modelId}/floors?includeRoom=true&includeArea=true&view_token=${e.viewToken}`;return t(i)},getRoomProperty:function(e,i){if("singleModel"==i.modelType)var n=`${i.APIHost}/data/v2/files/${i.modelId}/rooms/${e}?view_token=${i.viewToken}`;else n=`${i.APIHost}/data/v2/integrations/${i.modelId}/rooms/${e}?view_token=${i.viewToken}`;return t(n)},getAreaProperty:function(e,i){if("singleModel"==i.modelType)var n=`${i.APIHost}/data/v2/files/${i.modelId}/areas/${e}?view_token=${i.viewToken}`;else n=`${i.APIHost}/data/v2/integrations/${i.modelId}/areas/${e}?view_token=${i.viewToken}`;return t(n)},getObjectData:function(e,i){if("singleModel"==e.modelType)var n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/files/${e.modelId}/elements/${i}?view_token=${e.viewToken}`:`${e.APIHost}/data/v2/files/${e.modelId}/elements/${i}?view_token=${e.viewToken}`;else if("integrateModel"==e.modelType){var o=i.split(".");if(1==o.length)n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/integrations/${e.modelId}/elements/${i}?view_token=${e.viewToken}`:`${e.APIHost}/data/v2/integrations/${e.modelId}/elements/${i}?view_token=${e.viewToken}`;else n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/integrations/${e.modelId}/files/${o[0]}/elements/${o[1]}?view_token=${e.viewToken}`:`${e.APIHost}/data/v2/integrations/${e.modelId}/files/${o[0]}/elements/${o[1]}?view_token=${e.viewToken}`}else n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/files/${e.modelId}/elements/${i}?view_token=${e.viewToken}`:`${e.APIHost}/data/v2/sections/${e.modelId}/elements/${i}?view_token=${e.viewToken}`;return t(n)},getFamilyData:function(e,i){let n=`${e.APIHost}/data/v2/rfaFiles/${e.modelId}/familyTypes/${i}?view_token=${e.viewToken}`;return t(n)},getEditedObjectData:function(e,i){if("singleModel"==e.modelType)var n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/files/${e.modelId}/elements/${i}?includeOverrides=true&view_token=${e.viewToken}`:`${e.APIHost}/data/v2/files/${e.modelId}/elements/${i}?includeOverrides=true&view_token=${e.viewToken}`;else{var o=i.split(".");if(1==o.length)n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/integrations/${e.modelId}/elements/${i}?includeOverrides=true&view_token=${e.viewToken}`:`${e.APIHost}/data/v2/integrations/${e.modelId}/elements/${i}?includeOverrides=true&view_token=${e.viewToken}`;else n=e.enableComponentCut?`${e.APIHost}/data/v1/component-segmentation/integrations/${e.modelId}/files/${o[0]}/elements/${o[1]}?includeOverrides=true&view_token=${e.viewToken}`:`${e.APIHost}/data/v2/integrations/${e.modelId}/files/${o[0]}/elements/${o[1]}?includeOverrides=true&view_token=${e.viewToken}`}return t(n)},getFiles:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/files?includeDrawingSheet=true&view_token=${e.viewToken}`;return t(i)},getMaterialOverride:function(e,i,n){i=null==i?n.viewToken:i,e=null==e?n.modelId:e;var o=`${n.APIHost}/data/v2/materialoverridesets/${e}?materialFormat=FULL_INSTANCE_JSON&sort=true&view_token=${i}&compact=true`;return t(o)},getLinkGraph:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/linkGraph?view_token=${e.viewToken}`;return t(i)},getMaterialProperty:function(e,i){if(i){var n=i.split(".");if("singleModel"==e.modelType)var o=`${e.APIHost}/data/v2/files/${e.modelId}/elements/${n[0]}/materials?view_token=${e.viewToken}`;else if("integrateModel"==e.modelType)o=`${e.APIHost}/data/v2/integrations/${e.modelId}/files/${n[0]}/elements/${n[1]}/materials?view_token=${e.viewToken}`;else o=`${e.APIHost}/data/v2/sections/${e.modelId}/elements/${i}/materials?view_token=${e.viewToken}`;return t(o)}failure&&failure({})},getDrawingsheets:function(e,i){var n=`${e.APIHost}/data/v2/files/${i}/drawingsheets?fileId=${i}&view_token=${e.viewToken}`;return t(n)},getAllDrawingsheets:function(e,t){let n={url:`${e.resourceHost}/${e.integrateDrawings&&e.integrateDrawings.databagId||e.databagId}/metadata/drawings.json`,path:"metadata/drawings.json",status:"noCode",...e.httpDefaultParams};return i(n)},getLinksJson:function(e,t){var n=`${e.resourceHost}/${e.databagId}/metadata/links.json`;"singleModel"==e.modelType&&(n=`${e.resourceHost}/${e.databagId}/metadata/rvtLinks.json`);let o={url:n,path:"metadata/links.json",status:"noCode",...e.httpDefaultParams};return i(o)},getFloors:function(e){if("singleModel"==e.modelType)var i=`${e.APIHost}/data/v2/files/${e.modelId}/floors?view_token=${e.viewToken}`;else i=`${e.APIHost}/data/v2/integrations/${e.modelId}/floors?view_token=${e.viewToken}`;return t(i)},getElementByConditions:function(e,i,n){var o="";for(let e in n)o+=`&${e}=${n[e]}`;if("singleModel"==e.modelType)var s=`${e.APIHost}/data/element/id?fileId=${i}${o}&view_token=${e.viewToken}`;else s=`${e.APIHost}/data/v2/integrations/${i}/elementIds?view_token=${e.viewToken}${o}`;return t(s)},getComponentsByConditions:function(e,i,n,o,s){var r={targetIds:[String(i)],targetType:"integrateModel"===e.modelType?"integration":"file",query:{boolOr:[]}};for(let e=0;e<n.length;e++){let t=n[e],i={boolAnd:[]};for(let e in t)i.boolAnd.push({match:{["levelName"===e?"floor":e]:t[e]}});1==i.boolAnd.length&&i.boolAnd.push(i.boolAnd[0]),r.query.boolOr.push(i)}1==r.query.boolOr.length&&r.query.boolOr.push(r.query.boolOr[0]);var a=`${e.APIHost}/data/v2/query/elementIds?view_token=${e.viewToken}`;return t({url:a,type:"post",data:JSON.stringify(r),headers:{"Content-Type":"application/json"}})},getMaterialJson:function(e,i,n){return t({url:`https://apigate.glodon.com/ggpassets/materiallibrary/libraries/${i}/materials?materialIds=${n}&instance=true`,type:"get",data:null,headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",engine:"COMMON"}})},getTextureJson:function(e,i,n){return t({url:`https://apigate.glodon.com/ggpassets/materiallibrary/libraries/${i}/resources/${n}`,type:"get",data:null,headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",engine:"GGP"}})},getMapInfo:function(e,t){this._opt;var i={},s=[];this._helper;2===t||"integrateModel"!==e.modelType?o({url:n({url:`${e.resourceHost}/${e.databagId}/metadata/axisgrids/grids.json.gz`,path:"metadata/axisgrids/grids.json.gz",...e.httpDefaultParams}),async:!1,success:function(e){var t=CLOUD$1.AxisGridManager.adaptGridData(JSON.parse(e));i.Grids=t.grids}}):o({url:n({url:`${e.resourceHost}/${e.databagId}/metadata/grids.json`,path:"metadata/grids.json",...e.httpDefaultParams}),async:!1,success:function(e){var t=JSON.parse(e);i.Grids=adaptMiniMapGridData(t.grids)}}),o({async:!1,url:n({url:`${e.resourceHost}/${e.databagId}/metadata/levels.json`,path:"metadata/levels.json",...e.httpDefaultParams}),success:function(e){i.Levels=JSON.parse(e).levels}}),o({async:!1,url:n({url:`${e.resourceHost}/${e.databagId}/resource/model/maps/output.json`,path:"resource/model/maps/output.json",...e.httpDefaultParams}),dataType:"text",success:function(t){var i=JSON.parse(t);for(var o in i){var r=i[o];null==r.id&&(r.id=o),r.path=n({url:`${e.resourceHost}/${e.databagId}/resource/model/maps/${r.id}.png`,path:`resource/model/maps/${r.id}.png`,...e.httpDefaultParams}),r.name=o,s.push(r)}}});let r=i.Levels;if(r){let e=e=>{let t=!1;return s.some((i=>(t=i.id.toString()===e.toString(),t))),t};for(let t=0;t<r.length;t++)e(r[t].id)||(r.splice(t,1),t--)}return{axisGrid:i,floors:s}},getMapInfoAsync:function(e,t){return new Promise(((o,s)=>{let r={Grids:[]},a=[];const l="integrateModel"===e.modelType&&2!==t,h=`${e.resourceHost}/${e.databagId}/metadata/${l?"grids.json":"axisgrids/grids.json.gz"}`,d="metadata/"+(l?"grids.json":"axisgrids/grids.json.gz");Promise.allSettled([i({url:h,path:d,status:"noCode",...e.httpDefaultParams}),i({url:`${e.resourceHost}/${e.databagId}/metadata/levels.json`,path:"metadata/levels.json",status:"noCode",...e.httpDefaultParams}),i({url:`${e.resourceHost}/${e.databagId}/resource/model/maps/output.json`,path:"resource/model/maps/output.json",status:"noCode",...e.httpDefaultParams})]).then((t=>{let[i,s,h]=t;if(i.value)if(l)r.Grids=adaptMiniMapGridData(i.value.grids);else{var d=CLOUD$1.AxisGridManager.adaptGridData(i.value);r.Grids=d.grids}r.Levels=s.value.levels,(t=>{for(var i in t){var s=t[i];null==s.id&&(s.id=i),s.path=n({url:`${e.resourceHost}/${e.databagId}/resource/model/maps/${s.id}.png`,path:`resource/model/maps/${s.id}.png`,...e.httpDefaultParams}),s.name=i,a.push(s)}let l=r.Levels;if(l){let e=e=>{let t=!1;return a.some((i=>(t=i.id.toString()===e.toString(),t))),t};for(let t=0;t<l.length;t++)e(l[t].id)||(l.splice(t,1),t--)}o({axisGrid:r,floors:a})})(h.value)})).catch(s)}))},getExplosionFloorsInfo:function(e){let t={};return o({async:!1,url:`${e.resourceHost}/${e.databagId}/metadata/levels.json`,success:function(e){const i=JSON.parse(e);t.levels=i.levels,t.version=i.version}}),t.version&&t.version>1||o({async:!1,url:`${e.resourceHost}/${e.databagId}/resource/model/maps/output.json`,dataType:"text",success:function(e){const i=JSON.parse(e);t.floors=i}}),t},getExplosionFloorsInfoAsync:function(e){let i={};return new Promise(((n,o)=>{const s=`${e.resourceHost}/${e.databagId}/metadata/levels.json`;t(s,"noCode").then((s=>{i.levels=s.levels,i.levels.length>0&&i.levels[0].boundingBox?n(i):t(`${e.resourceHost}/${e.databagId}/resource/v3/maps/output.json`,"noCode").then((e=>{i.floors=e,n(i)})).catch(o)})).catch(o)}))},getLevels:function(e,t){let n=`${t.resourceHost}/${t.databagId}/metadata/levels.json`,o="metadata/levels.json";e&&(n=`${t.resourceHost}/${t.databagId}/metadata/${e}/levels.json`,o=`metadata/${e}/levels.json`);let s={url:n,path:o,status:"noCode",...t.httpDefaultParams};return i(s)},getViews:function(e){var t={data:null,resourceHost:e.resourceHost};return o({url:n({url:`${e.resourceHost}/${e.databagId}/metadata/views.json`,path:"metadata/views.json",...e.httpDefaultParams}),async:!1,success:function(e){t.data=e}}),t},getViewsById:function(e){var t={data:null,resourceHost:e.resourceHost};return o({url:n({url:`${e.resourceHost}/${e.databagId}/metadata/${e.fileId}/views.json`,path:`metadata/${e.fileId}/views.json`,...e.httpDefaultParams}),async:!1,success:function(e){t.data=e}}),t},getViewData:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/viewStates/${e.viewId}.json`,path:`metadata/viewStates/${e.viewId}.json`,status:"noCode",...e.httpDefaultParams};return i(t)},getRooms:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/rooms.json`,path:"metadata/rooms.json",status:"noCode",...e.httpDefaultParams};return i(t)},getRoomBoundary:function(e,t){let n={url:`${t.resourceHost}/${t.databagId}/metadata/roomsboundary/${e}.json`,path:`metadata/roomsboundary/${e}.json`,status:"noCode",...t.httpDefaultParams};return i(n)},getCategoryVisibility:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/categoryVisibility.json`,path:"metadata/categoryVisibility.json",status:"noCode",...e.httpDefaultParams};return i(t)},getText:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/text.json`,path:"metadata/text.json",status:"noCode",...e.httpDefaultParams};return i(t)},getScheduleList:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/schedule.json`,path:"metadata/schedule.json",status:"noCode",...e.httpDefaultParams};return i(t)},getScheduleById:function(e,t){let n={url:`${t.resourceHost}/${t.databagId}/metadata/schedule/${e}.txt`,path:`metadata/schedule/${e}.txt`,status:"noCode",...t.httpDefaultParams};return i(n)},getSegmentGroups:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentGroups?view_token=${e.viewToken}`;return t(i,"noCode")},getSegmentFromGroups:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentGroups/${i}/segments?view_token=${e.viewToken}`;return t(n,"noCode")},getSegmentTree:function(e){var i=`${e.APIHost}/data/v2/integrations/${e.modelId}/segmentTree?view_token=${e.viewToken}`;return t(i,"noCode")},getSegmentById:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segments/${i}?view_token=${e.viewToken}`;return t(n,"noCode")},getSegmentElementIds:function(e,i){var n=`${e.APIHost}/data/v2/integrations/${e.modelId}/segments/${i}/elementIds?view_token=${e.viewToken}`;return t(n,"noCode")},getPartialElementsMetadata:function(e,t){let n={url:`${e.resourceHost}/${t}/metadata/partial_elements_metadata.json`,path:"metadata/partial_elements_metadata.json",status:"noCode",...e.httpDefaultParams};return i(n)},getPartialElementsMetadataFile:function(e,t){return n({url:`${e.resourceHost}/${t}/metadata/partial_elements_metadata.json`,path:"metadata/partial_elements_metadata.json",...e.httpDefaultParams})},getDatabagResource:function(e,t){return n({url:`${e.resourceHost}/${t}/resource/v3/model`,path:"resource/v3/model",...e.httpDefaultParams})},getModelGroup:function(e,t){let n={url:`${e.resourceHost}/${e.databagId}/metadata/modelSetsTree.json`,path:"metadata/modelSetsTree.json",status:"noCode",...e.httpDefaultParams};return i(n)},getManifest:function(e){let t={url:`${e.resourceHost}/${e.databagId}/manifest.json`,path:"manifest.json",status:"noCode",...e.httpDefaultParams};return i(t)},getNestedComponents:function(e){let t={url:`${e.relativeUrl}/metadata/nestedComponents.json`,path:"metadata/nestedComponents.json",status:"noCode",...e.httpDefaultParams};return i(t)},getObjectMap:function(e){let t={url:`${e.relativeUrl}/metadata/objectMap.json.gz`,path:"metadata/objectMap.json.gz",status:"noCode",...e.httpDefaultParams};return i(t)},getWalkthrough:function(e){let t={url:`${e.relativeUrl}/data_ext/walkthrough.json`,path:"data_ext/walkthrough.json",status:"noCode",...e.httpDefaultParams};return i(t)},getProjectInfo:function(e){let t={url:`${e.resourceHost}/${e.databagId}/metadata/project.json`,path:"metadata/project.json",status:"noCode",...e.httpDefaultParams};return i(t)},getModelInfo:function(e){let t={url:`${e.relativeUrl}/resource/v3/model/config.json`,path:"resource/v3/model/config.json",status:"noCode",...e.httpDefaultParams};return i(t)},getBimtileInfo:function(e,t,n){let o={url:`${e}/resource/v3/model/${t}`,path:`resource/v3/model/${t}`,status:"noCode",...n.httpDefaultParams};return i(o)},getFeatureStyle:function(e){let t={url:`${e.relativeUrl}/resource/v3/model/featureStyle.json`,path:"resource/v3/model/featureStyle.json",status:"noCode",...e.httpDefaultParams};return i(t)},getDimensions:function(e,i){let o=`${i.relativeUrl}/metadata/ModelDimensions.json`;return"integrateModel"==i.modelType&&(o=`${i.relativeUrl}/metadata/${e}/ModelDimensions.json`),o=n({url:o,path:"integrateModel"==i.modelType?"metadata/ModelDimensions.json":`metadata/${e}/ModelDimensions.json`,...i.httpDefaultParams}),t(o,"noCode")},getLevelmapping:function(e){let t={url:`${e.relativeUrl}/metadata/levelmapping.json`,path:"metadata/levelmapping.json",status:"noCode",...e.httpDefaultParams};return i(t)},getDrawingTree:function(e,t){var n=`${t.relativeUrl}/metadata/drawingsTree.json`;"integrateModel"==t.modelType&&(n=`${t.relativeUrl}/metadata/${e}/drawingsTree.json`);let o={url:n,path:"integrateModel"==t.modelType?`metadata/${e}/drawingsTree.json`:"metadata/drawingsTree.json",status:"noCode",...t.httpDefaultParams};return i(o)},getViewsTree:function(e,t){var n=`${t.relativeUrl}/metadata/viewsTree.json`;"integrateModel"==t.modelType&&(n=`${t.relativeUrl}/metadata/${e}/viewsTree.json`);let o={url:n,path:"integrateModel"==t.modelType?`metadata/${e}/viewsTree.json`:"metadata/viewsTree.json",status:"noCode",...t.httpDefaultParams};return i(o)}};e.OnlineDataProdiver=s}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data.OnlineDataProdiver");function i(e){this._config=e,this._config.httpDefaultParams={APIHost:e.APIHost,loadMode:e.loadMode,fileId:e.modelId,viewToken:e.viewToken,modelType:e.modelType}}i.prototype={getOfflineDataManager(){return this._offlineDatamanager=this._offlineDatamanager||new e.OfflineDataManager(this._config),this._offlineDatamanager},getComponentProperty:function(e,i,n){const o=this;if(!e)return console.warn("elementId must not be empty!."),void(n&&n());t.getObjectData(this._config,e).then((function(e){i&&i(e)})).catch((function(t){CLOUD$1.EnableStorage&&!o._config.isGlobeScene?o.getOfflineDataManager().getComponentProperty(e,i,n):n&&n(t)}))},getFamilyProperty:function(e,i,n){if(!e)return console.warn("familyTypeId must not be empty!."),void(n&&n());t.getFamilyData(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getComponentOverriddenProperty:function(e,i,n){if(!e)return console.warn("elementId must not be empty!."),void(n&&n());t.getEditedObjectData(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getMaterialProperty:function(e,i,n){var o=this;t.getMaterialProperty(this._config,e).then((function(e){i&&i(e)})).catch((function(t){CLOUD$1.EnableStorage?o.getOfflineDataManager().getMaterialProperty(e,i,n):n&&n(t)}))},getTreeOldData:function(e,i){var n=this;t.getTreeOldData(n._config).then((function(t){e&&e(t,n._config.modelType,"old")})).catch((function(e){i&&i(e)}))},getTreeNewData:function(e,i,n=!0){var o=this;t.getTreeNewData(o._config).then((function(t){e&&(!n&&e(t,o._config.modelType),n&&e(t.data,o._config.modelType))})).catch((function(e){i&&i(e)}))},getSectionData:function(e,i,n=!0){var o=this;t.getSectionData(o._config).then((function(t){e&&(!n&&e(t,o._config.modelType),n&&e(t.data,o._config.modelType))})).catch((function(e){i&&i(e)}))},getMepSystem:function(e,i,n){var o=this;t.getMepSystem(e,o._config).then((function(e){i&&i(e,o._config.modelType)})).catch((function(e){n&&n(e)}))},getAreas:function(e,i){t.getAreas(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getRoomProperty:function(e,i,n){t.getRoomProperty(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getDrawingList:function(e,i,n,o){var s=this._config.modelType;if("integrateModel"==s){var r=i.split(".")[0],a=i.split(".")[1];t.getDrawingList(this._config).fromIntegrateModel(e,r,a).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))}else"singleModel"==s&&t.getDrawingList(this._config).fromSingleModel(e,i).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))},getModelGroup:function(e,i){t.getModelGroup(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getAreaProperty:function(e,i,n){t.getAreaProperty(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getFiles:function(e,i){t.getFiles(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getMaterialOverride:function(e,i,n,o){t.getMaterialOverride(e,i,this._config).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))},getLinkGraph:function(e,i){t.getLinkGraph(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDrawingsheets(e,i,n,o){var s=this;e=e||s._config.modelId,t.getDrawingsheets(this._config,e).then((function(e){n&&n(e,s._config.modelType)})).catch((function(e){o&&o(e)}))},getAllDrawingsheets(e,i,n,o){var s=this;e=e||s._config.modelId,t.getAllDrawingsheets(this._config,e).then((function(e){n&&n(e,s._config.modelType)})).catch((function(e){o&&o(e)}))},getLinksJson(e,i,n,o){var s=this;e=e||s._config.modelId,t.getLinksJson(this._config,e).then((function(e){n&&n(e,s._config.modelType)})).catch((function(e){o&&o(e)}))},getFloors(e,i){t.getFloors(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getElementByConditions(e,i,n,o){t.getElementByConditions(this._config,e,i).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))},getComponentsByConditions(e,i,n,o){t.getComponentsByConditions(this._config,e,i).then((function(e){n&&n(e&&e[0].elementIds)})).catch((function(e){o&&o(e)}))},getMaterialJson(e,i,n,o,s){t.getMaterialJson(e,i,n).then((function(e){o&&o(e)})).catch((function(e){s&&s(e)}))},getTextureJson:function(e,i,n,o,s){t.getTextureJson(e,i,n).then((function(e){o&&o(e)})).catch((function(e){s&&s(e)}))},getMapInfo:function(e,i){var n=t.getMapInfo(this._config,i);e&&e(n)},getMapInfoAsync:function(e,i,n){t.getMapInfoAsync(this._config,n).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getExplosionFloorsInfo:function(e,i){const n=t.getExplosionFloorsInfo(this._config);e&&e(n)},getLevels:function(e,i,n){t.getLevels(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getViews:function(e){var i=t.getViews(this._config);e&&e(i)},getViewsById:function(e,i){var n=this._config;n.fileId=e;var o=t.getViewsById(n);i&&i(o)},getViewData:function(e,i,n){var o=Object.assign({},this._config);o.viewId=e,t.getViewData(o).then((function(e){"[object Function]"===Object.prototype.toString.call(i)&&i(e)})).catch((function(e){"[object Function]"===Object.prototype.toString.call(n)&&n(e)}))},getRooms:function(e,i){t.getRooms(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getRoomBoundary:function(e,i,n){t.getRoomBoundary(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getCategoryVisibility:function(e,i){t.getCategoryVisibility(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getText:function(e,i){t.getText(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getScheduleList:function(e,i){t.getScheduleList(this._config).then((function(t){e&&e(t.scheduleList)})).catch((function(e){i&&i(e)}))},getScheduleById:function(e,i,n){t.getScheduleById(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getSegmentGroups:function(e,i){t.getSegmentGroups(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getSegmentFromGroups:function(e,i,n){t.getSegmentFromGroups(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getSegmentTree:function(e,i){t.getSegmentTree(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getSegmentById:function(e,i,n){t.getSegmentById(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getSegmentElementIds:function(e,i,n){t.getSegmentElementIds(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getPartialElementsMetadata:function(e,i,n){t.getPartialElementsMetadata(this._config,e).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getPartialElementsMetadataFile:function(e){return t.getPartialElementsMetadataFile(this._config,e)},getDatabagResource:function(e){return t.getDatabagResource(this._config,e)},getDatabagResource:function(e){return t.getDatabagResource(this._config,e)},getManifest:function(e,i){t.getManifest(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getNestedComponents:function(e,i){t.getNestedComponents(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getObjectMap:function(e,i){t.getObjectMap(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getWalkthrough:function(e,i){t.getWalkthrough(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getProjectInfo:function(e,i){var n=this;t.getProjectInfo(n._config).then((function(t){e&&e(t,n._config.modelType)})).catch((function(e){i&&i(e)}))},getModelInfo:function(e,i){t.getModelInfo(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getBimtileInfo:function(e,i,n,o){const s=`${this._config.relativeUrlWithoutDatabagId}/${e}`;t.getBimtileInfo(s,i,this._config).then((function(e){n&&n(e)})).catch((function(e){o&&o(e)}))},getFeatureStyle:function(e,i){t.getFeatureStyle(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDimensions:function(e,i,n){t.getDimensions(e,this._config).then((function(e){i&&i(e)})).catch((function(e){n&&n(e)}))},getLevelmapping:function(e,i){t.getLevelmapping(this._config).then((function(t){e&&e(t)})).catch((function(e){i&&i(e)}))},getDrawingTree:function(e,i){t.getDrawingTree(e,this._config).then((function(e){i&&i(e)})).catch((function(e){i&&i({})}))},getViewsTree:function(e,i){t.getViewsTree(e,this._config).then((function(e){i&&i(e)})).catch((function(e){i&&i({})}))}},e.OnlineDataManager=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=function(t){if(this._config=t,this._objectData=null,this._cache={},"Local"==t.dataEnvType?this.dataManager=new e.OfflineDataManager(t):this.dataManager=new e.OnlineDataManager(t),!t.viewToken)return!1};t.prototype={getFamilyTypes:function(e,t){this.dataManager.getFamilyTypes(e,t)},getComponentProperty:function(e,t,i){this.dataManager.getComponentProperty(e,t,i)},getFamilyProperty:function(e,t,i){this.dataManager.getFamilyProperty(e,t,i)},getComponentOverriddenProperty:function(e,t,i){this.dataManager.getComponentOverriddenProperty(e,t,i)},getDrawingList:function(e,t,i,n){this.dataManager.getDrawingList(e,t,i,n)},getTreeOldData:function(e,t){this.dataManager.getTreeOldData(e,t)},getTreeNewData:function(e,t,i=!1){this.dataManager.getTreeNewData(e,t,i)},getSectionData:function(e,t,i=!1){this.dataManager.getSectionData(e,t,i)},getMepSystem:function(e,t,i){this.dataManager.getMepSystem(e,t,i)},getModeTree:function(e,t){console.warn("This function is deprecated. Please use getTreeOldData instead."),this.getTreeOldData(e,t)},getFloors:function(e,t){this.dataManager.getFloors(e,t)},getAreas:function(e,t){this.dataManager.getAreas(e,t)},getAreaProperty:function(e,t,i){this.dataManager.getAreaProperty(e,t,i)},getModelGroup:function(e,t){this.dataManager.getModelGroup(e,t)},getMaterialProperty:function(e,t,i){this.dataManager.getMaterialProperty(e,t,i)},getRoomProperty:function(e,t,i){this.dataManager.getRoomProperty(e,t,i)},getFiles:function(e,t){this.dataManager.getFiles(e,t)},getMaterialOverride:function(e,t,i,n){this.dataManager.getMaterialOverride(e,t,i,n)},getLinkGraph:function(e,t){this.dataManager.getLinkGraph(e,t)},getDrawingsheets:function(e,t,i,n){this.dataManager.getDrawingsheets(e,t,i,n)},getElementByConditions:function(e,t,i,n){this.dataManager.getElementByConditions(e,t,i,n)},getComponentsByConditions:function(e,t,i,n){this.dataManager.getComponentsByConditions(e,t,i,n)},getMaterialJson(e,t,i,n,o){this.dataManager.getMaterialJson(e,t,i,n,o)},getTextureJson:function(e,t,i,n,o){this.dataManager.getTextureJson(e,t,i,n,o)},getAllDrawingsheets:function(e,t,i,n){this.dataManager.getAllDrawingsheets(e,t,i,n)},getLinksJson:function(e,t,i,n){this.dataManager.getLinksJson(e,t,i,n)},getMapInfo:function(e,t){this.dataManager.getMapInfo(e,t)},getMapInfoAsync:function(e,t,i){this.dataManager.getMapInfoAsync(e,t,i)},getExplosionFloorsInfo:function(e,t){this.dataManager.getExplosionFloorsInfo(e,t)},getCategoryVisibility:function(e,t){this.dataManager.getCategoryVisibility(e,t)},getText:function(e,t){this.dataManager.getText(e,t)},getScheduleList:function(e,t){this.dataManager.getScheduleList(e,t)},getScheduleById:function(e,t,i){this.dataManager.getScheduleById(e,t,i)},getSegmentGroups:function(e,t){this.dataManager.getSegmentGroups(e,t)},getSegmentFromGroups:function(e,t,i){this.dataManager.getSegmentFromGroups(e,t,i)},getSegmentTree:function(e,t){this.dataManager.getSegmentTree(e,t)},getSegmentById:function(e,t,i){this.dataManager.getSegmentById(e,t,i)},getSegmentElementIds:function(e,t,i){this.dataManager.getSegmentElementIds(e,t,i)},getPartialElementsMetadata:function(e,t,i){this.dataManager.getPartialElementsMetadata(e,t,i)},getPartialElementsMetadataFile:function(e){return this.dataManager.getPartialElementsMetadataFile(e)},getDatabagResource:function(e){return this.dataManager.getDatabagResource(e)},getManifest:function(e,t){return this.dataManager.getManifest(e,t)},getNestedComponents:function(e){return this.dataManager.getNestedComponents(e)},getObjectMap:function(e){return this.dataManager.getObjectMap(e)},getWalkthrough:function(e){return this.dataManager.getWalkthrough(e)},getViews:function(e){return this.dataManager.getViews(e)},getViewData:function(e,t,i){return this.dataManager.getViewData(e,t,i)},getProjectInfo:function(e,t){this.dataManager.getProjectInfo(e,t)},getModelInfo:function(e,t){return this.dataManager.getModelInfo(e,t)},getBimtileInfo:function(e,t,i,n){return this.dataManager.getBimtileInfo(e,t,i,n)},getFeatureStyle:function(e,t){return this.dataManager.getFeatureStyle(e,t)},getDimensions:function(e,t,i){return this.dataManager.getDimensions(e,t,i)},getLevelmapping:function(e){return this.dataManager.getLevelmapping(e)},getDrawingTree:function(e,t){return this.dataManager.getDrawingTree(e,t)},getViewsTree:function(e,t){return this.dataManager.getViewsTree(e,t)}},e.MetaDataManager=t}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data").FamilyDataManagerConfig=function(){return{resourceHost:hostConfig.resourceHost,databagId:null}},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=Glodon$1.Web.Lang.Utility.HttpRequest,i=function(e){if(!e.databagId)return!1;this.__config=e};i.prototype.getFamilyTypes=function(e,i){let n,o=this.__config;"Local"==o.dataEnvType?(n=`./${o.databagId}/metadata/familyInfo.json`,o.resourcePath&&(n=`${o.resourcePath}/${o.databagId}/metadata/familyInfo.json`)):n=t.getUrl({url:`${o.resourceHost}/${o.databagId}/metadata/familyInfo.json`,path:"metadata/familyInfo.json",...this.__config.httpDefaultParams}),t.ajax({url:n,success:function(t){var i=(t=JSON.parse(t)).Types||t.types;for(let e=0,t=i.length;e<t;e++)i[e].id=i[e].Id||i[e].id,i[e].name=i[e].Name||i[e].name,delete i[e].Id,delete i[e].Name;e&&e(i)},failure:e=>{var t=JSON.parse(e);i&&i(t)}})},e.FamilyDataManager=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data").IBLManagerConfig=function(){return{resourceHost:hostConfig.staticHost}},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=Glodon$1.Web.Lang.Utility.HttpRequest,i=function(e){this.__config=e};i.prototype.getIBLConfig=function(e,i){let n,o=this.__config;if("Local"==o.dataEnvType)return!1;n=`${o.resourceHost}/resources/IBL/IBLConfig.json`,t.ajax({url:n,success:function(t){var i=JSON.parse(t);e&&e(i)},failure:e=>{var t=JSON.parse(e);i&&i(t)}})},e.IBLManager=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t={version:1,EnumObjectTableIndex:{OTI_OBJECTS_VALUES:0,OTI_PROPERTY_SCHEMAS:1,OTI_ELEMENT_PROPERTIES:2,OTI_FAMILY_PROPERTIES:3,OTI_FAMILIES:4,OTI_ELEMENTS:5,OTI_BOUNDING_BOX:6,OTI_ELEMENTS_CLASS:7}},i=function(e){this.url=e,this.objectsDB=[]};i.prototype={load:function(e){var t=this,i=["Values.json","Schemas.json","ElementProperties.json","FamilyTypeProperties.json","Families.json","Elements.json","BoundingBox.json"],n=i.length;i.forEach(((i,o)=>{const s=t.url+"/"+i+CLOUD.GlobalData.ZipResourcePostfix;CLOUD.Storage.IndexedDBHelper.loadWithStorage("InfoData",s,(()=>new Promise(((e,t)=>{(new THREE.FileLoader).load(s,e,void 0,t)}))),(t=>{this.objectsDB[o]=JSON.parse(t),0==(n-=1)&&e()}))}))},getFamilyTypeProperties:function(e){var i=this.objectsDB[t.EnumObjectTableIndex.OTI_FAMILIES][e];if(void 0===i)return null;for(var n=this.objectsDB[t.EnumObjectTableIndex.OTI_OBJECTS_VALUES],o=this.objectsDB[t.EnumObjectTableIndex.OTI_FAMILY_PROPERTIES],s=this.objectsDB[t.EnumObjectTableIndex.OTI_PROPERTY_SCHEMAS],r=0,a=0,l=0,h={},d=[],c=0,u=0,p=i[2],g=i[1];u<p;++u){a=4*o[r=2*(g+u)],l=o[r+1];var m=h[c=s[a]];void 0===m&&(m=[],h[c]=m,d.push(c)),m.push({key:n[s[a+1]],unit:n[s[a+3]],valueType:s[a+2],value:n[l]})}for(var f=[],w=(u=0,d.length);u<w;++u)c=d[u],f.push({group:n[c],items:h[c]});return f},getElementProperties:function(e){if(null==e)return null;var i=this.objectsDB[t.EnumObjectTableIndex.OTI_ELEMENTS][e];if(void 0===i)return null;for(var n=this.objectsDB[t.EnumObjectTableIndex.OTI_OBJECTS_VALUES],o=this.objectsDB[t.EnumObjectTableIndex.OTI_ELEMENT_PROPERTIES],s=this.objectsDB[t.EnumObjectTableIndex.OTI_PROPERTY_SCHEMAS],r=0,a=0,l=0,h={},d=[],c=0,u=0,p=i[2],g=i[1];u<p;++u){a=4*o[r=2*(g+u)],l=o[r+1];var m=h[c=s[a]];void 0===m&&(m=[],h[c]=m,d.push(c)),m.push({key:n[s[a+1]],unit:n[s[a+3]],valueType:s[a+2],value:n[l]})}for(var f=[],w=(u=0,d.length);u<w;++u)c=d[u],f.push({group:n[c],items:h[c]});var v=this.getFamilyTypeProperties(i[3]);if(!v)return f;var y={},b=[];for(var E of f=v.concat(f))if(y[E.group]){var x=[].concat.apply(y[E.group].items,E.items),C=[];for(var M of x){var P=!0;for(var T of C)M.key==T.key&&(P=!1);P&&C.push(M)}y[E.group]={group:y[E.group].group,items:C}}else y[E.group]=E;for(var E in y)"基本属性"==y[E].group?b.unshift(y[E]):b.push(y[E]);return b},getElementByConditions:function(e,i,n){var o=this.objectsDB[t.EnumObjectTableIndex.OTI_ELEMENTS_CLASS],s=Object.keys(i),r=[],a=[],l={},h={min:{x:null,y:null,z:null},max:{x:null,y:null,z:null}},d=[];for(let e of s)d.push({typeIndex:this._getGroupsKey(e,i[e],o),typeValue:i[e]});for(let e=0;e<o.groups.length;e+=3){let t=!0;for(let i of d){let n=o.groups[e][i.typeIndex];if(o.values[n]!=i.typeValue){t=!1;break}}if(t)if("singleModel"==n.modelType)r=r.concat(o.groups[e+1][""]);else{var c=o.groups[e+1],u=o.groups[e+2];for(var p in c)for(var g of c[p])a.push({fileId:p,elementId:g});(h.min.x>u[0]||null==h.min.x)&&(h.min.x=u[0]),(h.min.y>u[1]||null==h.min.y)&&(h.min.y=u[1]),(h.min.z>u[2]||null==h.min.z)&&(h.min.z=u[2]),(h.max.x<u[3]||null==h.max.x)&&(h.max.x=u[3]),(h.max.y<u[4]||null==h.max.y)&&(h.max.y=u[4]),(h.max.z<u[5]||null==h.max.z)&&(h.max.z=u[5])}}return"singleModel"==n.modelType?r:0==a.length?[]:(l.elements=a,l.boundingBox=h,l)},_getGroupsKey:function(e,t,i){var n=0;for(let t=0;t<i.keys.length;t++)if(i.keys[t]==e){n=t;break}return n},getBoundingBox:function(e){if(null==e)return null;var i=this.objectsDB[t.EnumObjectTableIndex.OTI_BOUNDING_BOX],n="";try{n={min:{x:i[e][0],y:i[e][1],z:i[e][2]},max:{x:i[e][3],y:i[e][4],z:i[e][5]}}}catch(e){console.log("no boundingBox Data"),n=""}return n}},e.ObjectPropertyManager=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data").FileManagerConfig=function(){return{APIHost:hostConfig.APIHost,resourceHost:hostConfig.resourceHost,viewToken:null,modelId:null,modelType:"singleModel",dataEnvType:hostConfig.dataEnvType||"BIMFACE"}},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Data"),t=Glodon$1.Web.Lang.Utility.HttpRequest,i=function(e){this.__config=e};i.prototype.getViewToken=function(e,i,n){let o,s=this.__config;if("singleModel"==s.modelType)return!1;"Local"!=s.dataEnvType?(o=`${s.APIHost}/data/v2/integrations/${s.modelId}/files/${e}/viewToken?view_token=${s.viewToken}`,t.ajax({url:o,type:"post",success:function(e){var t=JSON.parse(e);i&&i(t.data)},failure:e=>{var t=JSON.parse(e);n&&n(t)}})):i&&i()},e.FileManager=i}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Viewer");e.ViewerPDFConfig=class{constructor(){const e={domElement:null,resourceHost:hostConfig.resourceHost,staticHost:hostConfig.staticHost+"/api/Glodon",APIHost:hostConfig.APIHost,securityApi:hostConfig.securityApi,sdkUrl:null,staticPath:"/api/Glodon",useCustomResources:hostConfig.useCustomResources};for(let t in e)this[t]=e[t]}}}(),function(){let e=Object.freeze({ViewLoaded:"ViewLoaded",ViewLoading:"ViewLoading",ViewMoved:"ViewMoved",ViewZoomed:"ViewZoomed"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Viewer").ViewerPDFEvent=e}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Viewer"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.ClientHelper.isWebGLAvailable(),n=(Object.freeze({TranslucentOthers:"",HideOthers:""}),function(){let e=new Glodon$1.Web.Lang.EventManager;this.viewerType="Viewer",this.isFullScreen=!1,this._defaultUnit=void 0,skipVueObserver(this),this.getEventManager=function(){return e}});n.prototype.destroy=function(){this.getEventManager=null,this.authenticate=null},n.prototype.init=function(){},n.prototype.getViewerType=function(e){return this.viewerType},n.prototype.addView=function(e,t,n){if(!i)return;this.loadTime||(this.loadTime=(new Date).getTime());let o=this,s=Glodon$1.Bimface.Authentication.AuthenticationManager,r=(o._opt,new Glodon$1.Bimface.Authentication.AuthenticationConfig);r.viewToken=e,r.APIHost=this._opt.APIHost,r.enableStorage=this.enableStorage,r.securityApi=this._opt.securityApi,(this.authenticate=new s(r)).authenticate((function(e){"bimView"==e.renderType&&("pdf-transfer"!==e.workerType?e.renderType="3DView":e.renderType="pdfView"),o.loadViewCore(e,t,n)}),(function(e){var t=Glodon$1.Bimface.Viewer.Viewer3DEvent;o.getEventManager().fireEvent(t.Error,e)}))},n.prototype.loadViewCore=function(){},n.prototype.addEventListener=function(e,t,i){this.getEventManager().addEvent(e,t,i)},n.prototype.removeEventListener=function(e,t){this.getEventManager().removeEvent(e,t)},n.prototype.enableFullScreen=function(e){var t=this._opt.domElement,i=this;this.isFullScreen=e,e?Glodon$1.Web.Lang.Utility.FullScreen.fullScreen(t):Glodon$1.Web.Lang.Utility.FullScreen.exitFullScreen(),setTimeout((function(){i.resize()}),200)},n.prototype._loadNotSuportPromptPage=function(e){let i=t.create("div","bf-waring-container"),n=t.create("div","bf-waring"),o=t.create("span","bf-waring-icon"),s=t.create("span","bf-waring-text");s.innerText=BimfaceLanguage.bf_browser_notSupported,n.appendChild(o),n.appendChild(s),i.appendChild(n);let r=t.create("div","bf-suggestion");r.innerText=BimfaceLanguage.bf_browser_suggestion,i.appendChild(r);let a=t.create("div","bf-logo");i.appendChild(a),e.appendChild(i)},n.prototype.getUnit=function(){return"m"===this._defaultUnit?Glodon$1.Bimface.Common.Units.LengthUnits.Meter:Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter},n.prototype.getNetwork=function(){const e=window.performance;if(!e)return function(){console.log("您的浏览器不支持performance属性")};const t=[];function i(e,t){const i=e.timing,n={timing:e.timing};return n.redirectTime=i.redirectEnd-i.redirectStart,n.lookupDomainTime=i.domainLookupEnd-i.domainLookupStart,n.connectTime=i.connectEnd-i.connectStart,n.requestTime=i.responseEnd-i.responseStart,n.domReadyTime=i.domComplete-i.domInteractive,n.whiteTime=i.responseStart-i.navigationStart,n.domLoadTime=i.domContentLoadedEventEnd-i.navigationStart,n.loadTime=i.loadEventEnd-i.navigationStart,n.resourceTiming=function(e){const t={entries:e.length,transferSize:0,encodedBodySize:0,decodedBodySize:0};let i=1/0,n=-1/0;return e.forEach((e=>{void 0!==e.duration&&void 0!==e.startTime&&(i=Math.min(i,e.startTime),n=Math.max(n,e.startTime+e.duration)),e.transferSize&&(t.transferSize+=e.transferSize),e.encodedBodySize&&(t.encodedBodySize+=e.encodedBodySize),e.decodedBodySize&&(t.decodedBodySize+=e.decodedBodySize)})),t.transferSize&&(t.transferSize=t.transferSize/1048576),t.encodedBodySize&&(t.encodedBodySize=t.encodedBodySize/1048576),t.decodedBodySize&&(t.decodedBodySize=t.decodedBodySize/1048576),t.finishTime=8*Math.ceil((n-i)/8),t}(t),n.requests=n.resourceTiming.entries,n.transferred=n.resourceTiming.transferSize,n.resourcesSize=n.resourceTiming.decodedBodySize,n.finishTime=n.resourceTiming.finishTime,n}return new PerformanceObserver((e=>{for(let i of e.getEntries())t.push(i)})).observe({entryTypes:["resource","navigation","longtask"]}),function(){return i(e,t)}}(),e.Viewer=n}(),function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Viewer"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();class n extends e.Viewer{constructor(e){window.bimfaceSdkVersion&&(i.send("Glodon.Bimface.Viewer.ViewerPDF","sdkVersion"),delete window.bimfaceSdkVersion),super(),this._cloudViewer=CLOUD$1.PdfCore,this._opt=e,this._domElement=e.domElement,this._views={},this.setWorkerUrl(),this.setCMapUrl()}setWorkerUrl(){this._cloudViewer.setWorkerUrl(window.BimfaceLoaderConfig.fullStaticHost+"/bimface.pdf.worker.js")}setCMapUrl(){this._cloudViewer.setCMapUrl(window.BimfaceLoaderConfig.fullStaticHost+"/cmaps/")}loadViewCore(e,t,i){this._data=e,this._pdfName=e.name,this._loadPdf()}_loadPdf(){this._getManifest((i=>{this._pdfFileName=i.Metadata.Name;var n=new CLOUD$1.PdfCore.ViewConfig;n.domElement=this._domElement,n.pdfUrl=this._getPdfUrl();const o=CLOUD$1.PdfCore.addView(n);this._views[o]=CLOUD$1.PdfCore.views[o];let s=t.create("div","bf-loading");s.style.zIndex=100;let r=t.create("div","bf-loading-gif"),a=t.create("div","bf-loading-progress");a.innerText="0%",this._opt.useCustomResources&&(r.style.backgroundImage=`url(${hostConfig.staticHost}/resources/custom/loading.gif)`),s.appendChild(r),s.appendChild(a);let l=this._domElement.querySelector(".bf-pdf-outer");l.appendChild(s),this._views[o].eventBus.on(CLOUD$1.PdfCore.ViewEvent.ViewLoading,(t=>{this.getEventManager().fireEvent(e.ViewerPDFEvent.ViewLoading),a.innerText=t})),this._views[o].eventBus.on(CLOUD$1.PdfCore.ViewEvent.ViewLoaded,(()=>{this.getEventManager().fireEvent(e.ViewerPDFEvent.ViewLoaded),l.removeChild(s)})),this._views[o].eventBus.on(CLOUD$1.PdfCore.ViewEvent.ViewMoved,(t=>{this.getEventManager().fireEvent(e.ViewerPDFEvent.ViewMoved,t)})),this._views[o].eventBus.on(CLOUD$1.PdfCore.ViewEvent.ViewZoomed,(t=>{this.getEventManager().fireEvent(e.ViewerPDFEvent.ViewZoomed,t)})),void 0===this._defaultViewId&&(this._defaultViewId=o),void 0===this._view&&(this._view=this._views[this._defaultViewId])}))}_getPdfUrl(){const e=this._getMetaDataManager()._config.resourceHost,t=this._data.databagId;return this._pdfUrl=`${e}/${t}/${this._manifest.Metadata.Path}/${this._pdfFileName}`,this._pdfUrl}_getManifest(e){if(this._manifest)return void("[object Function]"===Object.prototype.toString.call(e)&&e(this._manifest));this._getMetaDataManager().getManifest((t=>{this._manifest=t,"[object Function]"===Object.prototype.toString.call(e)&&e(this._manifest)}))}_getMetaDataManager(){if(this._metaDataManager)return this._metaDataManager;const e=new Glodon$1.Bimface.Data.MetaDataManagerConfig;e.viewToken=this._data.viewToken,e.databagId=this._data.databagId,e.resourceHost=this._opt.resourceHost,e.APIHost=this._opt.APIHost;const t=new Glodon$1.Bimface.Data.MetaDataManager(e);return this._metaDataManager=t,t}getViewer(){return this._cloudViewer}getView(e){return void 0===e&&(e=this._defaultViewId),this._views[e]}getDomElement(){return this._domElement}getPageCount(){return this._view.numPages}getCurrentPageNo(){return this._view.currentPageNo}destroy(){for(let e in this._views)this._cloudViewer.removeView(e);this._views={},delete this._data,delete this._pdfName,delete this._pdfFileName,delete this._view,delete this._defaultViewId,delete this._pdfUrl,delete this._metaDataManager,delete this._manifest}load(e){this.addView(e)}setDragMode(e){this.getView(e).setDragMode()}setTextMode(e){this.getView(e).setTextMode()}zoomIn(e){this.getView(e).viewZoom.zoomIn()}zoomOut(e){this.getView(e).viewZoom.zoomOut()}setZoom(e,t){e=e||1,this.getView(t).viewZoom.setZoom(e)}nextPage(e){this.getView(e).viewPageTurning.nextPage()}previousPage(e){this.getView(e).viewPageTurning.previousPage()}turnToPage(e,t){e=e||1,this.getView(t).viewPageTurning.turnTo(e)}fullScreen(e){this.getView(e).viewFullScreen.fullScreen()}exitFullScreen(e){this.getView(e).viewFullScreen.exit()}worldToClient(e){var t=this.getView().toScreenPoint([e.x,e.y]);return{x:t[0],y:t[1]}}clientToWorld(e){var t=this.getView().toWorldPoint([e.x,e.y]);return{x:t[0],y:t[1]}}resize(){}getCurrentState(){var e={viewId:this._defaultViewId,currentPageNo:this.getView(this._defaultViewId).currentPageNo,zoom:this.getView(this._defaultViewId).viewZoom.zoom,marginTop:this.getView(this._defaultViewId).viewDrag.getMarginTop(),marginLeft:this.getView(this._defaultViewId).viewDrag.getMarginLeft()};return JSON.stringify(e)}setState(e){let{viewId:t,currentPageNo:i,zoom:n,marginTop:o,marginLeft:s}=JSON.parse(e);this.turnToPage(i),this.getView(t).viewZoom.setZoom(n),this.getView(t).viewDrag.setMarginTop(o),this.getView(t).viewDrag.setMarginLeft(s)}}e.ViewerPDF=n}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").MiniMapConfig=function(){return{name:"defaultMap",domElement:null,width:240,height:240,viewer:null,axis:!1,host:hostConfig.resourceHost,onCameraChanged:null,inMoveOnAxisGrid:null}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.HttpRequest")),i=function(e){var t=this,i=e;if(t._opt=i,!i.domElement)return console.log("domElement must not be empty."),!1;if(!i.viewer)return console.log("viewer is not defined."),!1;var n=i.viewer.getViewer();t._helper=new CLOUD$1.Extensions.MiniMapHelper(i.viewer.getViewer());n.addCallbacks("render",(function(){t._helper.renderMiniMap()})),t.init()};i.prototype={init:function(){var e=this,i=e._opt,n={},o=[];e._helper;t.ajax({url:`${i.host}/${i.viewer._data.databagId}/metadata/grids.json`,async:!1,success:function(e){for(var t=JSON.parse(e),i=[],o=0,s=t.grids.length;o<s;o++){var r=t.grids[o];r.start.X=r.start.x,r.start.Y=r.start.y,r.start.Z=r.start.z,r.end.X=r.end.x,r.end.Y=r.end.y,r.end.Z=r.end.z,i.push(r)}n.Grids=i}}),t.ajax({async:!1,url:`${i.host}/${i.viewer._data.databagId}/metadata/levels.json`,success:function(e){n.Levels=JSON.parse(e).levels}}),t.ajax({async:!1,url:`${i.host}/${i.viewer._data.databagId}/resource/model/maps/output.json`,dataType:"text",success:function(e){var t=JSON.parse(e);for(var n in t){var s=t[n];null==s.id&&(s.id=n),s.path=`${i.host}/${i.viewer._data.databagId}/resource/model/maps/${s.id}.png`,s.name=n,o.push(s)}}}),e._floors=o,e.createMap(n,o)},createMap:function(e,t){var i=this._helper,n=this._opt;i.createMiniMap(n.name,n.domElement,n.width,n.height,{left:0,bottom:0,outling:"none",position:"relative"},n.onCameraChanged,n.inMoveOnAxisGrid),e.Grids&&e.Levels&&i.setAxisGridData(n.name,e),t.length>0&&(i.setAllFloorPlaneData(n.name,t),i.setFloorPlaneId(n.name,t[0].name)),i.generateAxisGrid(n.name),i.generateFloorPlane(n.name,!1),i.showAxisGrid(n.name,n.axis),i.getMiniMap(n.name).setMapClickCallback((function(){}))},getFloors:function(){return this._floors},showAxisGrid:function(){this._helper.showAxisGrid(this._opt.name,!0)},hideAxisGrid:function(){this._helper.showAxisGrid(this._opt.name,!1)},showFloorById:function(e){var t=this,i=t._opt.name;t._helper.setFloorPlaneData(i,e),t._helper.generateFloorPlane(i,!0)},resize:function(e,t){this._helper.resize(this._opt.name,e,t)},onClick:function(e,t){var i=this._opt,n=(e=e||"default",this._helper.getMiniMap(i.name));n.setMapClickMode(e),n.setMapClickCallback((function(e){t&&"function"==typeof t&&t(e)}))},toLocation:function(e,t){var i=this._opt;this._helper.getMiniMap(i.name).toLocation(e,t)},imageCoord2WordCoord:function(e,t){var i=this._opt;return this._helper.getMiniMap(i.name).imageCoord2WordCoord({x:e,x:t})}},e.MiniMap=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Map").MapConfig=function(){return{id:"defaultMap",name:"defaultMap",domElement:null,viewer:null,width:240,height:240,isShowGrid:!1,navigationMode:"Default",resourceHost:hostConfig.resourceHost,loadAsync:!1}},function(){let e=Object.freeze({ViewerCameraChanged:"ViewerCameraChanged",MouseClicked:"MouseClicked",MouseHoveredGrid:"MouseHoveredGrid",SelectionChanged:"SelectionChanged",SelectionMoved:"SelectionMoved",SelectionEditor:"SelectionEditor",FloorPlaneChanged:"FloorPlaneChanged",Zoom:"Zoom"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Map").MapEvents=e}(),function(){let e=Object.freeze({Default:"Default",Static:"Static"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Map").MapNavigationMode=e}();var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var EditorName,DrawableItem=function(){function e(){this.xmlns="http://www.w3.org/2000/svg",this.material=null,this.svgNode=null,this.children=[],this.glodonColor="#11DAB7",this.position=new THREE.Vector2}return e.prototype.add=function(e){this.children.push(e)},e.prototype.getSvgNode=function(){return this.svgNode},e.prototype.abtainRenderables=function(e){e.appendChild(this.svgNode)},e.prototype.isMatch=function(e){return this.name==e},e.prototype.highlight=function(){this.svgNode.setAttribute("style","stroke:"+this.glodonColor)},e.prototype.cancelHighlight=function(){this.svgNode.setAttribute("style","stroke:"+this.material.color.getStyle())},e.prototype.locate=function(e,t){this.position.set(e,t),this.move(0,0)},e.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t;this.svgNode.setAttribute("transform","translate("+i+","+n+")")},e}(),Algorithm=function(){function e(){this._boxSize=new THREE.Vector2,this._boxCenter=new THREE.Vector2,this._intersect=new THREE.Vector3}return e.prototype.cross=function(e,t,i,n){return(t.x-e.x)*(n.y-i.y)-(t.y-e.y)*(n.x-i.x)},e.prototype.getArea=function(e,t,i){return this.cross(e,t,e,i)},e.prototype.getAbsArea=function(e,t,i){return Math.abs(this.getArea(e,t,i))},e.prototype.getInterPoint=function(e,t,i,n){var o=this.getAbsArea(e,t,i),s=this.getAbsArea(e,t,n);return new THREE.Vector2((n.x*o+i.x*s)/(o+s),(n.y*o+i.y*s)/(o+s))},e.prototype.isAngleGreaterThanPi=function(e,t,i){var n=new THREE.Vector3;return n.crossVectors(e,t),!(n.dot(i)>=0)},e.prototype.normalizedPointToScreen=function(e,t){e.x=e.x*t.width,e.y=-e.y*t.height},e.prototype.screenToNormalizedPoint=function(e,t){e.x=e.x/t.width,e.y=-e.y/t.height},e.prototype.normalizedPointToWorld=function(e,t){t.getSize(this._boxSize),e.x=.5*(e.x+1)*this._boxSize.x+t.min.x,e.y=.5*(e.y+1)*this._boxSize.y+t.min.y},e.prototype.worldToNormalizedPoint=function(e,t){t.getSize(this._boxSize),e.x=(e.x-t.min.x)/this._boxSize.x*2-1,e.y=(e.y-t.min.y)/this._boxSize.y*2-1},e.prototype.toWorldPoint=function(e,t,i,n){e.x<0&&(e.x=0),e.x>t&&(e.x=t),e.y<0&&(e.y=0),e.y>i&&(e.y=i),e.x=e.x/t*2-1,e.y=-e.y/i*2+1,this.normalizedPointToWorld(e,n)},e.prototype.getCuttingBoxOnCanvas=function(e,t,i,n){var o=new THREE.Box3,s=new THREE.Vector2(e.x,e.y),r=new THREE.Vector2(t.x,t.y);this.toWorldPoint(s,i[0],i[1],n),this.toWorldPoint(r,i[0],i[1],n);var a=[];return a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,s.y)),a.push(new THREE.Vector3(r.x,s.y)),o.setFromPoints(a),{min:{x:o.min.x,y:o.min.y,z:0},max:{x:o.max.x,y:o.max.y,z:0}}},e.prototype.canvasPointToClient=function(e,t){var i=t.mapContainer;if(!i||!t.floorPlaneBox)return null;var n=this.getContainerOffsetToClient(i);if(0===n.width||0===n.height)return null;var o=new THREE.Vector2;return o.x=e.x+n.left,o.y=e.y+n.top,o},e.prototype.getMainSceneMatrix=function(e){return e.getScene().getMatrixGlobal()},e.prototype.transformWorldPoint=function(e,t){var i=this.getMainSceneMatrix(e);e.miniMapTransform&&t.applyMatrix4((new THREE.Matrix4).fromArray(e.miniMapTransform)),t.applyMatrix4(i)},e.prototype.expandBbox=function(e,t){var i=e.getCenter(this._boxCenter);e.getSize(this._boxSize);var n=new THREE.Vector2,o=t,s=this._boxSize.x/this._boxSize.y,r=this._boxSize.x,a=this._boxSize.y;s>o?a=r/o:s<o&&(r=a*o),n.set(r,a),e.setFromCenterAndSize(i,n)},e.prototype.containsPointInMainScene=function(e,t){var i=e.getScene().getBoundingBoxWorld();return!!i&&i.containsPoint(t)},e.prototype.isMouseOverCanvas=function(e,t,i){if(e){var n=this.getContainerOffsetToClient(e),o=new THREE.Vector2;if(o.x=i.x-n.left,o.y=i.y-n.top,0===n.width||0===n.height)return!1;var s={width:t[0],height:t[0]};if(o.x>0&&o.x<s.width&&o.y>0&&o.y<s.height)return!0}return!1},e.prototype.normalizePoint=function(e,t,i){var n=new THREE.Vector2;if(e){var o=this.getContainerOffsetToClient(e),s=new THREE.Vector2;s.x=i.x-o.left,s.y=i.y-o.top;var r={width:t[0],height:t[1]};if(s.x>0&&s.x<r.width&&s.y>0&&s.y<r.height)return n.x=s.x/r.width*2-1,n.y=-s.y/r.height*2+1,new THREE.Vector2(n.x,n.y)}return null},e.getIntersectionByPoint=function(e,t,i){void 0===i&&(i=3);for(var n=null,o=i*i,s=0,r=e.length;s<r;s++){var a=e[s].intersectionPoint;if(a)if(a.distanceToSquared(t)<o){n=e[s];break}}return n},e.prototype.flyToPointWithParallelEye=function(e,t){e.cameraControl.flyToPointWithParallelEye(t)},e.prototype.getIntersectionToMinDistance=function(e,t){if(e.length<1)return null;for(var i=0,n=0,o=0,s=e.length;o<s;o++){var r=e[o];if(r.intersectionPoint){var a=new THREE.Vector2(r.intersectionPoint.x,r.intersectionPoint.y).distanceToSquared(t);0==i?i=a:i>a&&(i=a,n=o)}}return e[n]},e.prototype.getAxisGridInfoByNormalizedPoint=function(e,t){var i=t.clone(),n=e.naviData.getAxisGridBox2D();this.normalizedPointToWorld(i,n);var o=t.clone(),s={width:e.svgHalfWidth,height:e.svgHalfHeight};this.normalizedPointToScreen(o,s);var r=this.getIntersectionToMinDistance(e.naviData.getAxisGridIntersectionPoints(),o);if(r&&r.intersectionPoint){var a=new THREE.Vector2(r.intersectionPoint.x,r.intersectionPoint.y);this.screenToNormalizedPoint(a,s),this.normalizedPointToWorld(a,n);var l=Math.round(i.x-a.x),h=Math.round(i.y-a.y);return{position:i,abcName:r.abcName,numeralName:r.numeralName,offsetX:l,offsetY:h}}return{position:new THREE.Vector3,abcName:"",numeralName:"",offsetX:"",offsetY:""}},e.prototype.getAxisGridInfoByPoint=function(e,t){var i=this.getMainSceneMatrix(e.viewer),n=new THREE.Matrix4;n.copy(i).invert();var o=t.clone();o.applyMatrix4(n);var s=o.clone(),r={width:e.svgHalfWidth,height:e.svgHalfHeight},a=e.naviData.getAxisGridBox2D();this.worldToNormalizedPoint(s,a),this.normalizedPointToScreen(s,r);var l=this.getIntersectionToMinDistance(e.naviData.getAxisGridIntersectionPoints(),s);if(l&&l.intersectionPoint){var h=new THREE.Vector2(l.intersectionPoint.x,l.intersectionPoint.y);this.screenToNormalizedPoint(h,r),this.normalizedPointToWorld(h,a);var d=Math.round(o.x-h.x),c=Math.round(o.y-h.y);return{position:o,abcName:l.abcName,numeralName:l.numeralName,offsetX:d,offsetY:c}}return{position:new THREE.Vector3,abcName:"",numeralName:"",offsetX:"",offsetY:""}},e.prototype.calculateEdgePositionCameraOutBounds=function(e,t,i){var n=function(e,t){for(var i=!1,n=0,o=e.length;n<o;n++)if(this.isEqualBetweenPoints(t,e[n],this.epsilon)){i=!0;break}return i},o=i.clone();if(o.min.x-=.5,o.min.y-=.5,o.max.x+=.5,o.max.y+=.5,!o.containsPoint(e)){var s=[],r=new THREE.Vector3(e.x,e.y,0),a=new THREE.Ray(r,t),l=new THREE.Vector3(i.min.x,i.min.y,0),h=new THREE.Vector3(-1,0,0),d=new THREE.Plane;if(d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&s.push(this._intersect),l.set(i.max.x,i.max.y,0),h.set(-1,0,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&s.push(this._intersect),l.set(i.min.x,i.min.y,0),h.set(0,1,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&(n(this._intersect,s)||s.push(this._intersect)),l.set(i.max.x,i.max.y,0),h.set(0,1,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&(n(this._intersect,s)||s.push(this._intersect)),2!=s.length)return null;var c=s[0],u=s[1].clone().sub(c).normalize();return this.isEqualBetweenPoints(u,t,1e-5)?s[0]:s[1]}return null},e.prototype.getContainerOffsetToClient=function(e){var t,i;if(e!=document){var n=(i=e).getBoundingClientRect?function(e){var t=e.getBoundingClientRect(),i=document.body,n=document.documentElement,o=n.clientTop||i.clientTop,s=n.clientLeft||i.clientLeft,r=t.top-o,a=t.left-s;return{top:Math.round(r),left:Math.round(a)}}(i):function(e){for(var t=0,i=0;e;)t+=e.offsetTop,i+=e.offsetLeft,e=e.offsetParent;var n=document.body,o=document.documentElement;return{top:t-=window.pageYOffset||o.scrollTop||n.scrollTop,left:i-=window.pageXOffset||o.scrollLeft||n.scrollLeft}}(i);t={width:e.offsetWidth,height:e.offsetHeight,left:n.left,top:n.top}}else t={width:window.innerWidth,height:window.innerHeight,left:0,top:0};return t},e.prototype.isEqualBetweenPoints=function(e,t,i){i=i||1e-4;var n=e.x-t.x,o=e.y-t.y;return!(Math.sqrt(n*n+o*o)>i)},e}(),GridLine=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.start=t,s.end=i,s.material=n,s.name=o,s.build(),s}return __extends(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"line");e.setAttribute("x1",this.start.x),e.setAttribute("y1",this.start.y),e.setAttribute("x2",this.end.x),e.setAttribute("y2",this.end.y);var t=this.material;t instanceof THREE.LineBasicMaterial&&e.setAttribute("style","fill: none; stroke: "+t.color.getStyle()+"; stroke-width: "+t.linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.linecap+"; stroke-linejoin: "+t.linejoin),this.svgNode=e},t}(DrawableItem),GridLineArc=function(e){function t(t,i,n){var o=e.call(this)||this;return o.arcPoints=t,o.material=i,o.name=n,o.build(),o}return __extends(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"polyline");e.setAttribute("points",this.arcPoints.map((function(e){return e.x+","+e.y})).join(" "));var t=this.material;t instanceof THREE.LineBasicMaterial&&e.setAttribute("style","fill: none; stroke: "+t.color.getStyle()+"; stroke-width: "+t.linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.linecap+"; stroke-linejoin: "+t.linejoin),this.svgNode=e},t}(DrawableItem),TipText=function(e){function t(t,i){var n=e.call(this)||this;return n.center=t,n.literal=i,n.fontSize=8,n.textColor=new THREE.Color(.6,.6,.6),n.build(),n}return __extends(t,e),t.prototype.build=function(){var e=this.center.x,t=this.center.y;if("NaN"!=e.toString()&&"NaN"!=t.toString()){var i=document.createElementNS(this.xmlns,"text");i.setAttribute("style","font-size:"+this.fontSize+"px; fill: none; stroke: "+this.textColor.getStyle()+"; stroke-width: 1"),i.innerHTML=this.literal,i.textContent=this.literal,i.getBoundingClientRect();var n=e-3.5,o=t+2.8;this.svgNode=i,this.locate(n,o)}},t}(DrawableItem),AxisNotation=function(e){function t(t,i){var n=e.call(this)||this;return n.name=i,n.labelPoints=t,n.build(),n}return __extends(t,e),t.prototype.build=function(){var e=this;this.labelPoints.forEach((function(t){e.add(new TipText(t,e.name))}))},t.prototype.abtainRenderables=function(e){for(var t=0;t<this.children.length;t++){this.children[t].abtainRenderables(e)}},t.prototype.move=function(e,t){this.children.forEach((function(i){i.move(e,t)}))},t}(DrawableItem),AxisGrid=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.intersections=[],s.lineElements=[],s.horizLineElements=[],s.verticalLineElements=[],s.width=i[0],s.height=i[1],s.bIsShowAxisGrid=n,s.multiplyZoomFactor=o,s.algorithm=new Algorithm,s.materialGrid=new THREE.LineBasicMaterial({color:10066329,linewidth:.5}),s.children=[],s.resourceGrids=t,s.boundingBox=new THREE.Box2,s.realBoundingBox=new THREE.Box2,s.clipBox2D=new THREE.Box2(new THREE.Vector2(-s.width/2,-s.height/2),new THREE.Vector2(s.width/2,s.height/2)),s.axisGridNumberInterval=3,s.scratchVector=new THREE.Vector3,s.boxSize=new THREE.Vector2,s.isValid()&&s.build(),s}return __extends(t,e),t.prototype.build=function(){var e=this,t=this.getAxisGridBox(),i={width:this.width/2,height:this.height/2},n=function(n){var o=new THREE.Vector2(n.x,n.y);return e.algorithm.worldToNormalizedPoint(o,t),e.algorithm.normalizedPointToScreen(o,i),o},o=this.materialGrid;this.resourceGrids.forEach((function(t){var i=t.name,s=t.geometry,r=t.label;s.forEach((function(t){if("Line"===t.lineType){var s=t.startPoint,r=t.endPoint,a=n(s),l=n(r),h=l.clone().sub(a).normalize();e.add(new GridLine(a,l,o,i)),Math.abs(h.x)>=Math.abs(h.y)?e.horizLineElements.push({name:i,v1:a,v2:l,material:o}):e.verticalLineElements.push({name:i,v1:a,v2:l,material:o})}else if("Arc"===t.lineType){var d=t.points.map(n);e.add(new GridLineArc(d,o,i))}}));var a=r.positions.map(n);e.add(new AxisNotation(a,i))})),this.lineElements.push(this.horizLineElements),this.lineElements.push(this.verticalLineElements),this.calculateIntersections()},t.prototype.calculateAxisGridBox=function(e,t,i){var n=this;this.boundingBox.makeEmpty(),this.resourceGrids.forEach((function(e){e.geometry.forEach((function(e){if("Line"===e.lineType){var t=e.startPoint,i=e.endPoint,o=new THREE.Vector2(t.x,t.y),s=new THREE.Vector2(i.x,i.y);e.points=[o,s]}else if("Arc"===e.lineType){var r=window.CLOUD.AxisGridManager.getArcGridPoints(e);e.points=r}e.points.forEach((function(e){return n.boundingBox.expandByPoint(e)}))}))})),this.realBoundingBox=this.boundingBox.clone();var o=this.boundingBox.getCenter(this.scratchVector);this.boundingBox.getSize(this.boxSize);var s=new THREE.Vector2,r=e/t,a=this.boxSize.x/this.boxSize.y,l=this.boxSize.x,h=this.boxSize.y,d=4*(i+4)*this.multiplyZoomFactor;a>r?(this.bIsShowAxisGrid&&(l=this.boxSize.x*e/(e-d)),h=l/r):a<r&&(this.bIsShowAxisGrid&&(h=this.boxSize.y*t/(t-d)),l=h*r),s.set(l,h),this.boundingBox.setFromCenterAndSize(o,s)},t.prototype.getAxisGridBox=function(e){return this.isValid()&&this.calculateAxisGridBox(this.width,this.height,10),e?this.realBoundingBox:this.boundingBox},t.prototype.isEmpty=function(){return this.boundingBox.getSize(this.boxSize),0==this.boxSize.length()},t.prototype.isValid=function(){return!!this.resourceGrids},t.prototype.calculateIntersections=function(){for(var e,t,i,n,o,s,r,a,l=this.horizLineElements.length,h=this.verticalLineElements.length,d=0;d<l;d++){n=(e=this.horizLineElements[d]).name,o=e.v1.clone(),s=e.v2.clone();for(var c=0;c<h;c++){i=(t=this.verticalLineElements[c]).name,r=t.v1.clone(),a=t.v2.clone();var u=!1;r.x<=Math.max(o.x,s.x)&&r.x>=Math.min(o.x,s.x)&&o.y<=Math.max(r.y,a.y)&&o.y>=Math.min(r.y,a.y)&&(u=!0);var p=null;u&&(p=this.algorithm.getInterPoint(o,s,r,a)),this.intersections.push({intersectionPoint:p,horizLine:[o.clone(),s.clone()],verticalLine:[r.clone(),a.clone()],abcName:n,numeralName:i})}}},t.prototype.getIntersections=function(){return this.intersections},t.prototype.abtainRenderables=function(e){for(var t=0;t<this.children.length;t++){this.children[t].abtainRenderables(e)}},t.prototype.getGridLineByName=function(e){for(var t=this.children,i=0;i<t.length;i++){var n=t[i];if(n instanceof GridLine&&n.isMatch(e))return n}},t.prototype.move=function(e,t){this.children.forEach((function(i){i.move(e,t)}))},t}(DrawableItem),FloorPlane=function(e){function t(t,i,n){var o=e.call(this)||this;return o.imageUrl=t,o.width=i[0],o.height=i[1],o.offsetX=i[2],o.offsetY=i[3],o.isFlip=n,o.build(),o}return __extends(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"image");e.href.baseVal=this.imageUrl,e.setAttribute("herf",this.imageUrl),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("width",this.width+""),e.setAttribute("height",this.height+""),e.setAttribute("x",-.5*this.width+""),e.setAttribute("y",-.5*this.height+""),this.isFlip&&e.setAttribute("transform","scale(-1,1)"),this.svgNode=e,this.locate(this.offsetX,this.offsetY)},t.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t;return this.isFlip?this.svgNode.setAttribute("transform","translate("+i+", "+n+")\n scale("+"-1,1)"):this.svgNode.setAttribute("transform","translate("+i+","+n+")"),{x:i,y:n}},t}(DrawableItem);!function(e){e.Default="Editor",e.PICK_Editor="Pick",e.RECTPICK_Editor="RectPick",e.PAN_Editor="Pan",e.Zoom_Editor="Zoom"}(EditorName||(EditorName={}));var EventType,MouseEventType,Editor=function(){function e(){this.bIsMouseDown=!1,this.name=EditorName.Default}return e.prototype.onMouseDown=function(e){},e.prototype.onMouseMove=function(e){},e.prototype.onMouseUp=function(e){},e.prototype.onMouseWheel=function(e){},e.prototype.getName=function(){return this.name},e}();!function(e){e[e.RECTPICK_MOUSE_DOWN=1e3]="RECTPICK_MOUSE_DOWN",e[e.RECTPICK_MOUSE_MOVE=1001]="RECTPICK_MOUSE_MOVE",e[e.RECTPICK_MOUSE_UP=1002]="RECTPICK_MOUSE_UP",e[e.PICK_MOUSE_DOWN=2e3]="PICK_MOUSE_DOWN",e[e.PICK_MOUSE_MOVE=2001]="PICK_MOUSE_MOVE",e[e.PICK_MOUSE_UP=2002]="PICK_MOUSE_UP",e[e.Floor_Plane_Changed=3e3]="Floor_Plane_Changed",e[e.Floor_Plane_Changed_For_Panel=3001]="Floor_Plane_Changed_For_Panel",e[e.Resize=4e3]="Resize",e[e.Camera_Height_Changed=5e3]="Camera_Height_Changed",e[e.ZOOM_MOUSE_WHEEL=6e3]="ZOOM_MOUSE_WHEEL",e[e.PAN_MOUSE_MOVE=7e3]="PAN_MOUSE_MOVE",e[e.Minimap_Rect_Changed=8e3]="Minimap_Rect_Changed",e[e.Minimap_Rect_Destroyed=8001]="Minimap_Rect_Destroyed"}(EventType||(EventType={})),function(e){e[e.Left=0]="Left",e[e.Middle=1]="Middle",e[e.Right=2]="Right"}(MouseEventType||(MouseEventType={}));var VFSizeMode,EventManager=function(){function e(){this.eventDispatcher=new THREE.EventDispatcher}return e.prototype.addEventListener=function(e,t){this.eventDispatcher.addEventListener(e,t)},e.prototype.hasEventListener=function(e){this.eventDispatcher.hasEventListener(e)},e.prototype.removeEventListener=function(e,t){this.eventDispatcher.removeEventListener(e,t)},e.prototype.dispatchEvent=function(e){this.eventDispatcher.dispatchEvent(e)},e}();!function(e){e.Min="Min",e.Max="Max"}(VFSizeMode||(VFSizeMode={}));var ZoomEditor=function(e){function t(t,i){var n=e.call(this)||this;return n.totalZoomFactors=[],n.zoomFactors=[],n.lastZoomFactor=1,n.currentIdx=0,n.name=EditorName.Zoom_Editor,n.eventManager=i,n.vfData=t.getData(),n.vfViewer=t,n}return __extends(t,e),t.prototype.onMouseWheel=function(e){var t=(e.deltaY||-e.wheelDelta||e.detail)<0,i=-1;if(t?this.currentIdx<this.zoomFactors.length-1&&(this.currentIdx++,i=this.zoomFactors[this.currentIdx]):this.currentIdx>0&&(this.currentIdx--,i=this.zoomFactors[this.currentIdx]),!(i<0||this.lastZoomFactor==i)){this.lastZoomFactor=i,1==i&&PanEditor.clear();var n=this.vfData.getOriginSize(),o=new THREE.Vector2(e.offsetX-n[0]/2,e.offsetY-n[1]/2),s=this.zoomFactors[this.currentIdx],r=0,a=0;if(t){var l=s/(u=this.zoomFactors[this.currentIdx-1]),h=[],d=this.vfData.getCorner("Virtual","LB");d[0]-=o.x,d[1]-=o.y,h.push(d[0]*l+o.x),h.push(d[1]*l+o.y),this.vfData.setZoomFactor(s);var c=this.vfData.getCorner("Virtual","LB");this.vfData.setZoomFactor(u),r=h[0]-c[0],a=h[1]-c[1]}else{var u=this.zoomFactors[this.currentIdx+1],p=this.boundsChecking(s,u,o);r=p[0],a+=p[1]}PanEditor.panOffsetX+=r,PanEditor.panOffsetY+=a,PanEditor.panOffsetXForCamera+=r,PanEditor.panOffsetYForCamera+=a,this.vfData.setZoomFactor(i),this.vfViewer.destroy(),this.vfData.destroy(),this.vfData.build(),this.vfViewer.update(),this.vfData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType.ZOOM_MOUSE_WHEEL,data:{offsetX:PanEditor.panOffsetX,offsetY:PanEditor.panOffsetY,zoomFactor:i}})}},t.prototype.boundsChecking=function(e,t,i){var n=e/t,o=this.vfData.getCorner("Virtual","LB"),s=this.vfData.getCorner("Virtual","LT"),r=this.vfData.getCorner("Virtual","RT"),a=this.vfData.getCorner("Virtual","RB"),l=[0,0],h=(o[0]-i.x)*n+i.x,d=(o[1]-i.y)*n+i.y;this.vfData.setZoomFactor(e);var c=this.vfData.getCorner("Virtual","LB");this.vfData.setZoomFactor(t),l[0]=h-c[0],l[1]=d-c[1];var u=0,p=0,g=this.vfData.getCorner("Origin","LB");h>g[0]&&(l[0]+=g[0]-h,u++),d<g[1]&&(l[1]+=g[1]-d,p++),h=(s[0]-i.x)*n+i.x,d=(s[1]-i.y)*n+i.y;var m=this.vfData.getCorner("Origin","LT");h>m[0]&&0==u&&(l[0]+=m[0]-h,u++),d>m[1]&&0==p&&(l[1]+=m[1]-d,p++),h=(r[0]-i.x)*n+i.x,d=(r[1]-i.y)*n+i.y;var f=this.vfData.getCorner("Origin","RT");h<f[0]&&0==u&&(l[0]+=f[0]-h,u++),d>f[1]&&0==p&&(l[1]+=f[1]-d,p++),h=(a[0]-i.x)*n+i.x,d=(a[1]-i.y)*n+i.y;var w=this.vfData.getCorner("Origin","RB");return h<w[0]&&0==u&&(l[0]+=w[0]-h,u++),d<w[1]&&0==p&&(l[1]+=w[1]-d,p++),l},t.prototype.enableMode=function(e){if(e==VFSizeMode.Min)this.zoomFactors=this.totalZoomFactors;else if(e==VFSizeMode.Max){this.zoomFactors=this.totalZoomFactors.slice(1,this.totalZoomFactors.length);for(var t=1;t<this.zoomFactors.length;t++)this.zoomFactors[t]/=this.zoomFactors[0];this.zoomFactors[0]=1}this.currentIdx=0},t.prototype.setZoomFactors=function(e){this.totalZoomFactors=e,this.zoomFactors=e},t.prototype.setZoonIndex=function(e){this.currentIdx=e},t.prototype.getZoonIndex=function(){return this.currentIdx},t.prototype.updateZoomAndPan=function(){var e=this.vfData.getCorner("Origin","LT"),i=this.vfData.getCorner("Virtual","LT");t.offsetXForZoomAndPan=e[0]-i[0],t.offsetYForZoomAndPan=e[1]-i[1]},t.clear=function(){t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0},t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0,t}(Editor),PanEditor=function(e){function t(i,n){var o=e.call(this)||this;return o.name=EditorName.PAN_Editor,o.eventManager=n,o.vfData=i.getData(),o.bIsMouseDown=!1,o.mouseDownPos=new THREE.Vector2,t.panOffsetX=0,t.panOffsetY=0,o}return __extends(t,e),t.prototype.onMouseDown=function(e){this.bIsMouseDown=!0,this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)},t.prototype.onMouseMove=function(e){if(0!=this.bIsMouseDown&&1!=this.vfData.getZoomFactor()){var i=e.clientX-this.mouseDownPos.x,n=e.clientY-this.mouseDownPos.y,o=this.boundsChecking(i,n);i=o[0],n=o[1],t.panOffsetX+=i,t.panOffsetY+=n,t.panOffsetXForCamera+=i,t.panOffsetYForCamera+=n,this.vfData.updateMovement(),this.updateZoomAndPan(),this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)}},t.prototype.onMouseUp=function(e){if(0!=this.bIsMouseDown&&1!=this.vfData.getZoomFactor()){var i=e.clientX-this.mouseDownPos.x,n=e.clientY-this.mouseDownPos.y,o=this.boundsChecking(i,n);i=o[0],n=o[1],t.panOffsetX+=i,t.panOffsetY+=n,t.panOffsetXForCamera+=i,t.panOffsetYForCamera+=n,this.vfData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType.PAN_MOUSE_MOVE,data:{offsetX:t.panOffsetX,offsetY:t.panOffsetY,zoomFactor:this.vfData.getZoomFactor()}}),this.bIsMouseDown=!1}},t.prototype.boundsChecking=function(e,t){var i=this.vfData.getCorner("Origin","LB"),n=this.vfData.getCorner("Virtual","LB"),o=this.vfData.getCorner("Origin","RT"),s=this.vfData.getCorner("Virtual","RT");if(e>0)(r=i[0]-n[0])<=e&&(e=r);else if(e<0){var r;(r=o[0]-s[0])>=e&&(e=r)}if(t<0)(a=i[1]-n[1])>=t&&(t=a);else if(t>0){var a;(a=o[1]-s[1])<=t&&(t=a)}return[e,t]},t.prototype.updateZoomAndPan=function(){var e=this.vfData.getCorner("Origin","LT"),t=this.vfData.getCorner("Virtual","LT");ZoomEditor.offsetXForZoomAndPan=e[0]-t[0],ZoomEditor.offsetYForZoomAndPan=e[1]-t[1]},t.clear=function(){t.panOffsetX=0,t.panOffsetY=0,t.panOffsetXForCamera=0,t.panOffsetYForCamera=0},t}(Editor),CameraNode=function(e){function t(){var t=e.call(this)||this;return t.cameraCircleNode=null,t.cameraArrowNode=null,t.rotateAngle=0,t.panelSize=[298,198],t.cameraPositionToTarget=2e3,t.build(),t}return __extends(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"g");e.setAttribute("fill","none"),e.setAttribute("fill-rule","evenodd"),e.setAttribute("stroke-width","1");var t=document.createElementNS(this.xmlns,"circle");t.setAttribute("r","4.5"),t.setAttribute("stroke","#FFFFFF"),t.setAttribute("fill","#32D3A6"),this.cameraCircleNode=t;var i=document.createElementNS(this.xmlns,"path");i.setAttribute("d","M5.94925387,0 C18.4132389,0 28.6581001,9.50119823 29.8362478,21.6560048 L5.94925387,25 Z"),i.setAttribute("fill","url(#radialGradient-1)"),i.setAttribute("transform","translate(13,-21)rotate(50)"),this.cameraArrowNode=i;var n=document.createElementNS(this.xmlns,"defs"),o=document.createElementNS(this.xmlns,"radialGradient"),s=document.createElementNS(this.xmlns,"stop"),r=document.createElementNS(this.xmlns,"stop");o.setAttribute("cx","0%"),o.setAttribute("cy","100%"),o.setAttribute("fx","0%"),o.setAttribute("fy","100%"),o.setAttribute("r","104.321936%"),o.setAttribute("id","radialGradient-1"),s.setAttribute("stop-color","#36D4A8"),s.setAttribute("offset","0%"),r.setAttribute("stop-color","#36D4A8"),r.setAttribute("offset","100%"),r.setAttribute("stop-opacity","0"),n.append(o),o.append(s),o.append(r),e.appendChild(n),e.appendChild(t),e.appendChild(i),this.svgNode=e},t.prototype.setCircleAttribute=function(e,t){this.cameraCircleNode.setAttribute(e,t)},t.prototype.setArrowAttribute=function(e,t){this.cameraArrowNode.setAttribute(e,t)},t.prototype.rotate=function(e){e&&(this.rotateAngle=e);var t=this.svgNode.getAttribute("transform");t+="rotate("+this.rotateAngle+")",this.svgNode.setAttribute("transform",t)},t.prototype.setOffsetAndRotate=function(e,t,i){var n=this.setOffsetBoundary(e,t);this.locate(n.X,n.Y),this.rotate(i),PanEditor.panOffsetXForCamera=0,PanEditor.panOffsetYForCamera=0},t.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t,o=this.setOffsetBoundary(i,n);this.svgNode.setAttribute("transform","translate("+o.X+","+o.Y+")")},t.prototype.setOpacity=function(e){this.svgNode.setAttribute("opacity",e)},t.prototype.setCameraArrowOpacity=function(e){this.cameraArrowNode.setAttribute("opacity",e)},t.prototype.setCameraCircleOpacity=function(e){this.cameraCircleNode.setAttribute("opacity",e)},t.prototype.setBigCamera=function(){this.cameraCircleNode.setAttribute("r","4.5"),this.cameraArrowNode.setAttribute("transform","translate(13,-21)rotate(50)")},t.prototype.setSmallCamera=function(){this.cameraCircleNode.setAttribute("r","2"),this.cameraArrowNode.setAttribute("transform","translate(20,-21)rotate(50)")},t.prototype.setPanelSize=function(e){this.panelSize=e},t.prototype.setOffsetBoundary=function(e,t){var i=this.panelSize[0]/2-6,n=-this.panelSize[0]/2+6,o=this.panelSize[1]/2-6,s=-this.panelSize[1]/2+6;return e>=i||e<=n||t>=o||t<=s?this.setSmallCamera():this.setBigCamera(),e>i&&(e=i),e<n&&(e=n),t>o&&(t=o),t<s&&(t=s),{X:e,Y:t}},t}(DrawableItem),AxisGrids=function(){function e(e){this.resourceGrids=e,this.floorPlaneBox=new THREE.Box2}return e.prototype.get=function(){return this.resourceGrids},e}(),Levels=function(){function e(e){this.resourceLevels=e,this.elevations=[],this.offsetForPlane=235,this.createElevationsInOrder()}return e.prototype.createElevationsInOrder=function(){var e=this.resourceLevels;for(var t in e)null!=e[t].elevation&&this.elevations.push(e[t].elevation);this.elevations.sort((function(e,t){return e-t})),this.elevations[this.elevations.length-1]-this.elevations[0]<this.offsetForPlane&&(this.offsetForPlane/=1e3)},e.prototype.getMinMaxElevations=function(e){var t=[0,0],i=this.resourceLevels;for(var n in i)if(i[n].name==e){t[0]=i[n].elevation-this.offsetForPlane,t[1]=i[n].elevation;break}for(var o=0;o<this.elevations.length;o++)if(this.elevations[o]-t[0]-this.offsetForPlane>1e-6){t[1]=this.elevations[o],t[1]-=this.offsetForPlane;break}return t},e.prototype.getElevation=function(e,t){for(var i=this.resourceLevels,n=0;n<i.length;n++){var o=i[n];if(o.id==e&&(!t||o.modelId==t))return o.elevation}},e.prototype.getElevationsInOrder=function(){return this.elevations},e.prototype.getLevelIdByElevation=function(e){for(var t=this.resourceLevels,i=0;i<t.length;i++){var n=t[i];if(n.elevation==e)return n.id}},e}(),FloorPlanes=function(){function e(e){this.resourcePlanes=e}return e.prototype.find=function(e,t){for(var i=0;i<this.resourcePlanes.length;i++){var n=this.resourcePlanes[i];if(t){if(n.modelId==t&&n.id==e)return n}else if(n.id==e)return n}},e.prototype.getFloorPlaneBox=function(e,t){var i=this.find(e,t);return i?i.boundingBox||i.BoundingBox:void 0},e.prototype.getUrl=function(e,t){var i=this.find(e,t);return i?i.path||i.Path:void 0},e.prototype.getElevation=function(e,t){var i=this.find(e,t);return i?i.Elevation:void 0},e.prototype.getName=function(e,t){var i=this.find(e,t);return i?i.name||i.Name:void 0},e}(),HighlightPoint=function(e){function t(t,i){var n=e.call(this)||this;return n.radius=t,n.material=i,n.build(),n}return __extends(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"circle");e.setAttribute("r",this.radius+""),e.setAttribute("fill",this.glodonColor),e.setAttribute("style","fill: none; stroke: "+this.glodonColor),e.setAttribute("opacity","0"),this.svgNode=e},t.prototype.highlight=function(){this.svgNode.setAttribute("style","stroke:"+this.glodonColor),this.svgNode.setAttribute("opacity","1")},t.prototype.cancelHighlight=function(){this.svgNode.setAttribute("style","stroke:rgb(153,153,153)"),this.svgNode.setAttribute("opacity","0")},t.prototype.setOffset=function(e,t){this.svgNode.setAttribute("transform","translate("+e+","+t+")")},t}(DrawableItem),TipNode=function(e){function t(){var t=e.call(this)||this;return t.tipNodeBackgroundColor="#fff",t.tipNodeColor="#000",t.initialize(),t.build(),t}return __extends(t,e),t.prototype.initialize=function(){var e=".cloud-tip:after { box-sizing: border-box;display: inline;font-size: 10px;width: 100%;line-height: 1;color: "+this.tipNodeBackgroundColor+";content: '\\25BC';position: absolute;text-align: center;margin: -4px 0 0 0;top: 100%;left: 0;}";this.loadStyleString(e)},t.prototype.loadStyleString=function(e){var t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t)},t.prototype.build=function(){var e=document.createElement("div");e.className="cloud-tip",e.style.position="absolute",e.style.opacity="0",e.style.background=this.tipNodeBackgroundColor,e.style.color=this.tipNodeColor,e.style.padding="0 8px 0 8px",e.style.borderRadius="2px",e.style.fontSize="8px",e.style.zIndex="10",this.svgNode=e},t.prototype.show=function(){this.svgNode.style.opacity=1,this.svgNode.className="cloud-tip"},t.prototype.hide=function(){this.svgNode.style.opacity=0,this.svgNode.className=""},t.prototype.setContent=function(e){this.svgNode.innerHTML=e},t.prototype.setOffset=function(e,t){var i=this.svgNode.getBoundingClientRect();this.svgNode.style.left=e[0]/2+t[0]-.5*i.width+"px",this.svgNode.style.top=e[1]/2+t[1]-i.height-12+"px"},t}(DrawableItem),ViewerFloorData=function(){function e(){this.zoomFactor=1,this.bboxLengthStages=[15e4,3e5],this.zoomFactors1=[1,7/4,2.5,10/3],this.zoomFactors2=[1,7/4,2.5,14/3,65/12,20/3],this.zoomFactors3=[1,7/4,2.5,10/3,14/3,65/12,20/3,49/6,10],this.needFlip=!1,this.floorPlaneId=null,this.drawableItems=[],this.width=298,this.height=198,this.bIsShowAxisGrid=!1,this.bIsShowCameraNode=!0,this.bIsShowFloorPlane=!0,this.floorPlaneBox=new THREE.Box3,this.axisGridNode=null,this.cameraNode=null,this.floorPlaneNode=null,this.algorithm=new Algorithm,this.glodonColor="#11DAB7",this.scratchVector=new THREE.Vector2,this.scratchVector_2=new THREE.Vector2,this.scratchVector_3=new THREE.Vector2,this.scratchVector_4=new THREE.Vector2,this.axisGridBoxSize=new THREE.Vector2,this.floorPlaneBox2DSize=new THREE.Vector2}return e.prototype.setAxisGrids=function(e){this.dataAxisGrid=new AxisGrids(e.Grids),this.dataLevels=new Levels(e.Levels)},e.prototype.setPlanes=function(e){this.dataFloorPlanes=new FloorPlanes(e)},e.prototype.setFloorPlaneId=function(e,t){this.floorPlaneId=e,this.modelId=t,this.build()},e.prototype.setFlip=function(e){this.needFlip=e},e.prototype.getFloorPlaneId=function(){return this.floorPlaneId},e.prototype.getFloorPlaneBox=function(){var e=this.dataFloorPlanes.getFloorPlaneBox(this.floorPlaneId,this.modelId),t=this.dataFloorPlanes.getName(this.floorPlaneId,this.modelId),i=this.dataLevels.getMinMaxElevations(t);return e&&(this.floorPlaneBox.min=new THREE.Vector3(e.Min.X||e.Min.x,e.Min.Y||e.Min.y,i[0]),this.floorPlaneBox.max=new THREE.Vector3(e.Max.X||e.Max.x,e.Max.Y||e.Max.y,i[1])),this.floorPlaneBox},e.prototype.setSize=function(e,t){this.width=e,this.height=t},e.prototype.getSize=function(){return[this.width*this.zoomFactor,this.height*this.zoomFactor]},e.prototype.getOriginSize=function(){return[this.width,this.height]},e.prototype.getGlodonColor=function(){return this.glodonColor},e.prototype.build=function(){var e=!!this.dataAxisGrid&&this.dataAxisGrid.get();if(this.axisGridNode=new AxisGrid(e,this.getSize(),this.bIsShowAxisGrid,this.getZoomFactor()),this.axisGridNode.isEmpty()&&(this.bIsShowAxisGrid=!1),this.bIsShowAxisGrid&&this.drawableItems.push(this.axisGridNode),this.buildFloorPlane(),this.bIsShowCameraNode){this.cameraNode=new CameraNode;var t=this.getOriginSize();this.cameraNode.setPanelSize(t),this.drawableItems.push(this.cameraNode)}this.intersectPoint=new HighlightPoint(3),this.drawableItems.push(this.intersectPoint),this.tipNode=new TipNode,this.drawableItems.push(this.tipNode)},e.prototype.buildFloorPlane=function(){if(this.bIsShowFloorPlane){var e=this.getFloorPlaneBox();this.getAxisGridBox2D().containsBox(e)||console.warn("the bounding-box of axis-grid is not contains the bounding-box of floor-plane!");var t=this.getFloorPlaneParams();this.floorPlaneNode=new FloorPlane(this.dataFloorPlanes.getUrl(this.floorPlaneId,this.modelId),t,this.needFlip),this.drawableItems.push(this.floorPlaneNode)}},e.prototype.getFloorPlaneParams=function(){var e=this.getFloorPlaneBox(),t=this.getAxisGridBox2D(),i=new THREE.Box2(new THREE.Vector2(e.min.x,e.min.y),new THREE.Vector2(e.max.x,e.max.y)),n=this.getSize()[0],o=n/this.getSize()[1];t.getSize(this.axisGridBoxSize),this.axisGridBoxSize.x/this.axisGridBoxSize.y!=o&&(this.algorithm.expandBbox(t,o),t.getSize(this.axisGridBoxSize));var s=[],r=n/this.axisGridBoxSize.x;i.getSize(this.floorPlaneBox2DSize);var a=this.floorPlaneBox2DSize.x*r,l=this.floorPlaneBox2DSize.y*r;s.push(a,l);var h=i.getCenter(this.scratchVector).clone().sub(t.getCenter(this.scratchVector_2));return h.x*=r,h.y*=-r,s.push(h.x,h.y),s},e.prototype.updateFloorPlane=function(e){for(var t=this.dataLevels.getElevationsInOrder(),i=this.getElevationById(),n=void 0,o=void 0,s=0;s<t.length;s++){if((r=t[s])>e){o=r;break}}for(s=t.length-1;s>=0;s--){var r;if((r=t[s])<e){n=r;break}}if(null==n){var a=this.dataLevels.getLevelIdByElevation(o);return this.floorPlaneId=a,!0}if(null==o){a=this.dataLevels.getLevelIdByElevation(n);return this.floorPlaneId=a,!0}if(i>=n&&i<o)return!1;a=this.dataLevels.getLevelIdByElevation(n);return this.floorPlaneId=a,!0},e.prototype.getDataFloorPlanes=function(){return this.dataFloorPlanes},e.prototype.getAxisGridBox2D=function(e){var t=this.axisGridNode.getAxisGridBox(e);if(0==t.getSize(this.axisGridBoxSize).length()){var i=this.getFloorPlaneBox();if(e)return i;var n=(new THREE.Box2).set(new THREE.Vector2(i.min.x,i.min.y),new THREE.Vector2(i.max.x,i.max.y)),o=n.getCenter(this.scratchVector);n.getSize(this.scratchVector_4);var s=new THREE.Vector2,r=this.width/this.height,a=this.scratchVector_4.x/this.scratchVector_4.y,l=this.scratchVector_4.x,h=this.scratchVector_4.y;return a>r?h=l/r:a<r&&(l=h*r),s.set(l,h),n.setFromCenterAndSize(o,s),n}return t},e.prototype.getDrawableItems=function(){return this.drawableItems},e.prototype.destroy=function(){this.drawableItems=[]},e.prototype.setIsShowAxisGrid=function(e){this.bIsShowAxisGrid=e},e.prototype.getCameraNode=function(){for(var e=this.drawableItems,t=0;t<e.length;t++){var i=e[t];if(i instanceof CameraNode)return i}},e.prototype.getElevationById=function(){return this.dataLevels.getElevation(this.floorPlaneId,this.modelId)},e.prototype.updateMovement=function(){this.getFloorPlaneNode().move(PanEditor.panOffsetX,PanEditor.panOffsetY);var e=this.getAxisGridNode();e&&e.move(PanEditor.panOffsetX,PanEditor.panOffsetY);var t=this.getCameraNode();t.move(PanEditor.panOffsetXForCamera,PanEditor.panOffsetYForCamera),t.rotate()},e.prototype.getCorner=function(e,t){var i=[],n=[];"Origin"==e?(i=[0,0],n=this.getOriginSize()):"Virtual"==e&&(i=[PanEditor.panOffsetX,PanEditor.panOffsetY],n=this.getSize());var o=0,s=0;switch(t){case"LB":o=i[0]-n[0]/2,s=i[1]+n[1]/2;break;case"LT":o=i[0]-n[0]/2,s=i[1]-n[1]/2;break;case"RT":o=i[0]+n[0]/2,s=i[1]-n[1]/2;break;case"RB":o=i[0]+n[0]/2,s=i[1]+n[1]/2;break;default:console.log("CornerName is wrong.")}return[o,s]},e.prototype.getIntersections=function(){return this.axisGridNode.getIntersections()},e.prototype.getGridLineByName=function(e){return this.axisGridNode.getGridLineByName(e)},e.prototype.getTipNode=function(){return this.tipNode},e.prototype.getFloorPlaneNode=function(){return this.floorPlaneNode},e.prototype.getAxisGridNode=function(){return 0==this.bIsShowAxisGrid?null:this.axisGridNode},e.prototype.getIntersectPoint=function(){return this.intersectPoint},e.prototype.setZoomFactor=function(e){this.zoomFactor=e},e.prototype.getZoomFactor=function(){return this.zoomFactor},e.prototype.getProperZoomFactors=function(){this.getAxisGridBox2D(!0).getSize(this.scratchVector_3);var e=Math.max(this.scratchVector_3.x,this.scratchVector_3.y);return e<=this.bboxLengthStages[0]?this.zoomFactors1:e<=this.bboxLengthStages[1]?this.zoomFactors2:this.zoomFactors3},e}(),ViewerFloorView=function(){function e(e,t,i){this.viewer=e,this.domContainer=t,this.viewerFloorData=i,this.width=298,this.height=198,this.manHeight=e._manHeight,this.algorithm=new Algorithm,this.eventManager=null,this.currentFloorName=null,this.bBoxCenter=new THREE.Vector2,this.projectedCameraPosition=new THREE.Vector3,this.projectedTargetPosition=new THREE.Vector3,this.sceneMatrixInverse=new THREE.Matrix4,this.initialize()}return e.prototype.initialize=function(){var e="http://www.w3.org/2000/svg";this.drawableContainer=document.createElementNS(e,"svg"),this.drawableContainer.setAttribute("width",this.width+""),this.drawableContainer.setAttribute("height",this.height+""),this.drawableContainer.setAttribute("viewBox",-this.width/2+" "+-this.height/2+" "+this.width+" "+this.height),this.drawableContainer.style.position="absolute",this.auxContainer=document.createElementNS(e,"svg"),this.auxContainer.setAttribute("width",this.width+""),this.auxContainer.setAttribute("height",this.height+""),this.auxContainer.setAttribute("viewBox",-this.width/2+" "+-this.height/2+" "+this.width+" "+this.height),this.auxContainer.style.position="absolute",this.mapContainer=document.createElement("div"),this.mapContainer.style.left="0px",this.mapContainer.style.bottom="0px",this.mapContainer.style.position="relative",this.mapContainer.outling="none",this.mapContainer.appendChild(this.drawableContainer),this.mapContainer.appendChild(this.auxContainer),this.domContainer.appendChild(this.mapContainer),this.cameraHeightChangedCallbackBinded=this.cameraHeightChangedCallback.bind(this)},e.prototype.cameraHeightChangedCallback=function(e){var t=e.cameraPosition,i=this.viewer.getScene().getMatrixGlobal();this.sceneMatrixInverse.copy(i).invert();var n=t.clone().applyMatrix4(this.sceneMatrixInverse);if(this.viewerFloorData.getAxisGridBox2D().containsPoint(new THREE.Vector2(n.x,n.y))&&this.viewerFloorData.updateFloorPlane(n.z)){var o=this.viewerFloorData.getDataFloorPlanes().getName(this.viewerFloorData.getFloorPlaneId());o&&this.currentFloorName!=o&&(this.currentFloorName=o,this.eventManager.dispatchEvent({type:EventType.Camera_Height_Changed,id:this.viewerFloorData.getFloorPlaneId()}),console.log("Current floor plane is "+o))}},e.prototype.getMapContainer=function(){return this.drawableContainer},e.prototype.getDomContainer=function(){return this.mapContainer},e.prototype.getAuxContainer=function(){return this.auxContainer},e.prototype.getViewer=function(){return this.viewer},e.prototype.getData=function(){return this.viewerFloorData},e.prototype.setSize=function(e,t){this.mapContainer.style.width=e+"px",this.mapContainer.style.height=t+"px",this.drawableContainer.setAttribute("width",e+""),this.drawableContainer.setAttribute("height",t+""),this.drawableContainer.setAttribute("viewBox",-e/2+" "+-t/2+" "+e+" "+t),this.auxContainer.setAttribute("width",e+""),this.auxContainer.setAttribute("height",t+""),this.auxContainer.setAttribute("viewBox",-e/2+" "+-t/2+" "+e+" "+t),this.destroy(),this.viewerFloorData.destroy(),this.viewerFloorData.build(),this.update(),this.eventManager.dispatchEvent({type:EventType.Resize,size:{width:e,height:t}})},e.prototype.destroy=function(){for(var e=this.drawableContainer;e.children.length>0;){var t=e.children[0];e.removeChild(t)}this.mapContainer.removeChild(e);var i=this.getData().getTipNode();i&&null!=i.getSvgNode().parentNode&&this.mapContainer.removeChild(i.getSvgNode())},e.prototype.updateCameraNode=function(e){var t=this.viewer,i=t.camera,n=t.cameraControl;if(i&&n){var o=i.position,s=i.target,r=this.algorithm.getMainSceneMatrix(t),a=new THREE.Matrix4;a.copy(r).invert();var l=this.viewerFloorData.getFloorPlaneBox();l.getCenter(this.bBoxCenter);var h=new THREE.Vector3(l.min.x,l.min.y,this.bBoxCenter.z).applyMatrix4(r),d=new THREE.Vector3(l.min.x,l.max.y,this.bBoxCenter.z).applyMatrix4(r),c=new THREE.Vector3(l.max.x,l.min.y,this.bBoxCenter.z).applyMatrix4(r),u=new THREE.Plane;u.setFromCoplanarPoints(h,d,c),u.projectPoint(o,this.projectedCameraPosition),this.projectedCameraPosition.applyMatrix4(a),t.miniMapTransform&&this.projectedCameraPosition.applyMatrix4((new THREE.Matrix4).fromArray(t.miniMapTransform).invert()),u.projectPoint(s,this.projectedTargetPosition),this.projectedTargetPosition.applyMatrix4(a),t.miniMapTransform&&this.projectedTargetPosition.applyMatrix4((new THREE.Matrix4).fromArray(t.miniMapTransform).invert());var p=this.projectedTargetPosition.clone().sub(this.projectedCameraPosition);p.z=0,p.normalize();var g=o.clone();g.applyMatrix4(a),t.miniMapTransform&&g.applyMatrix4((new THREE.Matrix4).fromArray(t.miniMapTransform).invert()),e&&(g=e.globalUnitUtil.revertVector(g));var m=g.clone(),f=this.viewerFloorData.getSize(),w={width:f[0]/2,height:f[1]/2},v=this.viewerFloorData.getAxisGridBox2D();this.algorithm.worldToNormalizedPoint(m,v),this.algorithm.normalizedPointToScreen(m,w);var y=this.viewerFloorData.getCameraNode();if(y.setOpacity("1.0"),p.length()<1e-5)y.setCameraArrowOpacity("0.0"),y.setOffsetAndRotate(m.x+PanEditor.panOffsetX,m.y+PanEditor.panOffsetY,0);else{var b=new THREE.Vector3(0,0,1),E=new THREE.Vector3(1,0,0),x=this.algorithm.isAngleGreaterThanPi(E,p,b),C=THREE.Math.radToDeg(E.angleTo(p));x||(C*=-1),y.setBigCamera(),y.setOffsetAndRotate(m.x+PanEditor.panOffsetX,m.y+PanEditor.panOffsetY,C),y.setCameraArrowOpacity("1.0")}}},e.prototype.update=function(e){for(var t=this.viewerFloorData.getDrawableItems(),i=0;i<t.length;i++){var n=t[i];n instanceof TipNode?this.mapContainer.appendChild(n.getSvgNode()):n.abtainRenderables(this.drawableContainer)}this.updateCameraNode();var o=this.mapContainer.firstChild;o?this.mapContainer.insertBefore(this.drawableContainer,o):this.mapContainer.appendChild(this.drawableContainer)},e.prototype.setEventManager=function(e){this.eventManager=e},e.prototype.getEventManager=function(){return this.eventManager},e.prototype.registerCameraHeightChanged=function(e){this.viewer.registerEventListener(e,this.cameraHeightChangedCallbackBinded)},e.prototype.getManHeight=function(){return this.manHeight},e}(),HighlightControl=function(){function e(e){this.viewerFloorData=e}return e.prototype.hightlight=function(e,t,i){var n=this.viewerFloorData.getOriginSize();this.intersectPoint=this.viewerFloorData.getIntersectPoint();var o=[e.intersectionPoint.x+t,e.intersectionPoint.y+i];this.intersectPoint.setOffset(o[0],o[1]),this.abcGridLine=this.viewerFloorData.getGridLineByName(e.abcName),this.numeralGridLine=this.viewerFloorData.getGridLineByName(e.numeralName),this.intersectPoint.highlight(),this.abcGridLine.highlight(),this.numeralGridLine.highlight(),this.tipNode=this.viewerFloorData.getTipNode(),this.tipNode.setContent(e.numeralName+"-"+e.abcName),this.tipNode.setOffset(n,o),this.tipNode.show()},e.prototype.cancelHightlight=function(){this.intersectPoint&&(this.intersectPoint.cancelHighlight(),this.abcGridLine.cancelHighlight(),this.numeralGridLine.cancelHighlight(),this.tipNode.hide(),this.intersectPoint=null,this.abcGridLine=null,this.numeralGridLine=null,this.tipNode=null)},e}(),PickEditor=function(e){function t(t,i){var n=e.call(this)||this;return n.name=EditorName.PICK_Editor,n.vfViewer=t,n.vfData=t.getData(),n.algorithm=new Algorithm,n.highlightControl=new HighlightControl(n.vfData),n.cameraProjectedPosZ=t.getManHeight(),n.mapClickMode="default",n.lastMousePoint=new THREE.Vector2,n.eventManager=i,n.bIsEnableHover=!0,n}return __extends(t,e),t.prototype.onMouseDown=function(e){this.bIsMouseDown=!0,this.lastMousePoint.setX(e.clientX),this.lastMousePoint.setY(e.clientY)},t.prototype.onMouseMove=function(e){if(0!=this.bIsEnableHover||!this.bIsMouseDown){var t=new THREE.Vector2(e.clientX,e.clientY);t.x+=ZoomEditor.offsetXForZoomAndPan,t.y+=+ZoomEditor.offsetYForZoomAndPan;var i=this.vfViewer.getMapContainer(),n=this.vfData.getSize();if(this.algorithm.isMouseOverCanvas(i,n,t)){var o=this.algorithm.normalizePoint(i,n,t),s=new THREE.Vector2(o.x,o.y),r=null;this.bIsAllowNear?(this.algorithm.normalizedPointToScreen(s,{width:n[0]/2,height:n[1]/2}),r=this.algorithm.getIntersectionToMinDistance(this.vfData.getIntersections(),s)):r=this.getIntersectionByNormalizedPoint(s),this.highlightControl.cancelHightlight(),r&&this.highlightControl.hightlight(r,PanEditor.panOffsetX,PanEditor.panOffsetY)}}},t.prototype.onMouseUp=function(e){this.bIsMouseDown=!1,this.lastMousePoint.x===e.clientX&&this.lastMousePoint.y===e.clientY&&this.locateByClientPoint(e.clientX+ZoomEditor.offsetXForZoomAndPan,e.clientY+ZoomEditor.offsetYForZoomAndPan)},t.prototype.setIsAllowNear=function(e){this.bIsAllowNear=e},t.prototype.getIntersectionByNormalizedPoint=function(e){for(var t=null,i=this.vfData.getIntersections(),n=0,o=i.length;n<o;n++){var s=i[n].intersectionPoint;if(s){var r=new THREE.Vector2(e.x,e.y),a=this.vfData.getSize();if(this.algorithm.normalizedPointToScreen(r,{width:a[0]/2,height:a[1]/2}),s.distanceToSquared(r)<9){t=i[n];break}}}return t},t.prototype.locateByClientPoint=function(e,t){var i=new THREE.Vector2(e,t),n=new THREE.Vector3,o=this.vfViewer.getMapContainer(),s=this.vfData.getSize(),r=this.algorithm.normalizePoint(o,s,i);if(null!=r){var a=this.vfData.getAxisGridBox2D();this.algorithm.normalizedPointToWorld(r,a);var l=this.algorithm.normalizePoint(o,s,i);this.algorithm.normalizedPointToScreen(l,{width:s[0]/2,height:s[1]/2});var h=this.algorithm.getIntersectionToMinDistance(this.vfData.getIntersections(),l);if(h&&h.intersectionPoint){var d=new THREE.Vector2(h.intersectionPoint.x,h.intersectionPoint.y);if(l.sub(d).lengthSq()<9){var c=d.clone(),u={width:s[0]/2,height:s[1]/2};this.algorithm.screenToNormalizedPoint(c,u),this.algorithm.normalizedPointToWorld(c,a),n.set(c.x,c.y,this.cameraProjectedPosZ)}else n.set(r.x,r.y,this.cameraProjectedPosZ)}else n.set(r.x,r.y,this.cameraProjectedPosZ);var p=n.clone(),g=this.vfData.getElevationById();return"string"==typeof g&&(g=parseFloat(g)),p.z+=g,"default"==this.mapClickMode?(this.eventManager.dispatchEvent({type:EventType.PICK_MOUSE_UP,data:p}),this.algorithm.transformWorldPoint(this.vfViewer.getViewer(),p),this.algorithm.flyToPointWithParallelEye(this.vfViewer.getViewer(),p)):"static"==this.mapClickMode&&this.eventManager.dispatchEvent({type:EventType.PICK_MOUSE_UP,data:p}),!0}console.warn("Click point out of boundary.")},t.prototype.setClickMode=function(e){this.mapClickMode=e},t}(Editor),NaviAction=function(){function e(e){this.vfViewer=e,this.vfData=e.getData(),this.svgRect=null,this.rectForMinimapId="RectForMinimap",this.bEditMode=!1,this.bPanMode=!1,this.bMouseDown=!1,this.rectangle=[],this.currentGripId=-1,this.lastHighlightGripId=-1,this.bFirstMouseClick=!0,this.lastMousePoint=new THREE.Vector2,this.lastMousePointToRectMin=new THREE.Vector2,this.lastMousePointToRectMax=new THREE.Vector2,this.pointOnBorder=[],this.eventManager=e.getEventManager(),this.panOffset=[0,0],this.zoomFactor=1;var t=this;this.eventManager.addEventListener(EventType.ZOOM_MOUSE_WHEEL,(function(e){var i=e.data;t.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)})),this.eventManager.addEventListener(EventType.PAN_MOUSE_MOVE,(function(e){var i=e.data;t.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)}))}return e.prototype.getMouseClickState=function(){return this.bFirstMouseClick},e.prototype.setMouseClickState=function(e){this.bFirstMouseClick=!!e},e.prototype.getCurrentGripId=function(){return this.currentGripId},e.prototype.setCurrentGripId=function(e){this.currentGripId=e},e.prototype.getRectangleInfo=function(){var e=Math.abs(this.rectangle[2]-this.rectangle[0]),t=Math.abs(this.rectangle[3]-this.rectangle[1]);return{x:this.rectangle[0],y:this.rectangle[1],width:e,height:t}},e.prototype.setLastMousePoint=function(e,t){this.lastMousePoint.x=e,this.lastMousePoint.y=t},e.prototype.equalWithLastPoint=function(e,t){return this.lastMousePoint.x===e&&this.lastMousePoint.y===t},e.prototype.getRectangle=function(){return this.rectangle},e.prototype.addPointToRectangle=function(e,t){"number"==typeof e&&this.rectangle.push(e),"number"==typeof t&&this.rectangle.push(t)},e.prototype.pointsCount=function(){return this.rectangle.length/2},e.prototype.pointValidation=function(e,t){var i=this.vfViewer.getDomContainer().getBoundingClientRect();(e<0||t<0||e>i.width||t>i.height)&&(e=this.pointOnBorder[0],t=this.pointOnBorder[1]),e<this.rectangle[0]?(this.rectangle.push(this.rectangle[0]),this.rectangle[0]=e):this.rectangle.push(e),t<this.rectangle[1]?(this.rectangle.push(this.rectangle[1]),this.rectangle[1]=t):this.rectangle.push(t)},e.prototype.getMouseState=function(){return this.bMouseDown},e.prototype.setMouseState=function(e){this.bMouseDown=!!e},e.prototype.getEditMode=function(){return this.bEditMode},e.prototype.setEditMode=function(e){this.bEditMode=!!e},e.prototype.getPanMode=function(){return this.bPanMode},e.prototype.setPanMode=function(e){this.bPanMode=!!e},e.prototype.createSvgElement=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e);return t.setAttribute("pointer-events","inherit"),t},e.prototype.createSvgRect=function(e){this.svgRect||(this.svgRect=this.createSvgElement("rect"),this.svgRect.setAttribute("id",this.rectForMinimapId),this.svgRect.setAttribute("stroke-width",2),this.svgRect.style.position="absolute",this.svgRect.style.fillOpacity="0.4",this.svgRect.style.fill=this.vfData.getGlodonColor(),this.svgRect.style.display="block",this.svgRect.style.stroke=this.vfData.getGlodonColor(),this.svgRect.style.strokeWidth="2");var t=Math.abs(e.x-this.rectangle[0]),i=Math.abs(e.y-this.rectangle[1]),n=this.vfViewer.getAuxContainer(),o=n.clientWidth,s=n.clientHeight,r=["translate(",e.x-o/2,",",e.y-s/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",r),this.svgRect.setAttribute("width",t+""),this.svgRect.setAttribute("height",i+""),n.appendChild(this.svgRect)},e.prototype.updateSvgRect=function(e){this.pointOnBorder=[],this.pointOnBorder.push(e.x,e.y);var t=Math.abs(e.x-this.rectangle[0]),i=Math.abs(e.y-this.rectangle[1]),n={x:this.rectangle[0],y:this.rectangle[1]};if(e.x<n.x||e.y<n.y){e.x<n.x&&(n.x=e.x),e.y<n.y&&(n.y=e.y);var o=this.vfData.getOriginSize(),s=["translate(",n.x-o[0]/2,",",n.y-o[1]/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",s)}this.svgRect.setAttribute("width",t+""),this.svgRect.setAttribute("height",i+"")},e.prototype.resetSvgRect=function(){var e=Math.abs(this.rectangle[0]-this.rectangle[2]),t=Math.abs(this.rectangle[1]-this.rectangle[3]);this.svgRect.setAttribute("width",e+""),this.svgRect.setAttribute("height",t+"");var i=this.vfViewer.getAuxContainer(),n=i.clientWidth,o=i.clientHeight,s=["translate(",this.rectangle[0]-n/2,",",this.rectangle[1]-o/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",s),this.eventManager.dispatchEvent({type:EventType.Minimap_Rect_Changed,rectInfo:this.getRectangleInfo()})},e.prototype.clearRectangle=function(){this.rectangle=[]},e.prototype.adjustRectangle=function(e,t,i){if(t[0]>=i[0])switch(e){case 0:case 1:case 2:t[0]=i[0];break;case 4:case 5:case 6:i[0]=t[0]}if(t[1]>=i[1])switch(e){case 2:case 3:case 4:i[1]=t[1];break;case 6:case 7:case 0:t[1]=i[1]}return t.concat(i)},e.prototype.gripDragging=function(e,t){var i=this.rectangle,n=t.x-e.x,o=t.y-e.y,s=[i[0],i[1]],r=[i[2],i[3]];switch(this.currentGripId){case 0:s[0]+=n,s[1]+=o;break;case 1:s[0]+=n;break;case 2:s[0]+=n,r[1]+=o;break;case 3:r[1]+=o;break;case 4:r[0]+=n,r[1]+=o;break;case 5:r[0]+=n;break;case 6:s[1]+=o,r[0]+=n;break;case 7:s[1]+=o;break;default:console.log("default grip id."+this.currentGripId)}var a=this.vfData.getOriginSize();r[0]=r[0]>a[0]?a[0]:r[0],r[1]=r[1]>a[1]?a[1]:r[1],this.rectangle=this.adjustRectangle(this.currentGripId,s,r)},e.prototype.hightlightGrip=function(e){var t={x:e.offsetX,y:e.offsetY},i=this.hitGrips(t);i!=this.lastHighlightGripId&&(this.currentGripId<0&&this.lastHighlightGripId>=0&&(document.getElementById(this.rectForMinimapId+"-"+this.lastHighlightGripId).style.stroke=this.vfData.getGlodonColor()));(this.currentGripId>=0||i>=0)&&(this.currentGripId>=0&&(i=this.currentGripId),document.getElementById(this.rectForMinimapId+"-"+i).style.stroke="#f5a623",this.currentGripId<0&&(this.lastHighlightGripId=i))},e.prototype.drawGrips=function(){for(var e=this.getGrips(),t=0;t<e.length;t+=2){if(!((t/2-1)%2)){var i=this.createSegmentGrip(t/2,this.vfData.getGlodonColor());this.currentGripId==t/2&&(i=this.createSegmentGrip(t/2,"#FF9D0B")),this.vfViewer.getAuxContainer().appendChild(i)}}for(t=0;t<e.length;t+=2){if(!!((t/2-1)%2)){i=this.createGrip(t/2,this.vfData.getGlodonColor());this.currentGripId==t/2&&(i=this.createGrip(t/2,"#FF9D0B")),this.vfViewer.getAuxContainer().appendChild(i)}}},e.prototype.createSegmentGrip=function(e,t){var i=this.getGrips(),n=this.rectForMinimapId+"-"+e,o=document.getElementById(n);o&&o.parentNode.removeChild(o);var s=this.createSvgElement("line"),r=this.vfViewer.getAuxContainer().clientWidth,a=this.vfViewer.getAuxContainer().clientHeight,l=(e-1)%(i.length/2),h=(e+1)%(i.length/2),d=String(i[2*l]-r/2),c=String(i[2*l+1]-a/2),u=String(i[2*h]-r/2),p=String(i[2*h+1]-a/2);return s.setAttribute("id",n),s.setAttribute("x1",d),s.setAttribute("y1",c),s.setAttribute("x2",u),s.setAttribute("y2",p),s.setAttribute("style","fill: none; stroke: "+(t||"#4784cb")+"; stroke-width: 2; fill: #ffffff; display: block; position: absolute"),s},e.prototype.createGrip=function(e,t){var i=this.getGrips(),n=this.rectForMinimapId+"-"+e,o=document.getElementById(n);o&&o.parentNode.removeChild(o);var s=this.createSvgElement("circle"),r=this.vfViewer.getAuxContainer().clientWidth,a=this.vfViewer.getAuxContainer().clientHeight,l=["translate(",i[2*e]-r/2,",",i[2*e+1]-a/2,") ","rotate(",0,") "].join("");return s.setAttribute("id",n),s.setAttribute("transform",l),s.setAttribute("r","3"),s.setAttribute("style","fill: none; stroke: "+(t||"#4784cb")+"; stroke-width: 1; fill: #ffffff; display: block; position: absolute"),s},e.prototype.removeGrips=function(){for(var e=0;e<8;e++){var t=document.getElementById(this.rectForMinimapId+"-"+e);t&&t.parentNode.removeChild(t)}},e.prototype.removeSvgRect=function(){var e=document.getElementById(this.rectForMinimapId);e&&e.parentNode.removeChild(e)},e.prototype.destroyAll=function(){this.removeGrips(),this.removeSvgRect(),this.clearRectangle(),this.eventManager.dispatchEvent({type:EventType.Minimap_Rect_Destroyed})},e.prototype.getGrips=function(){var e={x:this.rectangle[0],y:this.rectangle[1]},t={x:this.rectangle[2],y:this.rectangle[3]},i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},n=[];return n.push(e.x,e.y),n.push(e.x,i.y),n.push(e.x,t.y),n.push(i.x,t.y),n.push(t.x,t.y),n.push(t.x,i.y),n.push(t.x,e.y),n.push(i.x,e.y),n},e.prototype.hitGrips=function(e){for(var t=this.getGrips(),i=0;i<t.length;i+=2){var n=!1;if(!((i/2-1)%2)){var o=(i/2-1)%(t.length/2),s=(i/2+1)%(t.length/2),r=t[2*o],a=t[2*o+1],l=t[2*s],h=t[2*s+1];n=this.isPointInSegment(e.x,e.y,r,a,l,h,3)}else{var d=[t[i],t[i+1]];n=this.isPointInCircle(e,d,6)}if(n)return i/2}return-1},e.prototype.isPointInCircle=function(e,t,i){var n=e.x-t[0],o=e.y-t[1];return Math.sqrt(n*n+o*o)<=i},e.prototype.isPointInSegment=function(e,t,i,n,o,s,r){r=r||0;var a=(o-i)*(e-i)+(s-n)*(t-n);if(a<=0)return Math.sqrt((e-i)*(e-i)+(t-n)*(t-n))<=r;var l=(o-i)*(o-i)+(s-n)*(s-n);if(a>=l)return Math.sqrt((e-o)*(e-o)+(t-s)*(t-s))<=r;var h=a/l,d=i+(o-i)*h,c=n+(s-n)*h;return Math.sqrt((e-d)*(e-d)+(c-t)*(c-t))<=r},e.prototype.isPointInRectangle=function(e,t){if(this.pointsCount()<2)return!1;var i=this.rectangle,n=i[0]<i[2]?[i[0],i[2]]:[i[2],i[0]],o=n[0],s=n[1],r=(i[1],i[3],[i[1],i[3]]);return o<e&&e<s&&r[0]<t&&t<r[1]},e.prototype.panRectangle=function(e,t){var i=this.rectangle,n=this.vfViewer.getDomContainer().getBoundingClientRect();this.lastMousePointToRectMin.x+e<0?e=-this.lastMousePointToRectMin.x:this.lastMousePointToRectMax.x+e>n.width&&(e=n.width-this.lastMousePointToRectMax.x),this.lastMousePointToRectMin.y+t<0?t=-this.lastMousePointToRectMin.y:this.lastMousePointToRectMax.y+t>n.height&&(t=n.height-this.lastMousePointToRectMax.y),i[0]=this.lastMousePointToRectMin.x+e,i[1]=this.lastMousePointToRectMin.y+t,i[2]=this.lastMousePointToRectMax.x+e,i[3]=this.lastMousePointToRectMax.y+t,this.resetSvgRect(),this.drawGrips()},e.prototype.updateLastMousePointToRect=function(){this.lastMousePointToRectMin.x=this.rectangle[0]-this.lastMousePoint.x,this.lastMousePointToRectMin.y=this.rectangle[1]-this.lastMousePoint.y,this.lastMousePointToRectMax.x=this.rectangle[2]-this.lastMousePoint.x,this.lastMousePointToRectMax.y=this.rectangle[3]-this.lastMousePoint.y},e.prototype.zoomAndPan=function(e,t,i){if(this.pointsCount()<2)return this.panOffset=[e,t],void(this.zoomFactor=i);for(var n=this.vfViewer.getDomContainer().getBoundingClientRect(),o=n.width,s=n.height,r=new THREE.Vector2(.5*o,.5*s),a=0;a<=this.rectangle.length/2;a+=2){var l=new THREE.Vector2(this.rectangle[a]-this.panOffset[0],this.rectangle[a+1]-this.panOffset[1]).clone().sub(r);l.divideScalar(this.zoomFactor),this.rectangle[a]=l.x+r.x,this.rectangle[a+1]=l.y+r.y;var h=new THREE.Vector2(this.rectangle[a],this.rectangle[a+1]).clone().sub(r);h.multiplyScalar(i),this.rectangle[a]=r.x+h.x+e,this.rectangle[a+1]=r.y+h.y+t}this.panOffset=[e,t],this.zoomFactor=i,this.resetSvgRect(),this.drawGrips()},e}(),RectPickEditor=function(e){function t(t,i){var n=e.call(this)||this;return n.name=EditorName.RECTPICK_Editor,n.eventManager=i,n.viewerFloorData=t.getData(),n.naviAction=new NaviAction(t),n.vfViewer=t,n.algorithm=new Algorithm,n}return __extends(t,e),t.prototype.onMouseDown=function(e){this.naviAction.setMouseState(!0);var t=this.adjustEvent(e);if(this.naviAction.setLastMousePoint(t.clientX,t.clientY),0==this.naviAction.pointsCount()){var i={x:t.offsetX,y:t.offsetY};this.naviAction.addPointToRectangle(i.x,i.y),this.naviAction.createSvgRect(i)}if(2==this.naviAction.pointsCount()){var n={x:e.offsetX,y:e.offsetY},o=this.naviAction.hitGrips(n),s=this.naviAction.isPointInRectangle(n.x,n.y);o>=0?this.naviAction.setEditMode(!0):s&&(this.naviAction.updateLastMousePointToRect(),this.naviAction.setPanMode(!0))}this.eventManager.dispatchEvent({type:EventType.RECTPICK_MOUSE_DOWN})},t.prototype.onMouseMove=function(e){if(2==this.naviAction.pointsCount()&&this.naviAction.hightlightGrip(e),this.naviAction.getMouseState()){var t=this.vfViewer.getDomContainer().getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top;if(this.naviAction.pointsCount()<2&&this.naviAction.updateSvgRect({x:i,y:n}),this.naviAction.getEditMode()){var o={x:i,y:n},s=this.naviAction.hitGrips(o);if(this.naviAction.getMouseClickState())return this.firstPos=o,this.naviAction.setMouseClickState(!1),void(s>=0&&this.naviAction.setCurrentGripId(s));var r=o;this.naviAction.getCurrentGripId()>=0&&(this.naviAction.gripDragging(this.firstPos,r),this.naviAction.resetSvgRect(),this.naviAction.removeGrips(),this.naviAction.drawGrips()),this.firstPos=r}this.naviAction.getPanMode()&&this.naviAction.panRectangle(e.clientX,e.clientY)}},t.prototype.onMouseUp=function(e){if(this.naviAction.setMouseState(!1),this.naviAction.setMouseClickState(!0),this.naviAction.setCurrentGripId(-1),this.naviAction.setPanMode(!1),this.naviAction.equalWithLastPoint(e.clientX,e.clientY))1==this.naviAction.pointsCount()&&this.naviAction.clearRectangle();else{if(1==this.naviAction.pointsCount()){var t=this.adjustEvent(e),i=this.vfViewer.getDomContainer().getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top;this.naviAction.pointValidation(n,o),this.naviAction.resetSvgRect(),this.naviAction.drawGrips()}this.naviAction.setEditMode(!1)}},t.prototype.clear=function(){this.naviAction.destroyAll()},t.prototype.getBoundingBoxIsolate=function(){var e=this.naviAction.getRectangle(),t={x:e[0]+ZoomEditor.offsetXForZoomAndPan,y:e[1]+ZoomEditor.offsetYForZoomAndPan},i={x:e[2]+ZoomEditor.offsetXForZoomAndPan,y:e[3]+ZoomEditor.offsetYForZoomAndPan},n=this.algorithm.getCuttingBoxOnCanvas(t,i,this.viewerFloorData.getSize(),this.viewerFloorData.getAxisGridBox2D()),o=this.viewerFloorData.getFloorPlaneBox();if(n.min.z=o.min.z,n.max.z=o.max.z,this.vfViewer.getViewer().miniMapTransform){var s=new THREE.Vector3(n.max.x,n.max.y,n.max.z);s.applyMatrix4((new THREE.Matrix4).fromArray(this.vfViewer.getViewer().miniMapTransform));var r=new THREE.Vector3(n.min.x,n.min.y,n.min.z);r.applyMatrix4((new THREE.Matrix4).fromArray(this.vfViewer.getViewer().miniMapTransform)),n.max=s,n.min=r}return n},t.prototype.getIntersectionByNormalizedPoint=function(e,t){var i=this.vfViewer.getData().getIntersections(),n=new THREE.Vector2(e.x,e.y);return this.algorithm.normalizedPointToScreen(n,{width:t[0]/2,height:t[1]/2}),Algorithm.getIntersectionByPoint(i,n)},t.prototype.adjustEvent=function(e){var t={offsetX:e.offsetX,offsetY:e.offsetY,clientX:e.clientX,clientY:e.clientY},i=new THREE.Vector2(t.clientX,t.clientY);i.x+=ZoomEditor.offsetXForZoomAndPan,i.y+=ZoomEditor.offsetYForZoomAndPan;var n=this.vfViewer.getMapContainer(),o=this.vfViewer.getData().getSize(),s=this.algorithm.normalizePoint(n,o,i),r=this.getIntersectionByNormalizedPoint(s,o);if(r){var a=this.vfViewer.getDomContainer().getBoundingClientRect();t.clientX=r.intersectionPoint.x-ZoomEditor.offsetXForZoomAndPan,t.offsetX=t.clientX+o[0]/2,t.clientX=t.offsetX+a.left,t.clientY=r.intersectionPoint.y-ZoomEditor.offsetYForZoomAndPan,t.offsetY=t.clientY+o[1]/2,t.clientY=t.offsetY+a.top}return t},t}(Editor),ViewerFloorEditor=function(){function e(e,t,i){this.eventManager=new EventManager,this.mapContainer=e,this.viewerFloorData=t,this.vfViewer=i,this.vfViewer.setEventManager(this.eventManager),this.activeEditors=[],this.bIsEnablePickHover=!1,this.initialize()}return e.prototype.initialize=function(){this.onContextmenuBinded=this.onContextmenu.bind(this),this.onMouseDownBinded=this.onMouseDown.bind(this),this.onMouseUpBinded=this.onMouseUp.bind(this),this.onMouseMoveBinded=this.onMouseMove.bind(this),this.onMouseWheelBinded=this.onMouseWheel.bind(this),this.addDomEventListeners(),this.enableEditor(EditorName.PICK_Editor),this.enableEditor(EditorName.PAN_Editor),this.enableEditor(EditorName.Zoom_Editor)},e.prototype.addDomEventListeners=function(){var e=this.mapContainer;e.addEventListener("contextmenu",this.onContextmenuBinded,!1),e.addEventListener("mousemove",this.onMouseMoveBinded,!1),e.addEventListener("mousedown",this.onMouseDownBinded,!1),e.addEventListener("mousewheel",this.onMouseWheelBinded,!1),document.addEventListener("mouseup",this.onMouseUpBinded,!1)},e.prototype.removeDomEventListeners=function(){var e=this.mapContainer;e.removeEventListener("contextmenu",this.onContextmenuBinded,!1),e.removeEventListener("mousemove",this.onMouseMoveBinded,!1),e.removeEventListener("mousedown",this.onMouseDownBinded,!1),document.removeEventListener("mouseup",this.onMouseUpBinded,!1)},e.prototype.onMouseDown=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName.PICK_Editor&&e.button!=MouseEventType.Left||(n.getName()==EditorName.RECTPICK_Editor&&e.button!=MouseEventType.Left||n.getName()==EditorName.PAN_Editor&&e.button==MouseEventType.Left||n.onMouseDown(e))}},e.prototype.onMouseMove=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName.PICK_Editor&&0==this.bIsEnablePickHover||n.onMouseMove(e)}},e.prototype.onMouseUp=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName.PICK_Editor&&e.button!=MouseEventType.Left||(n.getName()==EditorName.RECTPICK_Editor&&e.button!=MouseEventType.Left||n.getName()==EditorName.PAN_Editor&&e.button==MouseEventType.Left||n.onMouseUp(e))}},e.prototype.onMouseWheel=function(e){var t=this.find(EditorName.Zoom_Editor);t&&t.onMouseWheel(e)},e.prototype.onContextmenu=function(e){e.preventDefault()},e.prototype.addEventListener=function(e,t){this.eventManager.addEventListener(e,t)},e.prototype.clearRectPick=function(){var e=this.find(EditorName.RECTPICK_Editor);e instanceof RectPickEditor&&e.clear()},e.prototype.clearZoomAndPan=function(){PanEditor.clear(),ZoomEditor.clear(),this.viewerFloorData.setZoomFactor(1);var e=this.find(EditorName.Zoom_Editor);e instanceof ZoomEditor&&e.setZoonIndex(0)},e.prototype.getBoundingBoxIsolate=function(){var e=this.find(EditorName.RECTPICK_Editor);if(e instanceof RectPickEditor)return e.getBoundingBoxIsolate()},e.prototype.setMapClickMode=function(e){var t=this.find(EditorName.PICK_Editor);t instanceof PickEditor&&t.setClickMode(e)},e.prototype.find=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++)if(t[i].getName()===e)return t[i]},e.prototype.enableEditor=function(e){if(!this.find(e)){var t=this.activeEditors;switch(e){case EditorName.PICK_Editor:t.push(new PickEditor(this.vfViewer,this.eventManager));break;case EditorName.RECTPICK_Editor:t.push(new RectPickEditor(this.vfViewer,this.eventManager));break;case EditorName.PAN_Editor:t.push(new PanEditor(this.vfViewer,this.eventManager));break;case EditorName.Zoom_Editor:t.push(new ZoomEditor(this.vfViewer,this.eventManager))}}},e.prototype.getEventManager=function(){return this.eventManager},e.prototype.disableEditor=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++)t[i].getName()===e&&t.splice(i,1)},e.prototype.enablePickHover=function(e){this.bIsEnablePickHover=e},e.prototype.setZoomMode=function(e){var t=this.find(EditorName.Zoom_Editor);t instanceof ZoomEditor&&t.enableMode(e)},e.prototype.setZoomFactors=function(e){var t=this.find(EditorName.Zoom_Editor);t instanceof ZoomEditor&&t.setZoomFactors(e)},e}(),ViewerFloor=function(){function e(e,t){this.viewer=e,this.vfData=new ViewerFloorData,this.vfView=new ViewerFloorView(e,t,this.vfData),this.bIsEnableFloorPlaneChangedEvent=!0;var i=this.getMapContainer();this.vfEditor=new ViewerFloorEditor(i,this.vfData,this.vfView),THREE.vf=this}return e.prototype.setAxisGridData=function(e){this.vfData.setAxisGrids(e)},e.prototype.setPlanes=function(e){this.vfData.setPlanes(e)},e.prototype.setFloorPlaneId=function(e,t){this.vfData.setFloorPlaneId(e,t);var i=this.vfData.getProperZoomFactors();this.vfEditor.setZoomFactors(i),PanEditor.clear(),this.bIsEnableFloorPlaneChangedEvent&&this.vfEditor.getEventManager().dispatchEvent({type:EventType.Floor_Plane_Changed,elevation:t&&this.viewer.getModelManager().getModel(t)?this.viewer.globalUnitUtil.revertTranslate(new THREE.Vector3(0,0,this.viewer.globalUnitUtil.translate(this.vfData.getElevationById())).applyMatrix4(this.viewer.getModelManager().getModel(t).transformMatrix.clone()).z):this.vfData.getElevationById()}),this.vfEditor.getEventManager().dispatchEvent({type:EventType.Floor_Plane_Changed_For_Panel,name:this.getFloorPlaneName()})},e.prototype.getEventManager=function(){return this.vfEditor.getEventManager()},e.prototype.enableFloorPlaneChangedEvent=function(e){this.bIsEnableFloorPlaneChangedEvent=e},e.prototype.setSize=function(e,t){this.vfData.setSize(e,t)},e.prototype.setFlip=function(e){this.vfData.setFlip(e)},e.prototype.resize=function(e,t,i){this.vfEditor.clearZoomAndPan(),this.vfData.setIsShowAxisGrid(i),this.vfData.setSize(e,t),this.vfView.setSize(e,t),i?(this.vfEditor.setZoomMode(VFSizeMode.Max),this.vfEditor.enableEditor(EditorName.RECTPICK_Editor),this.vfEditor.enablePickHover(!0)):(this.clearRectPick(),this.vfEditor.setZoomMode(VFSizeMode.Min),this.vfEditor.disableEditor(EditorName.RECTPICK_Editor),this.vfEditor.enablePickHover(!1)),this.vfData.getTipNode().hide()},e.prototype.destroy=function(){this.vfView.destroy(),this.vfData.destroy(),this.clearRectPick()},e.prototype.rebuildData=function(){this.vfData.build()},e.prototype.renderCameraNode=function(e){this.vfView.updateCameraNode(e)},e.prototype.addEventListener=function(e,t){this.vfEditor.addEventListener(e,t)},e.prototype.clearRectPick=function(){this.vfEditor.clearRectPick()},e.prototype.clearZoomAndPan=function(){this.vfEditor.clearZoomAndPan(),this.vfView.destroy(),this.vfData.destroy(),this.vfData.build(),this.vfView.update()},e.prototype.getBoundingBoxIsolate=function(){return this.vfEditor.getBoundingBoxIsolate()},e.prototype.getFloorPlaneName=function(){return this.vfData.getDataFloorPlanes().getName(this.vfData.getFloorPlaneId(),this.vfData.modelId)},e.prototype.getAxisGridBox2D=function(){return this.vfData.getAxisGridBox2D()},e.prototype.setMapClickMode=function(e){this.vfEditor.setMapClickMode(e)},e.prototype.getMapContainer=function(){return this.vfView.getDomContainer()},e.prototype.render=function(){this.vfView.update()},e.prototype.getPanOffset=function(){return{x:PanEditor.panOffsetX,y:PanEditor.panOffsetY}},e.prototype.registerCameraHeightChanged=function(e){this.vfView.registerCameraHeightChanged(e)},e}();!function(){var e="Bimface.Plugins.Section.SectionPlane",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Map"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){var t=this,i=e;if(this.defaultFloorPlane="F01",t._opt=i,t.id=e.id,!i.domElement)return console.log("domElement must not be empty."),!1;if(!i.viewer)return console.log("viewer is not defined."),!1;skipVueObserver(this);let n=new Glodon$1.Web.Lang.EventManager;this.getEventManager=function(){return n},this.EventType={RECTPICK_MOUSE_MOVE:1001,RECTPICK_MOUSE_UP:1002,PICK_MOUSE_UP:2002,Floor_Plane_Changed:3e3,Floor_Plane_Changed_For_Panel:3001,Camera_Height_Changed:5e3,ZOOM_MOUSE_WHEEL:6e3,Minimap_Rect_Changed:8e3,Minimap_Rect_Destroyed:8001},t._floors=[],t._axisGrids={},t._hasFloor=void 0===i.hasFloor||i.hasFloor,t._mapHeader=i.mapHeader,t._mapEvents=Glodon$1.Bimface.Plugins.Map.MapEvents;var o=i.viewer.getViewer();const s=o.getBoundingBoxWorld(),r=s.max.z-s.min.z,a=i.viewer.getUnit()===Glodon$1.Bimface.Common.Units.LengthUnits.Meter;t._manHeight=t._hasFloor?a?1.75:1750:Math.min(a?1:1e3,r/20),t._refreshHeight=Math.min(a?3:3e3,r/10),o._manHeight=t._manHeight,t.viewerFloor=new ViewerFloor(o,i.domElement),t.viewerFloor.registerCameraHeightChanged(CLOUD$1.EVENTS.ON_CAMERA_HEIGHT_CHANGED),t._helper=this,t._useEngineMap=i.viewer._opt.enableRealisticMiniMap,t.renderCB=function(){t._inited&&t.viewerFloor.renderCameraNode(t._opt.viewer)},o.addCallbacks("render",t.renderCB),t.init()};o.prototype={addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},init:function(){t.send(e,"init");const i=this._opt.viewer;let o=[],s=[],r=[];if(this._hasFloor){const e=()=>{this._axisGrids={Grids:s,Levels:r},this._floors=o,(this._axisGrids.Grids||this._axisGrids.Levels)&&this.viewerFloor.setAxisGridData(this._axisGrids),this.viewerFloor.setPlanes(this._floors);var e=new Glodon$1.Bimface.UI.Select.SelectConfig;e.className="bf-select bf-select-map";var t=this.getDefaultFloorPlane(),i=this._floors.getObjectByAttribute("name",t);0!=i&&(e.default=i.id),e.options=this._floors,e.element=this._mapHeader,e.prefix=BimfaceLanguage.bf_panel_map_level;var n=this,a=new Glodon$1.Bimface.UI.Select.Select(e);a.addEventListener("Change",(function(e){n.showFloorById(e.id,e.modelId)})),this.addEventListener(this._mapEvents.FloorPlaneChanged,(function(e){a._currentElement.innerText=BimfaceLanguage.bf_panel_map_level+e})),this.createMap()};let t=0;const n=i.getModels().length;i.getModels().forEach((i=>{i["getMapInfo"+(this._opt.loadAsync?"Async":"")]((a=>{a.floors.map((e=>e.modelId=i.modelId)),o=[...a.floors,...o],s=a.axisGrid.Grids?[...a.axisGrid.Grids,...s]:s,a.axisGrid.Levels&&a.axisGrid.Levels.map((e=>e.modelId=i.modelId)),r=a.axisGrid.Levels?[...a.axisGrid.Levels,...r]:r,t++,t===n&&e()}),(()=>{t++,t===n&&e()}))}))}else{var a=n.create("div","bf-map-header-title");this._mapHeader.appendChild(a),this.addEventListener(this._mapEvents.FloorPlaneChanged,(function(e){void 0===e&&(e=0),i.getUnit()===Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter&&(e/=1e3),a.innerHTML=BimfaceLanguage.bf_panel_map_height+e+"m"})),this.createMap()}},createMap:function(){t.send(e,"createMap");var i=(l=this).getEventManager(),n=Glodon$1.Bimface.Plugins.Map.MapEvents,o=l._opt;let s=this.EventType;!l._modelId&&l._floors[0]&&(l._modelId=l._floors[0].modelId);const r=l._opt.viewer.getModel(l._modelId)._getModelTransformation();if(l._opt.viewer.getViewer().miniMapTransform=r,this.viewerFloor.addEventListener(s.PICK_MOUSE_UP,(function(e){!l._modelId&&l._floors[0]&&(l._modelId=l._floors[0].modelId);const t=l._opt.viewer.getModel(l._modelId)._getModelTransformation();l._opt.viewer.getViewer().miniMapTransform=t,l._opt.viewer.globalUnitUtil.translate(e,["x","y","z"],!1),i.fireEvent(n.MouseClicked,e.data,t),window.requestAnimationFrame((()=>l._opt.viewer.fireEvent("MiniMapOperate")))})),this.viewerFloor.setMapClickMode(o.navigationMode.toLocaleLowerCase()),this.viewerFloor.addEventListener(s.Minimap_Rect_Changed,(function(e){i.fireEvent("MinimapRectChanged",e.rectInfo)})),this.viewerFloor.addEventListener(s.Minimap_Rect_Destroyed,(function(e){i.fireEvent("MinimapRectDestroyed",e)})),this.viewerFloor.addEventListener(s.Camera_Height_Changed,(function(e){l.viewerFloor.enableFloorPlaneChangedEvent(!1),l.showFloorById(e.id),l.viewerFloor.enableFloorPlaneChangedEvent(!0)})),this.viewerFloor.addEventListener(s.Floor_Plane_Changed_For_Panel,(function(e){i.fireEvent("FloorPlaneChanged",e.name)})),this.viewerFloor.addEventListener(s.ZOOM_MOUSE_WHEEL,(function(e){i.fireEvent(n.Zoom,e.data)})),this.viewerFloor.addEventListener(s.Floor_Plane_Changed,(function(e){if(null!=e.elevation){"string"==typeof e.elevation&&(e.elevation=parseFloat(e.elevation));var t=o.viewer.getViewer(),i=t.camera,n=e.elevation;window.requestAnimationFrame((()=>{var e=o.viewer.sceneToWorld(i.position.clone()),s=new THREE.Vector3(e.x,e.y,n+l._manHeight);const r=t.getBoundingBoxWorld();s.z=Math.min(s.z,o.viewer.globalUnitUtil.revertTranslate(r.max.z));var a=o.viewer.worldToScene(s);t.cameraControl.flyToPointWithParallelEye(new THREE.Vector3(a.x,a.y,a.z)),window.requestAnimationFrame((()=>l._opt.viewer.fireEvent("MiniMapOperate")))}))}})),l.viewerFloor.enableFloorPlaneChangedEvent(!1),l._hasFloor)if(this._useEngineMap){let e=this;e.viewerFloor.setFlip(!0);let t=o.viewer.getViewer();e.mapManager=new Glodon$1.Bimface.Plugins.Map.MapManager({viewer:o.viewer});const i=this._axisGrids,n=this._floors;let s={};s.maxPixel=e._opt.maxPixel,s.height=[],s.boundingbox=[],s.useBorder=!1;const r=i.Levels;for(let i=0;i<n.length;i++){const a=r.find((({id:e})=>e==n[i].id));if(a){const r=e.viewerFloor.vfData.getDataFloorPlanes().getFloorPlaneBox(n[i].id);let l=o.viewer.globalUnitUtil.translateBBox(new THREE.Box3(new THREE.Vector3(r.Min.X,r.Min.Y,r.Min.Z),new THREE.Vector3(r.Max.X,r.Max.Y,r.Max.Z)));l.applyMatrix4((new THREE.Matrix4).fromArray(e._opt.viewer.getModel(n[i].modelId)._getModelTransformation())),l.applyMatrix4(t.getScene().getMatrixGlobal()),s.boundingbox.push(l);let h=new THREE.Vector3(0,0,a.elevation);h.applyMatrix4((new THREE.Matrix4).fromArray(e._opt.viewer.getModel(n[i].modelId)._getModelTransformation())),s.height.push(o.viewer.globalUnitUtil.translate(h.z))}}let a=t=>{for(let e=0;e<t.length;e++)n[e].path=t[e];if(n.length>0){var i=n.getObjectByAttribute("name",this.defaultFloorPlane);0==i?this.showFloorById(n[0].id):this.showFloorById(i.id)}e.viewerFloor.enableFloorPlaneChangedEvent(!0),e._inited=!0};s.successCallback=a,e.mapManager.removeCreateMapEvent(),e.mapManager.createMapByHeight(s)}else{const e=this._floors;if(e.length>0){var a=e.getObjectByAttribute("name",this.defaultFloorPlane);0==a?this.showFloorById(e[0].id):this.showFloorById(a.id)}l.viewerFloor.enableFloorPlaneChangedEvent(!0),l._inited=!0}else{var l;(l=this).viewerFloor.setFlip(!0);const e=o.viewer,t=e.globalUnitUtil.revertBBox(e.getViewer().getBoundingBoxWorld()),i={Min:t.min,Max:t.max};l.mapManager=new Glodon$1.Bimface.Plugins.Map.MapManager({viewer:e});let n=e.getCamera().getStatus().position.z;n=Math.floor(Math.min(Math.max(n,t.min.z),t.max.z));let s=n=>{let o=e.getCamera().getStatus().position.z;o=Math.floor(Math.min(Math.max(o,t.min.z),t.max.z));let s=[];s.push({id:o,name:"top",elevation:o}),s.push({id:t.min.z,name:o.toString(),elevation:t.min.z});let r={Grids:[],Levels:s};l.viewerFloor.setAxisGridData(r);let a=[];a.push({id:o,name:o,path:n,BoundingBox:i}),l._floors=a,l.viewerFloor.setPlanes(a),l.showFloorById(o),l._inited=!0},r={};r.maxPixel=l._opt.maxPixel,r.spacing=l._refreshHeight,r.successCallback=s,l.mapManager.removeCreateMapEvent(),l.mapManager.createMapByCamera(r),e.getViewer().getModelManager().dispatchEvent({type:CLOUD$1.EVENTS.ON_CAMERA_CHANGED_AND_RENDERED})}},setDefaultFloorPlane:function(e){for(var t=this._floors,i=0;i<t.length;i++)if(t[i].name==e){this.viewerFloor;this.getEventManager().fireEvent("FloorPlaneChanged",e);var n=t.getObjectByAttribute("name",e);return helpershowFloorById(n.id),!0}return!1},getFloorList:function(){return this._floors},getDefaultFloorPlane:function(){return this.defaultFloorPlane},getBoundingBox:function(){return this.viewerFloor.getBoundingBoxIsolate()},showFloorById:function(e,t){this.viewerFloor.setFloorPlaneId(e,t),this.viewerFloor.destroy(),this.viewerFloor.rebuildData(),this.viewerFloor.render(),t&&(this._modelId=t)},resize:function(e,t,i){var n=this._opt.domElement;n.style.width=e+"px",n.style.height=t+"px",this.viewerFloor.resize(e,t,i),this.getEventManager().fireEvent("Resize",{width:e,height:t})},setPlaneChangedCallback:function(e){this.addEventListener("FloorPlaneChanged",(function(t){e&&e(t)}))},setMinimapResizeCallback:function(e){this.addEventListener("Resize",(function(t){e&&e(t)}))},setNavigationMode:function(e){var t=this._opt,i=this.viewerFloor;t.navigationMode=e,i.setMapClickMode(t.navigationMode.toLocaleLowerCase())},clear:function(){this.viewerFloor.clearRectPick()},clearZoomAndPan:function(){this.viewerFloor.clearZoomAndPan();let e=this.EventType;this.viewerFloor.getEventManager().dispatchEvent({type:e.ZOOM_MOUSE_WHEEL,data:{offsetX:0,offsetY:0,zoomFactor:1}})},getMapContainer:function(){return this.viewerFloor.getMapContainer()},getFloorPlaneName:function(){return this.viewerFloor.getFloorPlaneName()},getAxisGridBox2D:function(){return this.viewerFloor.getAxisGridBox2D()},exit:function(){var e=this;e._opt.viewer.getViewer().removeCallbacks("render",e.renderCB),e.clear(),e.mapManager&&e.mapManager.destroy()}},i.Map=o}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.NavigationMap").NavigationMapConfig=function(){return{viewer:null,domElement:null,successCallback:null,failureCallback:null,type:"Relevance",mapAnchors:null,modelAnchors:null,url:null,PDFId:void 0,drawingId:void 0,height:0}},function(){let e=Object.freeze({MouseClicked:"MouseClicked",MapChanged:"MapChanged"});var t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.NavigationMap");t.NavigationMapEvent=e,t.MapViewerEvent=e}();var extendStatics$1=function(e,t){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},extendStatics$1(e,t)};function __extends$1(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics$1(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var EditorName$1,DrawableItem$1=function(){function e(){this.xmlns="http://www.w3.org/2000/svg",this.material=null,this.svgNode=null,this.children=[],this.glodonColor="#11DAB7",this.position=new THREE.Vector2}return e.prototype.add=function(e){this.children.push(e)},e.prototype.getSvgNode=function(){return this.svgNode},e.prototype.abtainRenderables=function(e){e.appendChild(this.svgNode)},e.prototype.isMatch=function(e){return this.name==e},e.prototype.highlight=function(){this.svgNode.setAttribute("style","stroke:"+this.glodonColor)},e.prototype.cancelHighlight=function(){this.svgNode.setAttribute("style","stroke:"+this.material.color.getStyle())},e.prototype.locate=function(e,t){this.position.set(e,t),this.move(0,0)},e.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t;this.svgNode.setAttribute("transform","translate("+i+","+n+")")},e}(),Algorithm$1=function(){function e(){this._boxSize=new THREE.Vector2,this._boxCenter=new THREE.Vector2,this._intersect=new THREE.Vector3}return e.prototype.cross=function(e,t,i,n){return(t.x-e.x)*(n.y-i.y)-(t.y-e.y)*(n.x-i.x)},e.prototype.getArea=function(e,t,i){return this.cross(e,t,e,i)},e.prototype.getAbsArea=function(e,t,i){return Math.abs(this.getArea(e,t,i))},e.prototype.getInterPoint=function(e,t,i,n){var o=this.getAbsArea(e,t,i),s=this.getAbsArea(e,t,n);return new THREE.Vector2((n.x*o+i.x*s)/(o+s),(n.y*o+i.y*s)/(o+s))},e.prototype.isAngleGreaterThanPi=function(e,t,i){var n=new THREE.Vector3;return n.crossVectors(e,t),!(n.dot(i)>=0)},e.prototype.normalizedPointToScreen=function(e,t){e.x=e.x*t.width,e.y=-e.y*t.height},e.prototype.screenToNormalizedPoint=function(e,t){e.x=e.x/t.width,e.y=-e.y/t.height},e.prototype.normalizedPointToWorld=function(e,t){t.getSize(this._boxSize),e.x=.5*(e.x+1)*this._boxSize.x+t.min.x,e.y=.5*(e.y+1)*this._boxSize.y+t.min.y},e.prototype.worldToNormalizedPoint=function(e,t){t.getSize(this._boxSize),e.x=(e.x-t.min.x)/this._boxSize.x*2-1,e.y=(e.y-t.min.y)/this._boxSize.y*2-1},e.prototype.toWorldPoint=function(e,t,i,n){e.x<0&&(e.x=0),e.x>t&&(e.x=t),e.y<0&&(e.y=0),e.y>i&&(e.y=i),e.x=e.x/t*2-1,e.y=-e.y/i*2+1,this.normalizedPointToWorld(e,n)},e.prototype.getCuttingBoxOnCanvas=function(e,t,i,n){var o=new THREE.Box3,s=new THREE.Vector2(e.x,e.y),r=new THREE.Vector2(t.x,t.y);this.toWorldPoint(s,i[0],i[1],n),this.toWorldPoint(r,i[0],i[1],n);var a=[];return a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,s.y)),a.push(new THREE.Vector3(r.x,s.y)),o.setFromPoints(a),{min:{x:o.min.x,y:o.min.y,z:0},max:{x:o.max.x,y:o.max.y,z:0}}},e.prototype.canvasPointToClient=function(e,t){var i=t.mapContainer;if(!i||!t.floorPlaneBox)return null;var n=this.getContainerOffsetToClient(i);if(0===n.width||0===n.height)return null;var o=new THREE.Vector2;return o.x=e.x+n.left,o.y=e.y+n.top,o},e.prototype.getMainSceneMatrix=function(e){return e.getScene().getMatrixGlobal()},e.prototype.transformWorldPoint=function(e,t){var i=this.getMainSceneMatrix(e);e.miniMapTransform&&t.applyMatrix4((new THREE.Matrix4).fromArray(e.miniMapTransform)),t.applyMatrix4(i)},e.prototype.expandBbox=function(e,t){var i=e.getCenter(this._boxCenter);e.getSize(this._boxSize);var n=new THREE.Vector2,o=t,s=this._boxSize.x/this._boxSize.y,r=this._boxSize.x,a=this._boxSize.y;s>o?a=r/o:s<o&&(r=a*o),n.set(r,a),e.setFromCenterAndSize(i,n)},e.prototype.containsPointInMainScene=function(e,t){var i=e.getScene().getBoundingBoxWorld();return!!i&&i.containsPoint(t)},e.prototype.isMouseOverCanvas=function(e,t,i){if(e){var n=this.getContainerOffsetToClient(e),o=new THREE.Vector2;if(o.x=i.x-n.left,o.y=i.y-n.top,0===n.width||0===n.height)return!1;var s={width:t[0],height:t[0]};if(o.x>0&&o.x<s.width&&o.y>0&&o.y<s.height)return!0}return!1},e.prototype.normalizePoint=function(e,t,i){var n=new THREE.Vector2;if(e){var o=this.getContainerOffsetToClient(e),s=new THREE.Vector2;s.x=i.x-o.left,s.y=i.y-o.top;var r={width:t[0],height:t[1]};if(s.x>0&&s.x<r.width&&s.y>0&&s.y<r.height)return n.x=s.x/r.width*2-1,n.y=-s.y/r.height*2+1,new THREE.Vector2(n.x,n.y)}return null},e.getIntersectionByPoint=function(e,t,i){void 0===i&&(i=3);for(var n=null,o=i*i,s=0,r=e.length;s<r;s++){var a=e[s].intersectionPoint;if(a)if(a.distanceToSquared(t)<o){n=e[s];break}}return n},e.prototype.flyToPointWithParallelEye=function(e,t){e.cameraControl.flyToPointWithParallelEye(t)},e.prototype.getIntersectionToMinDistance=function(e,t){if(e.length<1)return null;for(var i=0,n=0,o=0,s=e.length;o<s;o++){var r=e[o];if(r.intersectionPoint){var a=new THREE.Vector2(r.intersectionPoint.x,r.intersectionPoint.y).distanceToSquared(t);0==i?i=a:i>a&&(i=a,n=o)}}return e[n]},e.prototype.getAxisGridInfoByNormalizedPoint=function(e,t){var i=t.clone(),n=e.naviData.getAxisGridBox2D();this.normalizedPointToWorld(i,n);var o=t.clone(),s={width:e.svgHalfWidth,height:e.svgHalfHeight};this.normalizedPointToScreen(o,s);var r=this.getIntersectionToMinDistance(e.naviData.getAxisGridIntersectionPoints(),o);if(r&&r.intersectionPoint){var a=new THREE.Vector2(r.intersectionPoint.x,r.intersectionPoint.y);this.screenToNormalizedPoint(a,s),this.normalizedPointToWorld(a,n);var l=Math.round(i.x-a.x),h=Math.round(i.y-a.y);return{position:i,abcName:r.abcName,numeralName:r.numeralName,offsetX:l,offsetY:h}}return{position:new THREE.Vector3,abcName:"",numeralName:"",offsetX:"",offsetY:""}},e.prototype.getAxisGridInfoByPoint=function(e,t){var i=this.getMainSceneMatrix(e.viewer),n=new THREE.Matrix4;n.copy(i).invert();var o=t.clone();o.applyMatrix4(n);var s=o.clone(),r={width:e.svgHalfWidth,height:e.svgHalfHeight},a=e.naviData.getAxisGridBox2D();this.worldToNormalizedPoint(s,a),this.normalizedPointToScreen(s,r);var l=this.getIntersectionToMinDistance(e.naviData.getAxisGridIntersectionPoints(),s);if(l&&l.intersectionPoint){var h=new THREE.Vector2(l.intersectionPoint.x,l.intersectionPoint.y);this.screenToNormalizedPoint(h,r),this.normalizedPointToWorld(h,a);var d=Math.round(o.x-h.x),c=Math.round(o.y-h.y);return{position:o,abcName:l.abcName,numeralName:l.numeralName,offsetX:d,offsetY:c}}return{position:new THREE.Vector3,abcName:"",numeralName:"",offsetX:"",offsetY:""}},e.prototype.calculateEdgePositionCameraOutBounds=function(e,t,i){var n=function(e,t){for(var i=!1,n=0,o=e.length;n<o;n++)if(this.isEqualBetweenPoints(t,e[n],this.epsilon)){i=!0;break}return i},o=i.clone();if(o.min.x-=.5,o.min.y-=.5,o.max.x+=.5,o.max.y+=.5,!o.containsPoint(e)){var s=[],r=new THREE.Vector3(e.x,e.y,0),a=new THREE.Ray(r,t),l=new THREE.Vector3(i.min.x,i.min.y,0),h=new THREE.Vector3(-1,0,0),d=new THREE.Plane;if(d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&s.push(this._intersect),l.set(i.max.x,i.max.y,0),h.set(-1,0,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&s.push(this._intersect),l.set(i.min.x,i.min.y,0),h.set(0,1,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&(n(this._intersect,s)||s.push(this._intersect)),l.set(i.max.x,i.max.y,0),h.set(0,1,0),d.setFromNormalAndCoplanarPoint(h,l),a.intersectPlane(d,this._intersect),this._intersect&&o.containsPoint(this._intersect)&&(n(this._intersect,s)||s.push(this._intersect)),2!=s.length)return null;var c=s[0],u=s[1].clone().sub(c).normalize();return this.isEqualBetweenPoints(u,t,1e-5)?s[0]:s[1]}return null},e.prototype.getContainerOffsetToClient=function(e){var t,i;if(e!=document){var n=(i=e).getBoundingClientRect?function(e){var t=e.getBoundingClientRect(),i=document.body,n=document.documentElement,o=n.clientTop||i.clientTop,s=n.clientLeft||i.clientLeft,r=t.top-o,a=t.left-s;return{top:Math.round(r),left:Math.round(a)}}(i):function(e){for(var t=0,i=0;e;)t+=e.offsetTop,i+=e.offsetLeft,e=e.offsetParent;var n=document.body,o=document.documentElement;return{top:t-=window.pageYOffset||o.scrollTop||n.scrollTop,left:i-=window.pageXOffset||o.scrollLeft||n.scrollLeft}}(i);t={width:e.offsetWidth,height:e.offsetHeight,left:n.left,top:n.top}}else t={width:window.innerWidth,height:window.innerHeight,left:0,top:0};return t},e.prototype.isEqualBetweenPoints=function(e,t,i){i=i||1e-4;var n=e.x-t.x,o=e.y-t.y;return!(Math.sqrt(n*n+o*o)>i)},e}(),GridLine$1=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.start=t,s.end=i,s.material=n,s.name=o,s.build(),s}return __extends$1(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"line");e.setAttribute("x1",this.start.x),e.setAttribute("y1",this.start.y),e.setAttribute("x2",this.end.x),e.setAttribute("y2",this.end.y);var t=this.material;t instanceof THREE.LineBasicMaterial&&e.setAttribute("style","fill: none; stroke: "+t.color.getStyle()+"; stroke-width: "+t.linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.linecap+"; stroke-linejoin: "+t.linejoin),this.svgNode=e},t}(DrawableItem$1),GridLineArc$1=function(e){function t(t,i,n){var o=e.call(this)||this;return o.arcPoints=t,o.material=i,o.name=n,o.build(),o}return __extends$1(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"polyline");e.setAttribute("points",this.arcPoints.map((function(e){return e.x+","+e.y})).join(" "));var t=this.material;t instanceof THREE.LineBasicMaterial&&e.setAttribute("style","fill: none; stroke: "+t.color.getStyle()+"; stroke-width: "+t.linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.linecap+"; stroke-linejoin: "+t.linejoin),this.svgNode=e},t}(DrawableItem$1),TipText$1=function(e){function t(t,i){var n=e.call(this)||this;return n.center=t,n.literal=i,n.fontSize=8,n.textColor=new THREE.Color(.6,.6,.6),n.build(),n}return __extends$1(t,e),t.prototype.build=function(){var e=this.center.x,t=this.center.y;if("NaN"!=e.toString()&&"NaN"!=t.toString()){var i=document.createElementNS(this.xmlns,"text");i.setAttribute("style","font-size:"+this.fontSize+"px; fill: none; stroke: "+this.textColor.getStyle()+"; stroke-width: 1"),i.innerHTML=this.literal,i.textContent=this.literal,i.getBoundingClientRect();var n=e-3.5,o=t+2.8;this.svgNode=i,this.locate(n,o)}},t}(DrawableItem$1),AxisNotation$1=function(e){function t(t,i){var n=e.call(this)||this;return n.name=i,n.labelPoints=t,n.build(),n}return __extends$1(t,e),t.prototype.build=function(){var e=this;this.labelPoints.forEach((function(t){e.add(new TipText$1(t,e.name))}))},t.prototype.abtainRenderables=function(e){for(var t=0;t<this.children.length;t++){this.children[t].abtainRenderables(e)}},t.prototype.move=function(e,t){this.children.forEach((function(i){i.move(e,t)}))},t}(DrawableItem$1),AxisGrid$1=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.intersections=[],s.lineElements=[],s.horizLineElements=[],s.verticalLineElements=[],s.width=i[0],s.height=i[1],s.bIsShowAxisGrid=n,s.multiplyZoomFactor=o,s.algorithm=new Algorithm$1,s.materialGrid=new THREE.LineBasicMaterial({color:10066329,linewidth:.5}),s.children=[],s.resourceGrids=t,s.boundingBox=new THREE.Box2,s.realBoundingBox=new THREE.Box2,s.clipBox2D=new THREE.Box2(new THREE.Vector2(-s.width/2,-s.height/2),new THREE.Vector2(s.width/2,s.height/2)),s.axisGridNumberInterval=3,s.scratchVector=new THREE.Vector3,s.boxSize=new THREE.Vector2,s.isValid()&&s.build(),s}return __extends$1(t,e),t.prototype.build=function(){var e=this,t=this.getAxisGridBox(),i={width:this.width/2,height:this.height/2},n=function(n){var o=new THREE.Vector2(n.x,n.y);return e.algorithm.worldToNormalizedPoint(o,t),e.algorithm.normalizedPointToScreen(o,i),o},o=this.materialGrid;this.resourceGrids.forEach((function(t){var i=t.name,s=t.geometry,r=t.label;s.forEach((function(t){if("Line"===t.lineType){var s=t.startPoint,r=t.endPoint,a=n(s),l=n(r),h=l.clone().sub(a).normalize();e.add(new GridLine$1(a,l,o,i)),Math.abs(h.x)>=Math.abs(h.y)?e.horizLineElements.push({name:i,v1:a,v2:l,material:o}):e.verticalLineElements.push({name:i,v1:a,v2:l,material:o})}else if("Arc"===t.lineType){var d=t.points.map(n);e.add(new GridLineArc$1(d,o,i))}}));var a=r.positions.map(n);e.add(new AxisNotation$1(a,i))})),this.lineElements.push(this.horizLineElements),this.lineElements.push(this.verticalLineElements),this.calculateIntersections()},t.prototype.calculateAxisGridBox=function(e,t,i){var n=this;this.boundingBox.makeEmpty(),this.resourceGrids.forEach((function(e){e.geometry.forEach((function(e){if("Line"===e.lineType){var t=e.startPoint,i=e.endPoint,o=new THREE.Vector2(t.x,t.y),s=new THREE.Vector2(i.x,i.y);e.points=[o,s]}else if("Arc"===e.lineType){var r=window.CLOUD.AxisGridManager.getArcGridPoints(e);e.points=r}e.points.forEach((function(e){return n.boundingBox.expandByPoint(e)}))}))})),this.realBoundingBox=this.boundingBox.clone();var o=this.boundingBox.getCenter(this.scratchVector);this.boundingBox.getSize(this.boxSize);var s=new THREE.Vector2,r=e/t,a=this.boxSize.x/this.boxSize.y,l=this.boxSize.x,h=this.boxSize.y,d=4*(i+4)*this.multiplyZoomFactor;a>r?(this.bIsShowAxisGrid&&(l=this.boxSize.x*e/(e-d)),h=l/r):a<r&&(this.bIsShowAxisGrid&&(h=this.boxSize.y*t/(t-d)),l=h*r),s.set(l,h),this.boundingBox.setFromCenterAndSize(o,s)},t.prototype.getAxisGridBox=function(e){return this.isValid()&&this.calculateAxisGridBox(this.width,this.height,10),e?this.realBoundingBox:this.boundingBox},t.prototype.isEmpty=function(){return this.boundingBox.getSize(this.boxSize),0==this.boxSize.length()},t.prototype.isValid=function(){return!!this.resourceGrids},t.prototype.calculateIntersections=function(){for(var e,t,i,n,o,s,r,a,l=this.horizLineElements.length,h=this.verticalLineElements.length,d=0;d<l;d++){n=(e=this.horizLineElements[d]).name,o=e.v1.clone(),s=e.v2.clone();for(var c=0;c<h;c++){i=(t=this.verticalLineElements[c]).name,r=t.v1.clone(),a=t.v2.clone();var u=!1;r.x<=Math.max(o.x,s.x)&&r.x>=Math.min(o.x,s.x)&&o.y<=Math.max(r.y,a.y)&&o.y>=Math.min(r.y,a.y)&&(u=!0);var p=null;u&&(p=this.algorithm.getInterPoint(o,s,r,a)),this.intersections.push({intersectionPoint:p,horizLine:[o.clone(),s.clone()],verticalLine:[r.clone(),a.clone()],abcName:n,numeralName:i})}}},t.prototype.getIntersections=function(){return this.intersections},t.prototype.abtainRenderables=function(e){for(var t=0;t<this.children.length;t++){this.children[t].abtainRenderables(e)}},t.prototype.getGridLineByName=function(e){for(var t=this.children,i=0;i<t.length;i++){var n=t[i];if(n instanceof GridLine$1&&n.isMatch(e))return n}},t.prototype.move=function(e,t){this.children.forEach((function(i){i.move(e,t)}))},t}(DrawableItem$1),FloorPlane$1=function(e){function t(t,i,n){var o=e.call(this)||this;return o.imageUrl=t,o.width=i[0],o.height=i[1],o.offsetX=i[2],o.offsetY=i[3],o.isFlip=n,o.build(),o}return __extends$1(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"image");e.href.baseVal=this.imageUrl,e.setAttribute("herf",this.imageUrl),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("width",this.width+""),e.setAttribute("height",this.height+""),e.setAttribute("x",-.5*this.width+""),e.setAttribute("y",-.5*this.height+""),this.isFlip&&e.setAttribute("transform","scale(-1,1)"),this.svgNode=e,this.locate(this.offsetX,this.offsetY)},t.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t;return this.isFlip?this.svgNode.setAttribute("transform","translate("+i+", "+n+")\n scale("+"-1,1)"):this.svgNode.setAttribute("transform","translate("+i+","+n+")"),{x:i,y:n}},t}(DrawableItem$1);!function(e){e.Default="Editor",e.PICK_Editor="Pick",e.RECTPICK_Editor="RectPick",e.PAN_Editor="Pan",e.Zoom_Editor="Zoom"}(EditorName$1||(EditorName$1={}));var EventType$1,MouseEventType$1,VFSizeMode$1,Editor$1=function(){function e(){this.bIsMouseDown=!1,this.name=EditorName$1.Default}return e.prototype.onMouseDown=function(e){},e.prototype.onMouseMove=function(e){},e.prototype.onMouseUp=function(e){},e.prototype.onMouseWheel=function(e){},e.prototype.getName=function(){return this.name},e}();!function(e){e[e.RECTPICK_MOUSE_DOWN=1e3]="RECTPICK_MOUSE_DOWN",e[e.RECTPICK_MOUSE_MOVE=1001]="RECTPICK_MOUSE_MOVE",e[e.RECTPICK_MOUSE_UP=1002]="RECTPICK_MOUSE_UP",e[e.PICK_MOUSE_DOWN=2e3]="PICK_MOUSE_DOWN",e[e.PICK_MOUSE_MOVE=2001]="PICK_MOUSE_MOVE",e[e.PICK_MOUSE_UP=2002]="PICK_MOUSE_UP",e[e.Floor_Plane_Changed=3e3]="Floor_Plane_Changed",e[e.Floor_Plane_Changed_For_Panel=3001]="Floor_Plane_Changed_For_Panel",e[e.Resize=4e3]="Resize",e[e.Camera_Height_Changed=5e3]="Camera_Height_Changed",e[e.ZOOM_MOUSE_WHEEL=6e3]="ZOOM_MOUSE_WHEEL",e[e.PAN_MOUSE_MOVE=7e3]="PAN_MOUSE_MOVE",e[e.Minimap_Rect_Changed=8e3]="Minimap_Rect_Changed",e[e.Minimap_Rect_Destroyed=8001]="Minimap_Rect_Destroyed"}(EventType$1||(EventType$1={})),function(e){e[e.Left=0]="Left",e[e.Middle=1]="Middle",e[e.Right=2]="Right"}(MouseEventType$1||(MouseEventType$1={})),function(e){e.Min="Min",e.Max="Max"}(VFSizeMode$1||(VFSizeMode$1={}));var EditorName$2,ZoomEditor$1=function(e){function t(t,i){var n=e.call(this)||this;return n.totalZoomFactors=[],n.zoomFactors=[],n.lastZoomFactor=1,n.currentIdx=0,n.name=EditorName$1.Zoom_Editor,n.eventManager=i,n.vfData=t.getData(),n.vfViewer=t,n}return __extends$1(t,e),t.prototype.onMouseWheel=function(e){var t=(e.deltaY||-e.wheelDelta||e.detail)<0,i=-1;if(t?this.currentIdx<this.zoomFactors.length-1&&(this.currentIdx++,i=this.zoomFactors[this.currentIdx]):this.currentIdx>0&&(this.currentIdx--,i=this.zoomFactors[this.currentIdx]),!(i<0||this.lastZoomFactor==i)){this.lastZoomFactor=i,1==i&&PanEditor$1.clear();var n=this.vfData.getOriginSize(),o=new THREE.Vector2(e.offsetX-n[0]/2,e.offsetY-n[1]/2),s=this.zoomFactors[this.currentIdx],r=0,a=0;if(t){var l=s/(u=this.zoomFactors[this.currentIdx-1]),h=[],d=this.vfData.getCorner("Virtual","LB");d[0]-=o.x,d[1]-=o.y,h.push(d[0]*l+o.x),h.push(d[1]*l+o.y),this.vfData.setZoomFactor(s);var c=this.vfData.getCorner("Virtual","LB");this.vfData.setZoomFactor(u),r=h[0]-c[0],a=h[1]-c[1]}else{var u=this.zoomFactors[this.currentIdx+1],p=this.boundsChecking(s,u,o);r=p[0],a+=p[1]}PanEditor$1.panOffsetX+=r,PanEditor$1.panOffsetY+=a,PanEditor$1.panOffsetXForCamera+=r,PanEditor$1.panOffsetYForCamera+=a,this.vfData.setZoomFactor(i),this.vfViewer.destroy(),this.vfData.destroy(),this.vfData.build(),this.vfViewer.update(),this.vfData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType$1.ZOOM_MOUSE_WHEEL,data:{offsetX:PanEditor$1.panOffsetX,offsetY:PanEditor$1.panOffsetY,zoomFactor:i}})}},t.prototype.boundsChecking=function(e,t,i){var n=e/t,o=this.vfData.getCorner("Virtual","LB"),s=this.vfData.getCorner("Virtual","LT"),r=this.vfData.getCorner("Virtual","RT"),a=this.vfData.getCorner("Virtual","RB"),l=[0,0],h=(o[0]-i.x)*n+i.x,d=(o[1]-i.y)*n+i.y;this.vfData.setZoomFactor(e);var c=this.vfData.getCorner("Virtual","LB");this.vfData.setZoomFactor(t),l[0]=h-c[0],l[1]=d-c[1];var u=0,p=0,g=this.vfData.getCorner("Origin","LB");h>g[0]&&(l[0]+=g[0]-h,u++),d<g[1]&&(l[1]+=g[1]-d,p++),h=(s[0]-i.x)*n+i.x,d=(s[1]-i.y)*n+i.y;var m=this.vfData.getCorner("Origin","LT");h>m[0]&&0==u&&(l[0]+=m[0]-h,u++),d>m[1]&&0==p&&(l[1]+=m[1]-d,p++),h=(r[0]-i.x)*n+i.x,d=(r[1]-i.y)*n+i.y;var f=this.vfData.getCorner("Origin","RT");h<f[0]&&0==u&&(l[0]+=f[0]-h,u++),d>f[1]&&0==p&&(l[1]+=f[1]-d,p++),h=(a[0]-i.x)*n+i.x,d=(a[1]-i.y)*n+i.y;var w=this.vfData.getCorner("Origin","RB");return h<w[0]&&0==u&&(l[0]+=w[0]-h,u++),d<w[1]&&0==p&&(l[1]+=w[1]-d,p++),l},t.prototype.enableMode=function(e){if(e==VFSizeMode$1.Min)this.zoomFactors=this.totalZoomFactors;else if(e==VFSizeMode$1.Max){this.zoomFactors=this.totalZoomFactors.slice(1,this.totalZoomFactors.length);for(var t=1;t<this.zoomFactors.length;t++)this.zoomFactors[t]/=this.zoomFactors[0];this.zoomFactors[0]=1}this.currentIdx=0},t.prototype.setZoomFactors=function(e){this.totalZoomFactors=e,this.zoomFactors=e},t.prototype.setZoonIndex=function(e){this.currentIdx=e},t.prototype.getZoonIndex=function(){return this.currentIdx},t.prototype.updateZoomAndPan=function(){var e=this.vfData.getCorner("Origin","LT"),i=this.vfData.getCorner("Virtual","LT");t.offsetXForZoomAndPan=e[0]-i[0],t.offsetYForZoomAndPan=e[1]-i[1]},t.clear=function(){t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0},t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0,t}(Editor$1),PanEditor$1=function(e){function t(i,n){var o=e.call(this)||this;return o.name=EditorName$1.PAN_Editor,o.eventManager=n,o.vfData=i.getData(),o.bIsMouseDown=!1,o.mouseDownPos=new THREE.Vector2,t.panOffsetX=0,t.panOffsetY=0,o}return __extends$1(t,e),t.prototype.onMouseDown=function(e){this.bIsMouseDown=!0,this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)},t.prototype.onMouseMove=function(e){if(0!=this.bIsMouseDown&&1!=this.vfData.getZoomFactor()){var i=e.clientX-this.mouseDownPos.x,n=e.clientY-this.mouseDownPos.y,o=this.boundsChecking(i,n);i=o[0],n=o[1],t.panOffsetX+=i,t.panOffsetY+=n,t.panOffsetXForCamera+=i,t.panOffsetYForCamera+=n,this.vfData.updateMovement(),this.updateZoomAndPan(),this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)}},t.prototype.onMouseUp=function(e){if(0!=this.bIsMouseDown&&1!=this.vfData.getZoomFactor()){var i=e.clientX-this.mouseDownPos.x,n=e.clientY-this.mouseDownPos.y,o=this.boundsChecking(i,n);i=o[0],n=o[1],t.panOffsetX+=i,t.panOffsetY+=n,t.panOffsetXForCamera+=i,t.panOffsetYForCamera+=n,this.vfData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType$1.PAN_MOUSE_MOVE,data:{offsetX:t.panOffsetX,offsetY:t.panOffsetY,zoomFactor:this.vfData.getZoomFactor()}}),this.bIsMouseDown=!1}},t.prototype.boundsChecking=function(e,t){var i=this.vfData.getCorner("Origin","LB"),n=this.vfData.getCorner("Virtual","LB"),o=this.vfData.getCorner("Origin","RT"),s=this.vfData.getCorner("Virtual","RT");if(e>0)(r=i[0]-n[0])<=e&&(e=r);else if(e<0){var r;(r=o[0]-s[0])>=e&&(e=r)}if(t<0)(a=i[1]-n[1])>=t&&(t=a);else if(t>0){var a;(a=o[1]-s[1])<=t&&(t=a)}return[e,t]},t.prototype.updateZoomAndPan=function(){var e=this.vfData.getCorner("Origin","LT"),t=this.vfData.getCorner("Virtual","LT");ZoomEditor$1.offsetXForZoomAndPan=e[0]-t[0],ZoomEditor$1.offsetYForZoomAndPan=e[1]-t[1]},t.clear=function(){t.panOffsetX=0,t.panOffsetY=0,t.panOffsetXForCamera=0,t.panOffsetYForCamera=0},t}(Editor$1),CameraNode$1=function(e){function t(){var t=e.call(this)||this;return t.cameraCircleNode=null,t.cameraArrowNode=null,t.rotateAngle=0,t.panelSize=[298,198],t.cameraPositionToTarget=2e3,t.build(),t}return __extends$1(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"g");e.setAttribute("fill","none"),e.setAttribute("fill-rule","evenodd"),e.setAttribute("stroke-width","1");var t=document.createElementNS(this.xmlns,"circle");t.setAttribute("r","4.5"),t.setAttribute("stroke","#FFFFFF"),t.setAttribute("fill","#32D3A6"),this.cameraCircleNode=t;var i=document.createElementNS(this.xmlns,"path");i.setAttribute("d","M5.94925387,0 C18.4132389,0 28.6581001,9.50119823 29.8362478,21.6560048 L5.94925387,25 Z"),i.setAttribute("fill","url(#radialGradient-1)"),i.setAttribute("transform","translate(13,-21)rotate(50)"),this.cameraArrowNode=i;var n=document.createElementNS(this.xmlns,"defs"),o=document.createElementNS(this.xmlns,"radialGradient"),s=document.createElementNS(this.xmlns,"stop"),r=document.createElementNS(this.xmlns,"stop");o.setAttribute("cx","0%"),o.setAttribute("cy","100%"),o.setAttribute("fx","0%"),o.setAttribute("fy","100%"),o.setAttribute("r","104.321936%"),o.setAttribute("id","radialGradient-1"),s.setAttribute("stop-color","#36D4A8"),s.setAttribute("offset","0%"),r.setAttribute("stop-color","#36D4A8"),r.setAttribute("offset","100%"),r.setAttribute("stop-opacity","0"),n.append(o),o.append(s),o.append(r),e.appendChild(n),e.appendChild(t),e.appendChild(i),this.svgNode=e},t.prototype.setCircleAttribute=function(e,t){this.cameraCircleNode.setAttribute(e,t)},t.prototype.setArrowAttribute=function(e,t){this.cameraArrowNode.setAttribute(e,t)},t.prototype.rotate=function(e){e&&(this.rotateAngle=e);var t=this.svgNode.getAttribute("transform");t+="rotate("+this.rotateAngle+")",this.svgNode.setAttribute("transform",t)},t.prototype.setOffsetAndRotate=function(e,t,i){var n=this.setOffsetBoundary(e,t);this.locate(n.X,n.Y),this.rotate(i),PanEditor$1.panOffsetXForCamera=0,PanEditor$1.panOffsetYForCamera=0},t.prototype.move=function(e,t){var i=this.position.x+e,n=this.position.y+t,o=this.setOffsetBoundary(i,n);this.svgNode.setAttribute("transform","translate("+o.X+","+o.Y+")")},t.prototype.setOpacity=function(e){this.svgNode.setAttribute("opacity",e)},t.prototype.setCameraArrowOpacity=function(e){this.cameraArrowNode.setAttribute("opacity",e)},t.prototype.setCameraCircleOpacity=function(e){this.cameraCircleNode.setAttribute("opacity",e)},t.prototype.setBigCamera=function(){this.cameraCircleNode.setAttribute("r","4.5"),this.cameraArrowNode.setAttribute("transform","translate(13,-21)rotate(50)")},t.prototype.setSmallCamera=function(){this.cameraCircleNode.setAttribute("r","2"),this.cameraArrowNode.setAttribute("transform","translate(20,-21)rotate(50)")},t.prototype.setPanelSize=function(e){this.panelSize=e},t.prototype.setOffsetBoundary=function(e,t){var i=this.panelSize[0]/2-6,n=-this.panelSize[0]/2+6,o=this.panelSize[1]/2-6,s=-this.panelSize[1]/2+6;return e>=i||e<=n||t>=o||t<=s?this.setSmallCamera():this.setBigCamera(),e>i&&(e=i),e<n&&(e=n),t>o&&(t=o),t<s&&(t=s),{X:e,Y:t}},t}(DrawableItem$1),FloorPlanes$1=function(){function e(e){this.resourcePlanes=e}return e.prototype.find=function(e,t){for(var i=0;i<this.resourcePlanes.length;i++){var n=this.resourcePlanes[i];if(t){if(n.modelId==t&&n.id==e)return n}else if(n.id==e)return n}},e.prototype.getFloorPlaneBox=function(e,t){var i=this.find(e,t);return i?i.boundingBox||i.BoundingBox:void 0},e.prototype.getUrl=function(e,t){var i=this.find(e,t);return i?i.path||i.Path:void 0},e.prototype.getElevation=function(e,t){var i=this.find(e,t);return i?i.Elevation:void 0},e.prototype.getName=function(e,t){var i=this.find(e,t);return i?i.name||i.Name:void 0},e}(),NavigationMapAlgorithm=function(e){function t(){return e.call(this)||this}return __extends$1(t,e),t.prototype.getCuttingBoxOnCanvas=function(e,t,i,n){var o=new THREE.Box3,s=new THREE.Vector2(e.x,e.y),r=new THREE.Vector2(t.x,t.y);this.toWorldPoint(s,i[0],i[1],n),this.toWorldPoint(r,i[0],i[1],n);var a=[];return a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,s.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(s.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,r.y)),a.push(new THREE.Vector3(r.x,s.y)),a.push(new THREE.Vector3(r.x,s.y)),o.setFromPoints(a),{min:{x:o.min.x,y:o.min.y,z:0},max:{x:o.max.x,y:o.max.y,z:0}}},t.prototype.toWorldPoint=function(e,t,i,n){e.x<0&&(e.x=0),e.x>t&&(e.x=t),e.y<0&&(e.y=0),e.y>i&&(e.y=i),e.x=e.x/t*2-1,e.y=-e.y/i*2+1,n.normalizedPointToWorld(e)},t.prototype.normalizePointByZoomFactor=function(e,t,i,n){var o=new THREE.Vector2;if(e){var s=this.getContainerOffsetToClient(e),r=new THREE.Vector2;r.x=i.x-s.left-(e.clientWidth*n-t[0])/2,r.y=i.y-s.top-(e.clientHeight*n-t[1])/2;var a={width:t[0],height:t[1]};if(r.x>0&&r.x<a.width&&r.y>0&&r.y<a.height)return o.x=r.x/a.width*2-1,o.y=-r.y/a.height*2+1,new THREE.Vector2(o.x,o.y)}return null},t}(Algorithm$1),CoordinateTransform=function(){function e(e,t){this.point2D=new THREE.Vector2;var i=e[0],n=e[1],o=t[0],s=t[1];i.x,o.x,i.y,o.y;var r=n.clone().sub(i).length()/s.clone().sub(o).length();i.x!==n.x?Math.atan((n.y-i.y)/(n.x-i.x)):i.x==n.x&&(n.y,i.y),o.x!==s.x?Math.atan((o.y-s.y)/(s.x-o.x)):o.x==s.x&&(s.y,o.y),this.rotateAngle=this.calculateRotateAngle(s.x-o.x,o.y-s.y,n.x-i.x,n.y-i.y);var a=(new THREE.Matrix3).translate(-o.x,o.y),l=(new THREE.Matrix3).translate(i.x,i.y),h=(new THREE.Matrix3).rotate(-this.rotateAngle),d=(new THREE.Matrix3).scale(r,r);this.mapToModelMatrix=l.clone().multiply(d).multiply(h).multiply(a);var c=(new THREE.Matrix3).translate(o.x,-o.y),u=(new THREE.Matrix3).translate(-i.x,-i.y),p=(new THREE.Matrix3).rotate(this.rotateAngle),g=(new THREE.Matrix3).scale(1/r,1/r);this.modelToMapMatrix=c.clone().multiply(p).multiply(g).multiply(u)}return e.prototype.calculateRotateAngle=function(e,t,i,n){var o=1e-6,s=Math.acos(-1),r=Math.sqrt(e*e+t*t);t/=r;var a=0,l=(e/=r)*(i/=r=Math.sqrt(i*i+n*n))+t*(n/=r);if(Math.abs(l-1)<=o)a=0;else if(Math.abs(l+1)<=o)a=s;else{a=Math.acos(l),e*n-i*t<0&&(a=2*s-a)}return a},e.prototype.getRotateAngle=function(){return this.rotateAngle},e.prototype.mapToModel=function(e){return new THREE.Vector2(e.x,-e.y).applyMatrix3(this.mapToModelMatrix)},e.prototype.modelToMap=function(e){this.point2D.set(e.x,e.y);var t=this.point2D.clone().applyMatrix3(this.modelToMapMatrix);return t.y=-t.y,t},e}(),HighlightPoint$1=function(e){function t(t,i){var n=e.call(this)||this;return n.radius=t,n.material=i,n.build(),n}return __extends$1(t,e),t.prototype.build=function(){var e=document.createElementNS(this.xmlns,"circle");e.setAttribute("r",this.radius+""),e.setAttribute("fill",this.glodonColor),e.setAttribute("style","fill: none; stroke: "+this.glodonColor),e.setAttribute("opacity","0"),this.svgNode=e},t.prototype.highlight=function(){this.svgNode.setAttribute("style","stroke:"+this.glodonColor),this.svgNode.setAttribute("opacity","1")},t.prototype.cancelHighlight=function(){this.svgNode.setAttribute("style","stroke:rgb(153,153,153)"),this.svgNode.setAttribute("opacity","0")},t.prototype.setOffset=function(e,t){this.svgNode.setAttribute("transform","translate("+e+","+t+")")},t}(DrawableItem$1);!function(e){e.Default="Editor",e.PICK_Editor="Pick",e.RECTPICK_Editor="RectPick",e.PAN_Editor="Pan",e.Zoom_Editor="Zoom"}(EditorName$2||(EditorName$2={}));var EventType$2,MouseEventType$2,Editor$2=function(){function e(){this.bIsMouseDown=!1,this.name=EditorName$2.Default}return e.prototype.onMouseDown=function(e){},e.prototype.onMouseMove=function(e){},e.prototype.onMouseUp=function(e){},e.prototype.onMouseWheel=function(e){},e.prototype.getName=function(){return this.name},e.prototype.scale=function(e,t,i){},e}();!function(e){e[e.RECTPICK_MOUSE_DOWN=1e3]="RECTPICK_MOUSE_DOWN",e[e.RECTPICK_MOUSE_MOVE=1001]="RECTPICK_MOUSE_MOVE",e[e.RECTPICK_MOUSE_UP=1002]="RECTPICK_MOUSE_UP",e[e.PICK_MOUSE_DOWN=2e3]="PICK_MOUSE_DOWN",e[e.PICK_MOUSE_MOVE=2001]="PICK_MOUSE_MOVE",e[e.PICK_MOUSE_UP=2002]="PICK_MOUSE_UP",e[e.Floor_Plane_Changed=3e3]="Floor_Plane_Changed",e[e.Floor_Plane_Changed_For_Panel=3001]="Floor_Plane_Changed_For_Panel",e[e.Resize=4e3]="Resize",e[e.Camera_Height_Changed=5e3]="Camera_Height_Changed",e[e.ZOOM_MOUSE_WHEEL=6e3]="ZOOM_MOUSE_WHEEL",e[e.PAN_MOUSE_MOVE=7e3]="PAN_MOUSE_MOVE",e[e.NavigationMapRectChanged=8e3]="NavigationMapRectChanged",e[e.NavigationMapRectDestroyed=8001]="NavigationMapRectDestroyed"}(EventType$2||(EventType$2={})),function(e){e[e.Left=0]="Left",e[e.Middle=1]="Middle",e[e.Right=2]="Right"}(MouseEventType$2||(MouseEventType$2={}));var VFSizeMode$2,EventManager$1=function(){function e(){this.eventDispatcher=new THREE.EventDispatcher}return e.prototype.addEventListener=function(e,t){this.eventDispatcher.addEventListener(e,t)},e.prototype.hasEventListener=function(e){this.eventDispatcher.hasEventListener(e)},e.prototype.removeEventListener=function(e,t){this.eventDispatcher.removeEventListener(e,t)},e.prototype.dispatchEvent=function(e){this.eventDispatcher.dispatchEvent(e)},e}();!function(e){e.Min="Min",e.Max="Max"}(VFSizeMode$2||(VFSizeMode$2={}));var ZoomEditor$2=function(e){function t(t,i){var n=e.call(this)||this;return n.totalZoomFactors=[],n.zoomFactors=[],n.lastZoomFactor=1,n.currentIdx=0,n.name=EditorName$2.Zoom_Editor,n.eventManager=i,n.nmData=t.getData(),n.nmViewer=t,n}return __extends$1(t,e),t.prototype.scale=function(e,t,i){var n=t>e,o=-1;if(n?this.currentIdx<this.zoomFactors.length-1&&(this.currentIdx++,o=this.zoomFactors[this.currentIdx]):this.currentIdx>0&&(this.currentIdx--,o=this.zoomFactors[this.currentIdx]),!(o<0||this.lastZoomFactor==o)){this.lastZoomFactor=o,1==o&&PanEditor$2.clear();var s=this.nmData.getOriginSize(),r=new THREE.Vector2(i[0]-s[0]/2,i[1]-s[1]/2),a=this.zoomFactors[this.currentIdx],l=0,h=0;if(n){var d=a/(g=this.zoomFactors[this.currentIdx-1]),c=[],u=this.nmData.getCorner("Virtual","LB");u[0]-=r.x,u[1]-=r.y,c.push(u[0]*d+r.x),c.push(u[1]*d+r.y),this.nmData.setZoomFactor(a);var p=this.nmData.getCorner("Virtual","LB");this.nmData.setZoomFactor(g),l=c[0]-p[0],h=c[1]-p[1]}else{var g=this.zoomFactors[this.currentIdx+1],m=this.boundsChecking(a,g,r);l=m[0],h+=m[1]}PanEditor$2.panOffsetX+=l,PanEditor$2.panOffsetY+=h,PanEditor$2.panOffsetXForCamera+=l,PanEditor$2.panOffsetYForCamera+=h,this.nmData.setZoomFactor(o),this.nmViewer.destroy(),this.nmData.destroy(),this.nmData.build(),this.nmViewer.update(),this.nmData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType$2.ZOOM_MOUSE_WHEEL,data:{offsetX:PanEditor$2.panOffsetX,offsetY:PanEditor$2.panOffsetY,zoomFactor:o}})}},t.prototype.onMouseWheel=function(e){var t=(e.deltaY||-e.wheelDelta||e.detail)<0,i=-1;if(t?this.currentIdx<this.zoomFactors.length-1&&(this.currentIdx++,i=this.zoomFactors[this.currentIdx]):this.currentIdx>0&&(this.currentIdx--,i=this.zoomFactors[this.currentIdx]),!(i<0||this.lastZoomFactor==i)){this.lastZoomFactor=i,1==i&&PanEditor$2.clear();var n=this.nmData.getOriginSize(),o=new THREE.Vector2(e.offsetX-n[0]/2,e.offsetY-n[1]/2),s=this.zoomFactors[this.currentIdx],r=0,a=0;if(this.nmData.isZooming=!0,t){var l=s/(u=this.zoomFactors[this.currentIdx-1]),h=[],d=this.nmData.getCorner("Virtual","LB");d[0]-=o.x,d[1]-=o.y,h.push(d[0]*l+o.x),h.push(d[1]*l+o.y),this.nmData.setZoomFactor(s);var c=this.nmData.getCorner("Virtual","LB");this.nmData.setZoomFactor(u),r=h[0]-c[0],a=h[1]-c[1]}else{var u=this.zoomFactors[this.currentIdx+1],p=this.boundsChecking(s,u,o);r=p[0],a+=p[1]}PanEditor$2.panOffsetX+=r,PanEditor$2.panOffsetY+=a,PanEditor$2.panOffsetXForCamera+=r,PanEditor$2.panOffsetYForCamera+=a,this.nmData.setZoomFactor(i),this.nmViewer.destroy(),this.nmData.destroy(),this.nmData.build(),this.nmViewer.update(),this.nmData.updateMovement(),this.updateZoomAndPan();var g=this;1==s&&requestAnimationFrame((function(){delete g.nmData.isZooming})),this.eventManager.dispatchEvent({type:EventType$2.ZOOM_MOUSE_WHEEL,data:{offsetX:PanEditor$2.panOffsetX,offsetY:PanEditor$2.panOffsetY,zoomFactor:i}})}},t.prototype.boundsChecking=function(e,t,i){var n=e/t,o=this.nmData.getCorner("Virtual","LB"),s=this.nmData.getCorner("Virtual","LT"),r=this.nmData.getCorner("Virtual","RT"),a=this.nmData.getCorner("Virtual","RB"),l=[0,0],h=(o[0]-i.x)*n+i.x,d=(o[1]-i.y)*n+i.y;this.nmData.setZoomFactor(e);var c=this.nmData.getCorner("Virtual","LB");this.nmData.setZoomFactor(t),l[0]=h-c[0],l[1]=d-c[1];var u=0,p=0,g=this.nmData.getCorner("Origin","LB");h>g[0]&&(l[0]+=g[0]-h,u++),d<g[1]&&(l[1]+=g[1]-d,p++),h=(s[0]-i.x)*n+i.x,d=(s[1]-i.y)*n+i.y;var m=this.nmData.getCorner("Origin","LT");h>m[0]&&0==u&&(l[0]+=m[0]-h,u++),d>m[1]&&0==p&&(l[1]+=m[1]-d,p++),h=(r[0]-i.x)*n+i.x,d=(r[1]-i.y)*n+i.y;var f=this.nmData.getCorner("Origin","RT");h<f[0]&&0==u&&(l[0]+=f[0]-h,u++),d>f[1]&&0==p&&(l[1]+=f[1]-d,p++),h=(a[0]-i.x)*n+i.x,d=(a[1]-i.y)*n+i.y;var w=this.nmData.getCorner("Origin","RB");return h<w[0]&&0==u&&(l[0]+=w[0]-h,u++),d<w[1]&&0==p&&(l[1]+=w[1]-d,p++),l},t.prototype.enableMode=function(e){if(e==VFSizeMode$2.Min)this.zoomFactors=this.totalZoomFactors;else if(e==VFSizeMode$2.Max){this.zoomFactors=this.totalZoomFactors.slice(1,this.totalZoomFactors.length);for(var t=1;t<this.zoomFactors.length;t++)this.zoomFactors[t]/=this.zoomFactors[0];this.zoomFactors[0]=1}this.currentIdx=0},t.prototype.setZoomFactors=function(e){this.totalZoomFactors=e,this.zoomFactors=e},t.prototype.setZoonIndex=function(e){this.currentIdx=e},t.prototype.getZoonIndex=function(){return this.currentIdx},t.prototype.updateZoomAndPan=function(){var e=this.nmData.getCorner("Origin","LT"),i=this.nmData.getCorner("Virtual","LT");t.offsetXForZoomAndPan=e[0]-i[0],t.offsetYForZoomAndPan=e[1]-i[1]},t.clear=function(){t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0},t.offsetXForZoomAndPan=0,t.offsetYForZoomAndPan=0,t}(Editor$2),PanEditor$2=function(e){function t(i,n){var o=e.call(this)||this;return o.name=EditorName$2.PAN_Editor,o.eventManager=n,o.nmData=i.getData(),o.bIsMouseDown=!1,o.mouseDownPos=new THREE.Vector2,t.panOffsetX=0,t.panOffsetY=0,o}return __extends$1(t,e),t.prototype.onMouseDown=function(e){this.bIsMouseDown=!0,this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)},t.prototype.onMouseMove=function(e){if(0!=this.bIsMouseDown&&1!=this.nmData.getZoomFactor()){var i=e.clientX-this.mouseDownPos.x,n=e.clientY-this.mouseDownPos.y;if(0!==i||0!==n){var o=this.boundsChecking(i,n);i=o[0],n=o[1],t.panOffsetX+=i,t.panOffsetY+=n,t.panOffsetXForCamera+=i,t.panOffsetYForCamera+=n,this.nmData.updateMovement(),this.updateZoomAndPan(),this.eventManager.dispatchEvent({type:EventType$2.PAN_MOUSE_MOVE,data:{offsetX:t.panOffsetX,offsetY:t.panOffsetY,zoomFactor:this.nmData.getZoomFactor()}}),this.mouseDownPos.setX(e.clientX),this.mouseDownPos.setY(e.clientY)}}},t.prototype.onMouseUp=function(e){0!=this.bIsMouseDown&&(this.bIsMouseDown=!1)},t.prototype.boundsChecking=function(e,t){var i=this.nmData.getCorner("Origin","LB"),n=this.nmData.getCorner("Virtual","LB"),o=this.nmData.getCorner("Origin","RT"),s=this.nmData.getCorner("Virtual","RT");if(e>0)(r=i[0]-n[0])<=e&&(e=r);else if(e<0){var r;(r=o[0]-s[0])>=e&&(e=r)}if(t<0)(a=i[1]-n[1])>=t&&(t=a);else if(t>0){var a;(a=o[1]-s[1])<=t&&(t=a)}return[e,t]},t.prototype.updateZoomAndPan=function(){var e=this.nmData.getCorner("Origin","LT"),t=this.nmData.getCorner("Virtual","LT");ZoomEditor$2.offsetXForZoomAndPan=e[0]-t[0],ZoomEditor$2.offsetYForZoomAndPan=e[1]-t[1]},t.clear=function(){t.panOffsetX=0,t.panOffsetY=0,t.panOffsetXForCamera=0,t.panOffsetYForCamera=0},t}(Editor$2),NavigationMapData=function(){function e(){this.zoomFactor=1,this.imageScale=1,this.imageOriginScale=1,this.bboxLengthStages=[15e4,3e5],this.zoomFactors1=[1,7/4,2.5,10/3],this.zoomFactors2=[1,7/4,2.5,14/3,65/12,20/3],this.zoomFactors3=[1,7/4,2.5,10/3,14/3,65/12,20/3,49/6,10],this.url=null,this.drawableItems=[],this.bIsShowAxisGrid=!1,this.bIsShowCameraNode=!0,this.bIsShowFloorPlane=!0,this.floorPlaneBox=new THREE.Box3,this.axisGridNode=null,this.cameraNode=null,this.floorPlaneNode=null,this.algorithm=new NavigationMapAlgorithm,this.glodonColor="#11DAB7",this.axisGridBoxSize=new THREE.Vector2,this.boxCenter=new THREE.Vector2,this.boxSize=new THREE.Vector2,this.boxCenter2=new THREE.Vector2}return e.prototype.setPlanes=function(e){this.dataFloorPlanes=new FloorPlanes$1(e)},e.prototype.setUrl=function(e,t){this.url=e,this.isProfile=t,this.build()},e.prototype.setAnchor=function(e){var t=e.modelAnchor,i=e.mapAnchor,n=e.zHeight,o=e.maxHeight;this.modelAnchor=t,this.mapAnchor=i,this.zHeight=n,this.maxHeight=o,this.coordinateTransform=new CoordinateTransform(t,i)},e.prototype.getRotateAngle=function(){return this.coordinateTransform.getRotateAngle()},e.prototype.mapToModel=function(e){var t=this.coordinateTransform.mapToModel(e);return new THREE.Vector3(t.x,t.y,this.zHeight)},e.prototype.modelToMap=function(e){return this.coordinateTransform.modelToMap(e)},e.prototype.worldToNormalizedPoint=function(e){var t=this.modelToMap(e);return e.x=t.x/this.imgSize.width*2-1,e.y=2*(1-t.y/this.imgSize.height)-1,e},e.prototype.normalizedPointToWorld=function(e){var t=new THREE.Vector2;t.x=.5*(e.x+1)*this.imgSize.width,t.y=(1-.5*(e.y+1))*this.imgSize.height;var i=this.mapToModel(t);e.x=i.x,e.y=i.y},e.prototype.clientToModel=function(e){var t=e.x/this.getSize()[0]*this.imgSize.width,i=e.y/this.getSize()[1]*this.imgSize.height,n=new THREE.Vector2(t,i);return this.mapToModel(n)},e.prototype.normalizedPointToScreen=function(e,t){e.x=e.x*t.width,e.y=-e.y*t.height},e.prototype.getUrl=function(){return this.url},e.prototype.getFloorPlaneBox=function(){var e=this.modelAnchor[0],t=this.modelAnchor[1];return e.z=this.zHeight,t.z=this.maxHeight,this.floorPlaneBox.makeEmpty(),this.floorPlaneBox.expandByPoint(e),this.floorPlaneBox.expandByPoint(t),this.floorPlaneBox},e.prototype.setSize=function(e,t){this.width=e,this.height=t},e.prototype.getSize=function(){return[this.width*this.zoomFactor,this.height*this.zoomFactor]},e.prototype.getImageSize=function(){return[this.imgSize.width*this.imageScale*this.zoomFactor,this.imgSize.height*this.imageScale*this.zoomFactor]},e.prototype.saveImageSize=function(e){var t=this.width,i=this.height,n=e.width,o=e.height,s=i/t,r=o/n;this.imageOriginScale=s>=r?t/n:i/o,this.imgSize=e},e.prototype.getOriginSize=function(){return[this.width,this.height]},e.prototype.getGlodonColor=function(){return this.glodonColor},e.prototype.build=function(){if(this.axisGridNode=new AxisGrid$1(!1,this.getSize(),this.bIsShowAxisGrid,this.getZoomFactor()),this.buildFloorPlane(),this.bIsShowCameraNode){this.cameraNode=new CameraNode$1;var e=this.getOriginSize();this.cameraNode.setPanelSize(e),this.drawableItems.push(this.cameraNode)}this.intersectPoint=new HighlightPoint$1(3),this.drawableItems.push(this.intersectPoint)},e.prototype.buildFloorPlane=function(){var e=this.getUrl();if(this.bIsShowFloorPlane){var t=this.getFloorPlaneBox();this.getAxisGridBox2D().containsBox(t)||console.warn("the bounding-box of axis-grid is not contains the bounding-box of floor-plane!");var i=this.getFloorPlaneParams2();this.floorPlaneNode=new FloorPlane$1(e,i,this.isProfile),this.drawableItems.push(this.floorPlaneNode)}},e.prototype.getFloorPlaneParams2=function(){var e=this.getSize()[0],t=this.getSize()[1],i=this.imgSize.width,n=this.imgSize.height,o=t/e,s=n/i;this.imageScale=o>=s?e/(i*this.zoomFactor):t/(n*this.zoomFactor);var r=i*this.imageScale*this.zoomFactor,a=n*this.imageScale*this.zoomFactor,l=[];return l.push(r,a),l.push(0,0),l},e.prototype.getFloorPlaneParams=function(){var e=this.getFloorPlaneBox(),t=this.getAxisGridBox2D(),i=new THREE.Box2(new THREE.Vector2(e.min.x,e.min.y),new THREE.Vector2(e.max.x,e.max.y)),n=this.getSize()[0],o=n/this.getSize()[1];t.getSize(this.axisGridBoxSize),this.axisGridBoxSize.x/this.axisGridBoxSize.y!=o&&(this.algorithm.expandBbox(t,o),t.getSize(this.axisGridBoxSize));var s=[],r=n/this.axisGridBoxSize.x;i.getSize(this.boxSize);var a=this.boxSize.x*r,l=this.boxSize.y*r;s.push(a,l),i.getCenter(this.boxCenter),t.getCenter(this.boxCenter2);var h=this.boxCenter.clone().sub(this.boxCenter2);return h.x*=r,h.y*=-r,s.push(h.x,h.y),s},e.prototype.getDataFloorPlanes=function(){return this.dataFloorPlanes},e.prototype.getAxisGridBox2D=function(e){var t=this.axisGridNode.getAxisGridBox(e);if(t.getSize(this.axisGridBoxSize),0==this.axisGridBoxSize.length()){var i=this.getFloorPlaneBox();if(e)return i;var n=(new THREE.Box2).set(new THREE.Vector2(i.min.x,i.min.y),new THREE.Vector2(i.max.x,i.max.y));n.getCenter(this.boxCenter),n.getSize(this.boxSize);var o=new THREE.Vector2,s=this.width/this.height,r=this.boxSize.x/this.boxSize.y,a=this.boxSize.x,l=this.boxSize.y;return r>s?l=a/s:r<s&&(a=l*s),o.set(a,l),n.setFromCenterAndSize(this.boxCenter,o),n}return t},e.prototype.getDrawableItems=function(){return this.drawableItems},e.prototype.destroy=function(){this.drawableItems=[]},e.prototype.setIsShowAxisGrid=function(e){this.bIsShowAxisGrid=e},e.prototype.getCameraNode=function(){for(var e=this.drawableItems,t=0;t<e.length;t++){var i=e[t];if(i instanceof CameraNode$1)return i}},e.prototype.updateMovement=function(){var e=this.getFloorPlaneNode();this.imgPosition=e.move(PanEditor$2.panOffsetX,PanEditor$2.panOffsetY);var t=this.getAxisGridNode();t&&t.move(PanEditor$2.panOffsetX,PanEditor$2.panOffsetY);var i=this.getCameraNode();i.move(PanEditor$2.panOffsetXForCamera,PanEditor$2.panOffsetYForCamera),i.rotate()},e.prototype.getPicPosition=function(e){var t=this.getFloorPlaneNode(),i=e.x-this.imgPosition.x,n=e.y-this.imgPosition.y;return{x:(i-.5*this.width- -.5*t.width)/t.width*this.imgSize.width,y:(n-.5*this.height- -.5*t.height)/t.height*this.imgSize.height}},e.prototype.getCorner=function(e,t){var i=[],n=[];"Origin"==e?(i=[0,0],n=this.getOriginSize()):"Virtual"==e&&(i=[PanEditor$2.panOffsetX,PanEditor$2.panOffsetY],n=this.getSize());var o=0,s=0;switch(t){case"LB":o=i[0]-n[0]/2,s=i[1]+n[1]/2;break;case"LT":o=i[0]-n[0]/2,s=i[1]-n[1]/2;break;case"RT":o=i[0]+n[0]/2,s=i[1]-n[1]/2;break;case"RB":o=i[0]+n[0]/2,s=i[1]+n[1]/2;break;default:console.log("CornerName is wrong.")}return[o,s]},e.prototype.getHeight=function(){return this.zHeight},e.prototype.getIntersections=function(){return this.axisGridNode.getIntersections()},e.prototype.getGridLineByName=function(e){return this.axisGridNode.getGridLineByName(e)},e.prototype.getFloorPlaneNode=function(){return this.floorPlaneNode},e.prototype.getAxisGridNode=function(){return 0==this.bIsShowAxisGrid?null:this.axisGridNode},e.prototype.getIntersectPoint=function(){return this.intersectPoint},e.prototype.setZoomFactor=function(e){this.zoomFactor=e},e.prototype.getZoomFactor=function(){return this.zoomFactor},e.prototype.getProperZoomFactors=function(){this.getAxisGridBox2D(!0).getSize(this.boxSize);var e=Math.max(this.boxSize.x,this.boxSize.y);return e<=this.bboxLengthStages[0]?this.zoomFactors1:e<=this.bboxLengthStages[1]?this.zoomFactors2:this.zoomFactors3},e}(),NavigationMapView=function(){function e(e,t,i){this.viewer=e,this.domContainer=t,this.navigationMapData=i,this.width=t.offsetWidth,this.height=t.offsetHeight,this.offsetLeft=t.offsetLeft,this.offsetTop=t.offsetTop,this.algorithm=new NavigationMapAlgorithm,this.eventManager=null,this.bBoxCenter=new THREE.Vector3,this.inverseMatrix=new THREE.Matrix4,this.rotateMatrix=new THREE.Matrix3,this.projectedCameraPosition=new THREE.Vector3,this.projectedTargetPosition=new THREE.Vector3,this.initialize()}return e.prototype.initialize=function(){var e="http://www.w3.org/2000/svg";this.drawableContainer=document.createElementNS(e,"svg"),this.drawableContainer.setAttribute("width",this.width+""),this.drawableContainer.setAttribute("height",this.height+""),this.drawableContainer.setAttribute("viewBox",-this.width/2+" "+-this.height/2+" "+this.width+" "+this.height),this.drawableContainer.style.position="absolute",this.auxContainer=document.createElementNS(e,"svg"),this.auxContainer.setAttribute("width",this.width+""),this.auxContainer.setAttribute("height",this.height+""),this.auxContainer.setAttribute("viewBox",-this.width/2+" "+-this.height/2+" "+this.width+" "+this.height),this.auxContainer.style.position="absolute",this.mapContainer=document.createElement("div"),this.mapContainer.style.left="0px",this.mapContainer.style.bottom="0px",this.mapContainer.style.position="relative",this.mapContainer.outling="none",this.mapContainer.appendChild(this.drawableContainer),this.mapContainer.appendChild(this.auxContainer),this.domContainer.appendChild(this.mapContainer),this.cameraHeightChangedCallbackBinded=this.cameraHeightChangedCallback.bind(this)},e.prototype.cameraHeightChangedCallback=function(e){var t=e.cameraPosition;this.viewer.getScene().getMatrixGlobal();var i=this.viewer.getScene().getInverseMatrixGlobal(),n=t.clone().applyMatrix4(i);this.navigationMapData.getAxisGridBox2D().containsPoint(new THREE.Vector2(n.x,n.y))},e.prototype.getMapContainer=function(){return this.drawableContainer},e.prototype.getDomContainer=function(){return this.domContainer},e.prototype.getAuxContainer=function(){return this.auxContainer},e.prototype.getViewer=function(){return this.viewer},e.prototype.getData=function(){return this.navigationMapData},e.prototype.setSize=function(e,t){this.mapContainer.style.width=e+"px",this.mapContainer.style.height=t+"px",this.drawableContainer.setAttribute("width",e+""),this.drawableContainer.setAttribute("height",t+""),this.drawableContainer.setAttribute("viewBox",-e/2+" "+-t/2+" "+e+" "+t),this.auxContainer.setAttribute("width",e+""),this.auxContainer.setAttribute("height",t+""),this.auxContainer.setAttribute("viewBox",-e/2+" "+-t/2+" "+e+" "+t),this.destroy(),this.navigationMapData.destroy(),this.navigationMapData.build(),this.update(),this.eventManager.dispatchEvent({type:EventType$2.Resize,size:{width:e,height:t}})},e.prototype.destroy=function(){for(var e=this.drawableContainer;e.children.length>0;){var t=e.children[0];e.removeChild(t)}this.mapContainer.removeChild(e)},e.prototype.updateCameraNode=function(){var e=this.viewer,t=e.camera,i=e.cameraControl;if(t&&i){var n=t.position,o=t.target,s=this.algorithm.getMainSceneMatrix(e);this.inverseMatrix.copy(s).invert();var r=this.navigationMapData.getFloorPlaneBox();if(isNaN(r.min.z)){var a=n.clone();a.applyMatrix4(this.inverseMatrix),r.min.z=a.z,r.max.z=this.navigationMapData.maxHeight}r.getCenter(this.bBoxCenter);var l=new THREE.Vector3(r.min.x,r.min.y,this.bBoxCenter.z).applyMatrix4(s),h=new THREE.Vector3(r.min.x,r.max.y,this.bBoxCenter.z).applyMatrix4(s),d=new THREE.Vector3(r.max.x,r.min.y,this.bBoxCenter.z).applyMatrix4(s),c=new THREE.Plane;c.setFromCoplanarPoints(l,h,d),c.projectPoint(n,this.projectedCameraPosition),this.projectedCameraPosition.applyMatrix4(this.inverseMatrix),c.projectPoint(o,this.projectedTargetPosition),this.projectedTargetPosition.applyMatrix4(this.inverseMatrix);var u=this.projectedTargetPosition.clone().sub(this.projectedCameraPosition);u.z=0,u.normalize();var p=n.clone();p.applyMatrix4(this.inverseMatrix);var g=p.clone(),m=this.navigationMapData.getCameraNode();if(m){var f=this.navigationMapData.getImageSize(),w={width:f[0]/2,height:f[1]/2};if(this.navigationMapData.getAxisGridBox2D(),this.getData().worldToNormalizedPoint(g),this.algorithm.normalizedPointToScreen(g,w),m.setOpacity("1.0"),u.length()<1e-5)m.setCameraArrowOpacity("0.0"),m.setOffsetAndRotate(g.x+PanEditor$2.panOffsetX,g.y+PanEditor$2.panOffsetY,0);else{var v=new THREE.Vector3(0,0,1),y=new THREE.Vector3(1,0,0);this.rotateMatrix.identity(),this.rotateMatrix.rotate(this.navigationMapData.getRotateAngle()),u.applyMatrix3(this.rotateMatrix);var b=this.algorithm.isAngleGreaterThanPi(y,u,v),E=THREE.Math.radToDeg(y.angleTo(u));b||(E*=-1),m.setBigCamera(),m.setOffsetAndRotate(g.x+PanEditor$2.panOffsetX,g.y+PanEditor$2.panOffsetY,E),m.setCameraArrowOpacity("1.0")}}}},e.prototype.update=function(e){for(var t=this.navigationMapData.getDrawableItems(),i=0;i<t.length;i++){t[i].abtainRenderables(this.drawableContainer)}this.updateCameraNode();var n=this.mapContainer.firstChild;n?this.mapContainer.insertBefore(this.drawableContainer,n):this.mapContainer.appendChild(this.drawableContainer)},e.prototype.setEventManager=function(e){this.eventManager=e},e.prototype.getEventManager=function(){return this.eventManager},e.prototype.registerCameraHeightChanged=function(e){this.viewer.registerEventListener(e,this.cameraHeightChangedCallbackBinded)},e}(),PickEditor$1=function(e){function t(t,i){var n=e.call(this)||this;return n.name=EditorName$2.PICK_Editor,n.nmViewer=t,n.nmData=t.getData(),n.algorithm=new NavigationMapAlgorithm,n.cameraProjectedPosZ=1750,n.nmViewer.getViewer().modelManager.isMeterUnit()&&(n.cameraProjectedPosZ=n.cameraProjectedPosZ/1e3),n.mapClickMode="default",n.lastMousePoint=new THREE.Vector2,n.eventManager=i,n}return __extends$1(t,e),t.prototype.onMouseDown=function(e){this.bIsMouseDown=!0,this.lastMousePoint.setX(e.clientX),this.lastMousePoint.setY(e.clientY)},t.prototype.onMouseMove=function(e){},t.prototype.onMouseUp=function(e){this.bIsMouseDown=!1,this.lastMousePoint.x===e.clientX&&this.lastMousePoint.y===e.clientY&&this.locateByClientPoint(e.clientX+ZoomEditor$2.offsetXForZoomAndPan,e.clientY+ZoomEditor$2.offsetYForZoomAndPan,e)},t.prototype.flyToPointWithParallelEye=function(e){var t=this.nmData.clientToModel(e),i=this.nmViewer.getViewer(),n=i.worldToDrawing(t);i.cameraControl.flyToPointWithParallelEye(new THREE.Vector3(n.x,n.y,n.z))},t.prototype.locateByClientPoint=function(e,t,i){var n=new THREE.Vector2(e,t),o=new THREE.Vector3,s=this.nmViewer.getMapContainer(),r=this.nmData.getImageSize(),a=this.nmData.getZoomFactor(),l=this.algorithm.normalizePointByZoomFactor(s,r,n,a);if(null!=l){var h=this.nmData.getAxisGridBox2D();this.nmData.normalizedPointToWorld(l);var d=this.algorithm.normalizePointByZoomFactor(s,r,n,a);this.algorithm.normalizedPointToScreen(d,{width:r[0]/2,height:r[1]/2});var c=this.algorithm.getIntersectionToMinDistance(this.nmData.getIntersections(),d);if(c&&c.intersectionPoint){var u=new THREE.Vector2(c.intersectionPoint.x,c.intersectionPoint.y);if(d.sub(u).lengthSq()<9){var p=u.clone(),g={width:r[0]/2,height:r[1]/2};this.algorithm.screenToNormalizedPoint(p,g),this.algorithm.normalizedPointToWorld(p,h),o.set(p.x,p.y,this.cameraProjectedPosZ)}else o.set(l.x,l.y,this.cameraProjectedPosZ)}else o.set(l.x,l.y,this.cameraProjectedPosZ);var m=o.clone(),f=this.nmData.getHeight();isNaN(f)||(m.z=f),this.nmData.updateMovement();var w=this.algorithm.getContainerOffsetToClient(s),v={x:i.clientX-w.left,y:i.clientY-w.top},y=this.nmData.getPicPosition(v);return this.eventManager.dispatchEvent({type:EventType$2.PICK_MOUSE_UP,data:{worldPosition:m.clone(),picPosition:y,clientPosition:v,screenPosition:{x:i.clientX,y:i.clientY}}}),this.algorithm.transformWorldPoint(this.nmViewer.getViewer(),m),this.algorithm.flyToPointWithParallelEye(this.nmViewer.getViewer(),m),!0}console.warn("Click point out of boundary.")},t}(Editor$2),NaviAction$1=function(){function e(e){this.nmViewer=e,this.nmData=e.getData(),this.svgRect=null,this.rectForMinimapId="RectForMinimap",this.bEditMode=!1,this.bPanMode=!1,this.bMouseDown=!1,this.rectangle=[],this.currentGripId=-1,this.lastHighlightGripId=-1,this.bFirstMouseClick=!0,this.lastMousePoint=new THREE.Vector2,this.lastMousePointToRectMin=new THREE.Vector2,this.lastMousePointToRectMax=new THREE.Vector2,this.pointOnBorder=[],this.eventManager=e.getEventManager(),this.panOffset=[0,0],this.zoomFactor=1;var t=this;this.eventManager.addEventListener(EventType$2.ZOOM_MOUSE_WHEEL,(function(e){var i=e.data;t.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor),t.nmViewer.updateCameraNode()})),this.eventManager.addEventListener(EventType$2.PAN_MOUSE_MOVE,(function(e){var i=e.data;t.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor),t.nmViewer.updateCameraNode()}))}return e.prototype.getMouseClickState=function(){return this.bFirstMouseClick},e.prototype.setMouseClickState=function(e){this.bFirstMouseClick=!!e},e.prototype.getCurrentGripId=function(){return this.currentGripId},e.prototype.setCurrentGripId=function(e){this.currentGripId=e},e.prototype.getRectangleInfo=function(){var e=Math.abs(this.rectangle[2]-this.rectangle[0]),t=Math.abs(this.rectangle[3]-this.rectangle[1]);return{x:this.rectangle[0],y:this.rectangle[1],width:e,height:t}},e.prototype.setLastMousePoint=function(e,t){this.lastMousePoint.x=e,this.lastMousePoint.y=t},e.prototype.equalWithLastPoint=function(e,t){return this.lastMousePoint.x===e&&this.lastMousePoint.y===t},e.prototype.getRectangle=function(){return this.rectangle},e.prototype.addPointToRectangle=function(e,t){"number"==typeof e&&this.rectangle.push(e),"number"==typeof t&&this.rectangle.push(t)},e.prototype.pointsCount=function(){return this.rectangle.length/2},e.prototype.pointValidation=function(e,t){var i=this.nmViewer.getDomContainer().getBoundingClientRect();(e<0||t<0||e>i.width||t>i.height)&&(e=this.pointOnBorder[0],t=this.pointOnBorder[1]),e<this.rectangle[0]?(this.rectangle.push(this.rectangle[0]),this.rectangle[0]=e):this.rectangle.push(e),t<this.rectangle[1]?(this.rectangle.push(this.rectangle[1]),this.rectangle[1]=t):this.rectangle.push(t)},e.prototype.getMouseState=function(){return this.bMouseDown},e.prototype.setMouseState=function(e){this.bMouseDown=!!e},e.prototype.getEditMode=function(){return this.bEditMode},e.prototype.setEditMode=function(e){this.bEditMode=!!e},e.prototype.getPanMode=function(){return this.bPanMode},e.prototype.setPanMode=function(e){this.bPanMode=!!e},e.prototype.createSvgElement=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e);return t.setAttribute("pointer-events","inherit"),t},e.prototype.createSvgRect=function(e){this.svgRect||(this.svgRect=this.createSvgElement("rect"),this.svgRect.setAttribute("id",this.rectForMinimapId),this.svgRect.setAttribute("stroke-width",2),this.svgRect.style.position="absolute",this.svgRect.style.fillOpacity="0.4",this.svgRect.style.fill=this.nmData.getGlodonColor(),this.svgRect.style.display="block",this.svgRect.style.stroke=this.nmData.getGlodonColor(),this.svgRect.style.strokeWidth="2");var t=Math.abs(e.x-this.rectangle[0]),i=Math.abs(e.y-this.rectangle[1]),n=this.nmViewer.getAuxContainer(),o=n.clientWidth,s=n.clientHeight,r=["translate(",e.x-o/2,",",e.y-s/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",r),this.svgRect.setAttribute("width",t+""),this.svgRect.setAttribute("height",i+""),n.appendChild(this.svgRect)},e.prototype.updateSvgRect=function(e){this.pointOnBorder=[],this.pointOnBorder.push(e.x,e.y);var t=Math.abs(e.x-this.rectangle[0]),i=Math.abs(e.y-this.rectangle[1]),n={x:this.rectangle[0],y:this.rectangle[1]};if(e.x<n.x||e.y<n.y){e.x<n.x&&(n.x=e.x),e.y<n.y&&(n.y=e.y);var o=this.nmData.getOriginSize(),s=["translate(",n.x-o[0]/2,",",n.y-o[1]/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",s)}this.svgRect.setAttribute("width",t+""),this.svgRect.setAttribute("height",i+"")},e.prototype.resetSvgRect=function(){var e=Math.abs(this.rectangle[0]-this.rectangle[2]),t=Math.abs(this.rectangle[1]-this.rectangle[3]);this.svgRect.setAttribute("width",e+""),this.svgRect.setAttribute("height",t+"");var i=this.nmViewer.getAuxContainer(),n=i.clientWidth,o=i.clientHeight,s=["translate(",this.rectangle[0]-n/2,",",this.rectangle[1]-o/2,") ","rotate(",0,") "].join("");this.svgRect.setAttribute("transform",s),this.eventManager.dispatchEvent({type:EventType$2.NavigationMapRectChanged,rectInfo:this.getRectangleInfo()})},e.prototype.clearRectangle=function(){this.rectangle=[]},e.prototype.adjustRectangle=function(e,t,i){if(t[0]>=i[0])switch(e){case 0:case 1:case 2:t[0]=i[0];break;case 4:case 5:case 6:i[0]=t[0]}if(t[1]>=i[1])switch(e){case 2:case 3:case 4:i[1]=t[1];break;case 6:case 7:case 0:t[1]=i[1]}return t.concat(i)},e.prototype.gripDragging=function(e,t){var i=this.rectangle,n=t.x-e.x,o=t.y-e.y,s=[i[0],i[1]],r=[i[2],i[3]];switch(this.currentGripId){case 0:s[0]+=n,s[1]+=o;break;case 1:s[0]+=n;break;case 2:s[0]+=n,r[1]+=o;break;case 3:r[1]+=o;break;case 4:r[0]+=n,r[1]+=o;break;case 5:r[0]+=n;break;case 6:s[1]+=o,r[0]+=n;break;case 7:s[1]+=o;break;default:console.log("default grip id."+this.currentGripId)}var a=this.nmData.getOriginSize();r[0]=r[0]>a[0]?a[0]:r[0],r[1]=r[1]>a[1]?a[1]:r[1],this.rectangle=this.adjustRectangle(this.currentGripId,s,r)},e.prototype.hightlightGrip=function(e){var t={x:e.offsetX,y:e.offsetY},i=this.hitGrips(t);i!=this.lastHighlightGripId&&(this.currentGripId<0&&this.lastHighlightGripId>=0&&(document.getElementById(this.rectForMinimapId+"-"+this.lastHighlightGripId).style.stroke=this.nmData.getGlodonColor()));(this.currentGripId>=0||i>=0)&&(this.currentGripId>=0&&(i=this.currentGripId),document.getElementById(this.rectForMinimapId+"-"+i).style.stroke="#f5a623",this.currentGripId<0&&(this.lastHighlightGripId=i))},e.prototype.drawGrips=function(){for(var e=this.getGrips(),t=0;t<e.length;t+=2){if(!((t/2-1)%2)){var i=this.createSegmentGrip(t/2,this.nmData.getGlodonColor());this.currentGripId==t/2&&(i=this.createSegmentGrip(t/2,"#FF9D0B")),this.nmViewer.getAuxContainer().appendChild(i)}}for(t=0;t<e.length;t+=2){if(!!((t/2-1)%2)){i=this.createGrip(t/2,this.nmData.getGlodonColor());this.currentGripId==t/2&&(i=this.createGrip(t/2,"#FF9D0B")),this.nmViewer.getAuxContainer().appendChild(i)}}},e.prototype.createSegmentGrip=function(e,t){var i=this.getGrips(),n=this.rectForMinimapId+"-"+e,o=document.getElementById(n);o&&o.parentNode.removeChild(o);var s=this.createSvgElement("line"),r=this.nmViewer.getAuxContainer().clientWidth,a=this.nmViewer.getAuxContainer().clientHeight,l=(e-1)%(i.length/2),h=(e+1)%(i.length/2),d=String(i[2*l]-r/2),c=String(i[2*l+1]-a/2),u=String(i[2*h]-r/2),p=String(i[2*h+1]-a/2);return s.setAttribute("id",n),s.setAttribute("x1",d),s.setAttribute("y1",c),s.setAttribute("x2",u),s.setAttribute("y2",p),s.setAttribute("style","fill: none; stroke: "+(t||"#4784cb")+"; stroke-width: 2; fill: #ffffff; display: block; position: absolute"),s},e.prototype.createGrip=function(e,t){var i=this.getGrips(),n=this.rectForMinimapId+"-"+e,o=document.getElementById(n);o&&o.parentNode.removeChild(o);var s=this.createSvgElement("circle"),r=this.nmViewer.getAuxContainer().clientWidth,a=this.nmViewer.getAuxContainer().clientHeight,l=["translate(",i[2*e]-r/2,",",i[2*e+1]-a/2,") ","rotate(",0,") "].join("");return s.setAttribute("id",n),s.setAttribute("transform",l),s.setAttribute("r","3"),s.setAttribute("style","fill: none; stroke: "+(t||"#4784cb")+"; stroke-width: 1; fill: #ffffff; display: block; position: absolute"),s},e.prototype.removeGrips=function(){for(var e=0;e<8;e++){var t=document.getElementById(this.rectForMinimapId+"-"+e);t&&t.parentNode.removeChild(t)}},e.prototype.removeSvgRect=function(){var e=document.getElementById(this.rectForMinimapId);e&&e.parentNode.removeChild(e)},e.prototype.destroyAll=function(){this.removeGrips(),this.removeSvgRect(),this.clearRectangle(),this.eventManager.dispatchEvent({type:EventType$2.NavigationMapRectDestroyed})},e.prototype.getGrips=function(){var e={x:this.rectangle[0],y:this.rectangle[1]},t={x:this.rectangle[2],y:this.rectangle[3]},i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},n=[];return n.push(e.x,e.y),n.push(e.x,i.y),n.push(e.x,t.y),n.push(i.x,t.y),n.push(t.x,t.y),n.push(t.x,i.y),n.push(t.x,e.y),n.push(i.x,e.y),n},e.prototype.hitGrips=function(e){for(var t=this.getGrips(),i=0;i<t.length;i+=2){var n=!1;if(!((i/2-1)%2)){var o=(i/2-1)%(t.length/2),s=(i/2+1)%(t.length/2),r=t[2*o],a=t[2*o+1],l=t[2*s],h=t[2*s+1];n=this.isPointInSegment(e.x,e.y,r,a,l,h,3)}else{var d=[t[i],t[i+1]];n=this.isPointInCircle(e,d,6)}if(n)return i/2}return-1},e.prototype.isPointInCircle=function(e,t,i){var n=e.x-t[0],o=e.y-t[1];return Math.sqrt(n*n+o*o)<=i},e.prototype.isPointInSegment=function(e,t,i,n,o,s,r){r=r||0;var a=(o-i)*(e-i)+(s-n)*(t-n);if(a<=0)return Math.sqrt((e-i)*(e-i)+(t-n)*(t-n))<=r;var l=(o-i)*(o-i)+(s-n)*(s-n);if(a>=l)return Math.sqrt((e-o)*(e-o)+(t-s)*(t-s))<=r;var h=a/l,d=i+(o-i)*h,c=n+(s-n)*h;return Math.sqrt((e-d)*(e-d)+(c-t)*(c-t))<=r},e.prototype.isPointInRectangle=function(e,t){if(this.pointsCount()<2)return!1;var i=this.rectangle,n=i[0]<i[2]?[i[0],i[2]]:[i[2],i[0]],o=n[0],s=n[1],r=(i[1],i[3],[i[1],i[3]]);return o<e&&e<s&&r[0]<t&&t<r[1]},e.prototype.panRectangle=function(e,t){var i=this.rectangle,n=this.nmViewer.getDomContainer().getBoundingClientRect();this.lastMousePointToRectMin.x+e<0?e=-this.lastMousePointToRectMin.x:this.lastMousePointToRectMax.x+e>n.width&&(e=n.width-this.lastMousePointToRectMax.x),this.lastMousePointToRectMin.y+t<0?t=-this.lastMousePointToRectMin.y:this.lastMousePointToRectMax.y+t>n.height&&(t=n.height-this.lastMousePointToRectMax.y),i[0]=this.lastMousePointToRectMin.x+e,i[1]=this.lastMousePointToRectMin.y+t,i[2]=this.lastMousePointToRectMax.x+e,i[3]=this.lastMousePointToRectMax.y+t,this.resetSvgRect(),this.drawGrips()},e.prototype.updateLastMousePointToRect=function(){this.lastMousePointToRectMin.x=this.rectangle[0]-this.lastMousePoint.x,this.lastMousePointToRectMin.y=this.rectangle[1]-this.lastMousePoint.y,this.lastMousePointToRectMax.x=this.rectangle[2]-this.lastMousePoint.x,this.lastMousePointToRectMax.y=this.rectangle[3]-this.lastMousePoint.y},e.prototype.zoomAndPan=function(e,t,i){if(this.pointsCount()<2)return this.panOffset=[e,t],void(this.zoomFactor=i);for(var n=this.nmViewer.getDomContainer().getBoundingClientRect(),o=n.width,s=n.height,r=new THREE.Vector2(.5*o,.5*s),a=0;a<=this.rectangle.length/2;a+=2){var l=new THREE.Vector2(this.rectangle[a]-this.panOffset[0],this.rectangle[a+1]-this.panOffset[1]).clone().sub(r);l.divideScalar(this.zoomFactor),this.rectangle[a]=l.x+r.x,this.rectangle[a+1]=l.y+r.y;var h=new THREE.Vector2(this.rectangle[a],this.rectangle[a+1]).clone().sub(r);h.multiplyScalar(i),this.rectangle[a]=r.x+h.x+e,this.rectangle[a+1]=r.y+h.y+t}this.panOffset=[e,t],this.zoomFactor=i,this.resetSvgRect(),this.drawGrips()},e}(),RectPickEditor$1=function(e){function t(t,i){var n=e.call(this)||this;return n.name=EditorName$2.RECTPICK_Editor,n.eventManager=i,n.nmData=t.getData(),n.naviAction=new NaviAction$1(t),n.nmViewer=t,n.algorithm=new NavigationMapAlgorithm,n}return __extends$1(t,e),t.prototype.onMouseDown=function(e){this.naviAction.setMouseState(!0);var t=this.adjustEvent(e);if(this.naviAction.setLastMousePoint(t.clientX,t.clientY),0==this.naviAction.pointsCount()){var i={x:t.offsetX,y:t.offsetY};this.naviAction.addPointToRectangle(i.x,i.y),this.naviAction.createSvgRect(i)}if(2==this.naviAction.pointsCount()){var n={x:e.offsetX,y:e.offsetY},o=this.naviAction.hitGrips(n),s=this.naviAction.isPointInRectangle(n.x,n.y);o>=0?this.naviAction.setEditMode(!0):s&&(this.naviAction.updateLastMousePointToRect(),this.naviAction.setPanMode(!0))}this.eventManager.dispatchEvent({type:EventType$2.RECTPICK_MOUSE_DOWN})},t.prototype.onMouseMove=function(e){if(2==this.naviAction.pointsCount()&&this.naviAction.hightlightGrip(e),this.naviAction.getMouseState()){var t=this.nmViewer.getDomContainer().getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top;if(this.naviAction.pointsCount()<2&&this.naviAction.updateSvgRect({x:i,y:n}),this.naviAction.getEditMode()){var o={x:i,y:n},s=this.naviAction.hitGrips(o);if(this.naviAction.getMouseClickState())return this.firstPos=o,this.naviAction.setMouseClickState(!1),void(s>=0&&this.naviAction.setCurrentGripId(s));var r=o;this.naviAction.getCurrentGripId()>=0&&(this.naviAction.gripDragging(this.firstPos,r),this.naviAction.resetSvgRect(),this.naviAction.removeGrips(),this.naviAction.drawGrips()),this.firstPos=r}this.naviAction.getPanMode()&&this.naviAction.panRectangle(e.clientX,e.clientY)}},t.prototype.onMouseUp=function(e){if(this.naviAction.setMouseState(!1),this.naviAction.setMouseClickState(!0),this.naviAction.setCurrentGripId(-1),this.naviAction.setPanMode(!1),this.naviAction.equalWithLastPoint(e.clientX,e.clientY))1==this.naviAction.pointsCount()&&this.naviAction.clearRectangle();else{if(1==this.naviAction.pointsCount()){var t=this.adjustEvent(e),i=this.nmViewer.getDomContainer().getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top;this.naviAction.pointValidation(n,o),this.naviAction.resetSvgRect(),this.naviAction.drawGrips()}this.naviAction.setEditMode(!1)}},t.prototype.clear=function(){this.naviAction.destroyAll()},t.prototype.getBoundingBoxIsolate=function(){var e=this.naviAction.getRectangle(),t={x:e[0]+ZoomEditor$2.offsetXForZoomAndPan,y:e[1]+ZoomEditor$2.offsetYForZoomAndPan},i={x:e[2]+ZoomEditor$2.offsetXForZoomAndPan,y:e[3]+ZoomEditor$2.offsetYForZoomAndPan},n=this.algorithm.getCuttingBoxOnCanvas(t,i,this.nmData.getSize(),this.nmData),o=this.nmData.getFloorPlaneBox();if(isNaN(o.min.z)){var s=this.nmViewer.getViewer().camera.position,r=this.nmViewer.getViewer().getScene().getInverseMatrixGlobal(),a=s.clone();a.applyMatrix4(r),o.min.z=a.z,o.max.z=this.nmData.maxHeight}return n.min.z=o.min.z,n.max.z=o.max.z,n},t.prototype.getIntersectionByNormalizedPoint=function(e,t){var i=this.nmViewer.getData().getIntersections(),n=new THREE.Vector2(e.x,e.y);return this.algorithm.normalizedPointToScreen(n,{width:t[0]/2,height:t[1]/2}),NavigationMapAlgorithm.getIntersectionByPoint(i,n)},t.prototype.adjustEvent=function(e){var t={offsetX:e.offsetX,offsetY:e.offsetY,clientX:e.clientX,clientY:e.clientY},i=new THREE.Vector2(t.clientX,t.clientY);i.x+=ZoomEditor$2.offsetXForZoomAndPan,i.y+=ZoomEditor$2.offsetYForZoomAndPan;var n=this.nmViewer.getMapContainer(),o=this.nmViewer.getData().getSize(),s=this.nmData.getZoomFactor(),r=this.algorithm.normalizePointByZoomFactor(n,o,i,s),a=this.getIntersectionByNormalizedPoint(r,o);if(a){var l=this.nmViewer.getDomContainer().getBoundingClientRect();t.clientX=a.intersectionPoint.x-ZoomEditor$2.offsetXForZoomAndPan,t.offsetX=t.clientX+o[0]/2,t.clientX=t.offsetX+l.left,t.clientY=a.intersectionPoint.y-ZoomEditor$2.offsetYForZoomAndPan,t.offsetY=t.clientY+o[1]/2,t.clientY=t.offsetY+l.top}return t},t}(Editor$2),NavigationMapEditor=function(){function e(e,t,i){this.eventManager=new EventManager$1,this.mapContainer=e,this.navigationMapData=t,this.nmViewer=i,this.touches=[],this.nmViewer.setEventManager(this.eventManager),this.offset=e.getBoundingClientRect(),this.activeEditors=[],this.bIsEnablePickHover=!1,this.initialize()}return e.prototype.initialize=function(){this.onContextmenuBinded=this.onContextmenu.bind(this),this.onTouchStartBinded=this.onTouchStart.bind(this),this.onTouchEndBinded=this.onTouchEnd.bind(this),this.onTouchMoveBinded=this.onTouchMove.bind(this),this.onMouseWheelBinded=this.onMouseWheel.bind(this),this.onMouseUpBinded=this.onMouseUp.bind(this),this.onMouseDownBinded=this.onMouseDown.bind(this),this.onMouseMoveBinded=this.onMouseMove.bind(this),this.addDomEventListeners(),this.enableEditor(EditorName$2.PICK_Editor),this.enableEditor(EditorName$2.Zoom_Editor),this.enableEditor(EditorName$2.PAN_Editor),this.enableEditor(EditorName$2.RECTPICK_Editor),this.enablePickHover(!0)},e.prototype.addDomEventListeners=function(){var e=this.mapContainer;e.addEventListener("contextmenu",this.onContextmenuBinded,!1),e.addEventListener("touchmove",this.onTouchMoveBinded,!1),e.addEventListener("touchstart",this.onTouchStartBinded,!1),e.addEventListener("touchend",this.onTouchEndBinded,!1),e.addEventListener("mousewheel",this.onMouseWheelBinded,!1),e.addEventListener("mousedown",this.onMouseDownBinded,!1),e.addEventListener("mousemove",this.onMouseMoveBinded,!1),document.addEventListener("mouseup",this.onMouseUpBinded,!1)},e.prototype.removeDomEventListeners=function(){var e=this.mapContainer;e.removeEventListener("contextmenu",this.onContextmenuBinded,!1),e.removeEventListener("touchmove",this.onTouchMoveBinded,!1),e.removeEventListener("touchstart",this.onTouchStartBinded,!1),e.removeEventListener("touchend",this.onTouchEndBinded,!1),e.removeEventListener("mousewheel",this.onMouseWheelBinded,!1),e.removeEventListener("mousedown",this.onMouseDownBinded,!1),e.removeEventListener("mousemove",this.onMouseMoveBinded,!1),document.removeEventListener("mouseup",this.onMouseUpBinded,!1)},e.prototype.destroy=function(){this.removeDomEventListeners()},e.prototype.enablePickHover=function(e){this.bIsEnablePickHover=e},e.prototype.onTouchStart=function(e){this.touches=this.originTouches=e.touches;var t=this.activeEditors;if(!(this.touches.length>1))for(var i=0;i<t.length;i++){t[i].onMouseDown(this.formatPoint(e.touches[0]))}},e.prototype.onTouchMove=function(e){var t,i,n,o=e.touches;this.activeEditors,1==o.length?this.touches=o:2==o.length&&(t=Math.sqrt(Math.pow(this.touches[0].pageX-this.touches[1].pageX,2)+Math.pow(this.touches[0].pageY-this.touches[1].pageY,2)),i=Math.sqrt(Math.pow(o[0].pageX-o[1].pageX,2)+Math.pow(o[0].pageY-o[1].pageY,2)),n=[(this.originTouches[0].pageX+this.originTouches[1].pageX)/2-this.offset.left,(this.originTouches[0].pageY+this.originTouches[1].pageY)/2-this.offset.top],Math.abs(t-i)>8&&(this.onScale(t,i,n),this.touches=o))},e.prototype.onTouchEnd=function(e){for(var t=e.changedTouches[0],i=[],n=0;n<this.touches.length;n++){var o=this.touches[n];o.clientX==t.clientX&&o.clientY==t.clientY||i.push(o)}this.touches=i;var s=this.activeEditors;if(1==this.touches.length);else if(0==this.touches.length)for(n=0;n<s.length;n++){s[n].onMouseUp(this.formatPoint(t))}},e.prototype.onScale=function(e,t,i){var n=this.find(EditorName$2.Zoom_Editor);n&&n.scale(e,t,i)},e.prototype.onMouseWheel=function(e){var t=this.find(EditorName$2.Zoom_Editor);t&&t.onMouseWheel(e)},e.prototype.onContextmenu=function(e){e.preventDefault()},e.prototype.clearRectPick=function(){var e=this.find(EditorName$2.RECTPICK_Editor);e instanceof RectPickEditor$1&&e.clear()},e.prototype.getBoundingBoxIsolate=function(){var e=this.find(EditorName$2.RECTPICK_Editor);if(e instanceof RectPickEditor$1)return e.getBoundingBoxIsolate()},e.prototype.onMouseUp=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName$2.PICK_Editor&&e.button!=MouseEventType$2.Left||(n.getName()==EditorName$2.RECTPICK_Editor&&e.button!=MouseEventType$2.Left||n.getName()==EditorName$2.PAN_Editor&&e.button==MouseEventType$2.Left||n.onMouseUp(e))}},e.prototype.onMouseDown=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName$2.PICK_Editor&&e.button!=MouseEventType$2.Left||(n.getName()==EditorName$2.RECTPICK_Editor&&e.button!=MouseEventType$2.Left||n.getName()==EditorName$2.PAN_Editor&&e.button==MouseEventType$2.Left||n.onMouseDown(e))}},e.prototype.onMouseMove=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++){var n=t[i];n.getName()==EditorName$2.PICK_Editor&&0==this.bIsEnablePickHover||n.onMouseMove(e)}},e.prototype.formatPoint=function(e){var t,i={};for(t in e)i[t]=e[t];return i},e.prototype.addEventListener=function(e,t){this.eventManager.addEventListener(e,t)},e.prototype.clearZoomAndPan=function(){PanEditor$2.clear(),ZoomEditor$2.clear(),this.navigationMapData.setZoomFactor(1);var e=this.find(EditorName$2.Zoom_Editor);e instanceof ZoomEditor$2&&e.setZoonIndex(0)},e.prototype.find=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++)if(t[i].getName()===e)return t[i]},e.prototype.enableEditor=function(e){if(!this.find(e)){var t=this.activeEditors;switch(e){case EditorName$2.PICK_Editor:t.push(new PickEditor$1(this.nmViewer,this.eventManager));break;case EditorName$2.RECTPICK_Editor:t.push(new RectPickEditor$1(this.nmViewer,this.eventManager));break;case EditorName$2.PAN_Editor:t.push(new PanEditor$2(this.nmViewer,this.eventManager));break;case EditorName$2.Zoom_Editor:t.push(new ZoomEditor$2(this.nmViewer,this.eventManager))}}},e.prototype.getEventManager=function(){return this.eventManager},e.prototype.disableEditor=function(e){for(var t=this.activeEditors,i=0;i<t.length;i++)t[i].getName()===e&&t.splice(i,1)},e.prototype.setZoomMode=function(e){var t=this.find(EditorName$2.Zoom_Editor);t instanceof ZoomEditor$2&&t.enableMode(e)},e.prototype.setZoomFactors=function(e){var t=this.find(EditorName$2.Zoom_Editor);t instanceof ZoomEditor$2&&t.setZoomFactors(e)},e}(),NavigationFloorMap=function(){function e(e,t,i){this.nmData=new NavigationMapData,this.nmData.setSize(t.offsetWidth,t.offsetHeight),this.nmView=new NavigationMapView(e,t,this.nmData),this.setAnchor(i);var n=this.getMapContainer();this.nmEditor=new NavigationMapEditor(n,this.nmData,this.nmView)}return e.prototype.setAnchor=function(e){this.nmData.setAnchor(e)},e.prototype.saveImageSize=function(e){this.nmData.saveImageSize(e)},e.prototype.setPlanes=function(e){this.nmData.setPlanes(e)},e.prototype.updateUrl=function(e,t){this.nmData.setUrl(e,t);var i=this.nmData.getProperZoomFactors();this.nmEditor.setZoomFactors(i),PanEditor$2.clear()},e.prototype.getEventManager=function(){return this.nmEditor.getEventManager()},e.prototype.setSize=function(e,t){this.nmData.setSize(e,t)},e.prototype.resize=function(e,t){this.nmEditor.clearZoomAndPan(),this.nmData.setSize(e,t),this.nmView.setSize(e,t),this.nmEditor.setZoomMode(VFSizeMode$2.Min)},e.prototype.destroy=function(){this.nmEditor.clearZoomAndPan(),this.nmView.destroy(),this.nmData.destroy(),this.clearRectPick()},e.prototype.destroyEditor=function(){this.nmEditor.destroy()},e.prototype.rebuildData=function(){this.nmData.build()},e.prototype.renderCameraNode=function(){this.nmView.updateCameraNode()},e.prototype.addEventListener=function(e,t){this.nmEditor.addEventListener(e,t)},e.prototype.getBoundingBox=function(){return this.nmEditor.getBoundingBoxIsolate()},e.prototype.clearRectPick=function(){this.nmEditor.clearRectPick()},e.prototype.clearZoomAndPan=function(){this.nmEditor.clearZoomAndPan(),this.nmView.destroy(),this.nmData.destroy(),this.nmData.build(),this.nmView.update()},e.prototype.getAxisGridBox2D=function(){return this.nmData.getAxisGridBox2D()},e.prototype.getMapContainer=function(){return this.nmView.getDomContainer()},e.prototype.render=function(){this.nmView.update()},e.prototype.getPanOffset=function(){return{x:PanEditor$2.panOffsetX,y:PanEditor$2.panOffsetY}},e.prototype.registerCameraHeightChanged=function(e){this.nmView.registerCameraHeightChanged(e)},e}();!function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.NavigationMap");t.NavigationMap=class{constructor(e){if(!e.viewer)return console.log("viewer is not defined."),!1;skipVueObserver(this),!e.domElement&&e.mapViewer&&(e.domElement=e.mapViewer.domElement),this._opt=e,this.id=e.id,this.eventManager=new Glodon$1.Web.Lang.EventManager,this.EventType={PICK_MOUSE_UP:2002,Camera_Height_Changed:5e3,ZOOM_MOUSE_WHEEL:6e3,PAN_MOUSE_MOVE:7e3,NavigationMap_Rect_Changed:8e3,NavigationMap_Rect_Destroyed:80001};var t=e.viewer.getViewer();switch(this._viewer=e.viewer,this.viewer=t,this.renderCB=()=>{this._initialized&&this.navigationMap.renderCameraNode()},t.addCallbacks("render",this.renderCB),this.maxHeight=t.getBoundingBoxWorld().max.z,this.onClickCallback=e.onClickCallback,this.initConfig=null,this.cloudMapManager=new Glodon$1.Bimface.Plugins.Map.MapManager({viewer:e.viewer}),e.type){case"Relevance":default:this.associateModel(e);break;case"SetProfile":e.isProfile=!0,this.initConfig=e,this.setProfileHeight(e);break;case"AutoProfile":e.isProfile=!0,this.setProfileAutoHeight(e)}}getEventManager(){return this.eventManager}addEventListener(e,t){this.getEventManager().addEvent(e,t)}removeEventListener(e,t){this.getEventManager().removeEvent(e,t)}init(){e.send("Bimface.Plugins.NavigationMap.NavigationMap","init");const t=this.getEventManager(),i=Glodon$1.Bimface.Plugins.NavigationMap.NavigationMapEvent;let n=this.EventType;this.navigationMap.addEventListener(n.PICK_MOUSE_UP,(e=>{const n=e.data;this.onClickCallback&&this.onClickCallback(e.data),t.fireEvent(i.MouseClicked,n)})),this._initialized=!0,this._opt.successCallback&&this._opt.successCallback(),this.navigationMap.setSize(this.mapContainer.offsetWidth,this.mapContainer.offsetHeight),this.initConfig&&(this.setProfileHeight(this.initConfig),this.initConfig=null),this.navigationMap.addEventListener(this.EventType.NavigationMap_Rect_Changed,(e=>{this.getEventManager().fireEvent("NavigationMapRectChanged",e.rectInfo)})),this.navigationMap.addEventListener(this.EventType.NavigationMap_Rect_Destroyed,(e=>{this.getEventManager().fireEvent("NavigationMapRectDestroyed",e)})),this.addEventListener("NavigationMapRectChanged",(e=>{this._updateToolBarByMinmapRect(e)})),this.addEventListener("NavigationMapRectDestroyed",(e=>{this.toolbar&&this.toolbar.hide()}))}associateModel(e){let{mapAnchors:t,modelAnchors:i,url:n,domElement:o}=e;o&&(this.mapContainer=o),i.point1=this._viewer.globalUnitUtil.translateVector(i.point1),i.point2=this._viewer.globalUnitUtil.translateVector(i.point2);const s=Math.min(i.point1.z,i.point2.z);this.getImageSize(n,(o=>{const r=[new THREE.Vector2(i.point1.x,i.point1.y),new THREE.Vector2(i.point2.x,i.point2.y)],a=[new THREE.Vector2(t.point1.x,t.point1.y),new THREE.Vector2(t.point2.x,t.point2.y)],l=this.maxHeight,h={modelAnchor:r,mapAnchor:a,zHeight:s,maxHeight:l};this._initialized?(this.navigationMap.clearZoomAndPan(),this.navigationMap.setAnchor(h)):(this.navigationMap=new NavigationFloorMap(this.viewer,this.mapContainer,h),this.navigationMap.registerCameraHeightChanged(CLOUD$1.EVENTS.ON_CAMERA_HEIGHT_CHANGED),this.init()),this.navigationMap.saveImageSize(o),this.update(n,e.isProfile)}))}setProfileHeight(e,t,i){let n={maxPixel:800};n.height=void 0===e.height?0:e.height,void 0===e.isProfile&&(e.isProfile=!0);let o=i=>{const o=this._viewer.globalUnitUtil.revertBBox(this.viewer.getBoundingBoxWorld());let s=o.min,r=o.max;s.z=r.z=n.height;const a={point1:s,point2:r};let l=new THREE.Vector3;o.getSize(l);const h=l.x/l.y;let d=n.maxPixel,c=n.maxPixel;const u=e.domElement||this._opt.domElement,p=e.isProfile,g=u&&u.getBoundingClientRect();if(g&&g.width&&g.height){const e=g.width/g.height,n=new Image;return n.onload=()=>{const i=n.width/n.height,o=document.createElement("canvas");let l=o.getContext("2d");if(e>i){o.height=n.height,o.width=n.height*e;const t=(o.width-n.width)/2,i=t*(r.x-s.x)/n.width;a.point1.x-=i,a.point2.x+=i,l.drawImage(n,t,0,n.width,n.height)}else{o.width=n.width,o.height=n.width/e;const t=(o.height-n.height)/2,i=t*(r.y-s.y)/n.height;a.point1.y-=i,a.point2.y+=i,l.drawImage(n,0,t,n.width,n.height)}const h=o.toDataURL("image/png");let d=new THREE.Vector2(0,o.height),c=new THREE.Vector2(o.width,0);const g={modelAnchors:a,mapAnchors:{point1:d,point2:c},url:h,domElement:u,isProfile:p};this.associateModel(g),t&&t()},void(n.src=i)}h>1?c/=h:d*=h;let m=new THREE.Vector2(0,c),f=new THREE.Vector2(d,0);const w={modelAnchors:a,mapAnchors:{point1:m,point2:f},url:i,domElement:u,isProfile:p};this.associateModel(w),t&&t()};n.successCallback=o,this.cloudMapManager.removeCreateMapEvent();let s=JSON.parse(JSON.stringify(n));s.height=this._viewer.globalUnitUtil.translate(s.height),s.successCallback=o,this.cloudMapManager.createMapByHeight(s)}setProfileAutoHeight(e,t,i){let n={maxPixel:800};n.height=void 0===e.height?0:e.height;let o=i=>{const o=this._viewer.globalUnitUtil.revertBBox(this.viewer.getBoundingBoxWorld());let s=o.min,r=o.max;s.z=r.z=n.height;const a={point1:s,point2:r};let l=new THREE.Vector3;o.getSize(l);const h=l.x/l.y;let d=n.maxPixel,c=n.maxPixel;h>1?c/=h:d/=h;const u={modelAnchors:a,mapAnchors:{point1:new THREE.Vector2(0,c),point2:new THREE.Vector2(d,0)},url:i,domElement:e.domElement,isProfile:e.isProfile};this.associateModel(u),t&&t()};n.successCallback=o;let s=JSON.parse(JSON.stringify(n));s.height=this._viewer.globalUnitUtil.translate(s.height),s.successCallback=o,this.cloudMapManager.createMapByCamera(n),this.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CAMERA_CHANGED_AND_RENDERED})}getImageSize(e,t){let i=document.createElement("img");i.onload=()=>{t({width:i.width,height:i.height})},i.onerror=()=>{this._opt.failureCallback&&this._opt.failureCallback()},i.src=e}update(e,t){this.navigationMap.updateUrl(e,t),this.navigationMap.destroy(),this.navigationMap.rebuildData(),this.navigationMap.render()}destroy(){this._opt.viewer.getViewer().removeCallbacks("render",this.renderCB),this.cloudMapManager.destroy(),this.navigationMap.destroy(),this.navigationMap.destroyEditor(),this.mapContainer.innerHTML=""}resize(e,t){var i=this._opt.domElement;i.style.width=e+"px",i.style.height=t+"px",this.navigationMap.resize(e,t),this.getEventManager().fireEvent("Resize",{width:e,height:t})}_clearState(){let e=this._opt.viewer,t=e._sectionBox;t&&t.exit(),e.restoreDefault()}_clearSectionBox(){let e=this._opt.viewer._sectionBox;e&&e.reset()}_updateSectionBox(e){let t=this._opt.viewer,i=t._sectionBox;if(!i){let e=new Glodon$1.Bimface.Plugins.Section.SectionBoxConfig;e.viewer=t,e.id="SectionBox",i=new Glodon$1.Bimface.Plugins.Section.SectionBox(e)}i.setBox(e),t.zoomToBoundingBox(e),t.render()}_updateToolBarByMinmapRect(e){const t=this._opt.domElement;let i=this._opt.viewer;if(this.toolbar)this.toolbar.show();else{let e=new Glodon$1.Bimface.UI.Button.ButtonConfig;e.id="mapIsolate",e.title=BimfaceLanguage.bf_panel_map_isolation,e.className="bf-map-button bf-map-isolate";let n=new Glodon$1.Bimface.UI.Button.Button(e);n.setHtml(BimfaceLanguage.bf_panel_map_isolation),n.setStyle({cursor:"default"}),n.addEventListener("Click",(()=>{this._clearState();let e=this.navigationMap.getBoundingBox();e=this._viewer.globalUnitUtil.revertBBox(e),i.isolateByBox(e,Glodon$1.Bimface.Viewer.IsolateOption.HideOthers),i.zoomToBoundingBox(e),this.navigationMap.clearRectPick(),this.toolbar.hide(),i.render()}));let o=new Glodon$1.Bimface.UI.Button.ButtonConfig;o.id="mapSection",o.title=BimfaceLanguage.bf_panel_map_section,o.className="bf-map-button bf-map-section";let s=new Glodon$1.Bimface.UI.Button.Button(o);s.setHtml(BimfaceLanguage.bf_panel_map_section),s.setStyle({cursor:"default"}),s.addEventListener("Click",(()=>{this._clearState();let e=this.navigationMap.getBoundingBox();e=this._viewer.globalUnitUtil.revertBBox(e),this._clearSectionBox(),this._updateSectionBox(e),this.navigationMap.clearRectPick(),this.toolbar.hide(),i.render()}));let r=new Glodon$1.Bimface.UI.Button.ButtonConfig;r.id="mapCancel",r.title=BimfaceLanguage.bf_general_cancel,r.className="bf-map-button bf-map-cancel";let a=new Glodon$1.Bimface.UI.Button.Button(r);a.setHtml(BimfaceLanguage.bf_general_cancel),a.setStyle({cursor:"default"}),a.addEventListener("Click",(e=>{this.navigationMap.clearRectPick(),this.toolbar.hide()})),a.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation()}));let l=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;l.className="bf-map-toolbar",this.toolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(l),this.toolbar.addControls([n,s,a]),this.toolbar.element.style.zIndex=11,t.appendChild(this.toolbar.element)}t.offsetWidth;const n=t.offsetHeight,o=this.toolbar.element.offsetWidth,s=this.toolbar.element.offsetHeight;e.x+e.width<o?this.toolbar.element.style.left=e.x+"px":this.toolbar.element.style.left=e.x+e.width-o+"px",n<e.y+e.height+s?this.toolbar.element.style.top=e.y+e.height-s-6+"px":this.toolbar.element.style.top=e.y+e.height+6+"px",(this.toolbar.element.offsetLeft+this.toolbar.element.offsetWidth>this._opt.domElement.offsetWidth||this.toolbar.element.offsetTop+this.toolbar.element.offsetHeight>this._opt.domElement.offsetHeight||this.toolbar.element.offsetLeft<0||this.toolbar.element.offsetTop<0)&&this.toolbar.hide()}}}(),function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.NavigationMap");t.MapViewer=class{constructor(t){e.send("Bimface.Plugins.NavigationMap.MapViewer","bf_c_newMapViewer"),this.domElement=t.domElement,this.eventManager=new Glodon$1.Web.Lang.EventManager,skipVueObserver(this)}destroy(){}addEventListener(e,t){this.eventManager.addEvent(e,t)}removeEventListener(e,t){this.eventManager.getEventManager().removeEvent(e,t)}}}(),function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Common");e.Console=class{constructor(){this.consoleType="log",this._enable=!0}formatData(e){return"."!==(e=e.toString())[e.length-1]&&(e+="."),e}setConsoleType(e){["log","warn","error","info"].indexOf(e)>=0&&(this.consoleType=e)}warn(e){this._enable&&console[this.consoleType](`[BIMFACE WARN]: ${this.formatData(e)}`)}info(e){this._enable&&console[this.consoleType](`[BIMFACE INFO]: ${this.formatData(e)}`)}error(e){this._enable&&console[this.consoleType](`[BIMFACE ERROR]: ${this.formatData(e)}`)}obsolete(e,t,i=!0){if(!this._enable)return;const n=e=>(")"!==(e=e.toString())[e.length-1]&&(e+="()"),e);i&&(e=n(e),t=n(t));const o=`${e} is obsolete, please use ${t} instead.`;this.setConsoleType("warn"),this.warn(o)}updateDataSource(e){this._enable&&console.error(`[BIMFACE ERROR]:${e} is not compatible with the data source. Please upgrade the data source and try again.`)}open(){this._enable=!0,this.info("Console opened")}close(){this.info("Console closed"),this._enable=!1}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.NavigationMap");e.MapViewerConfig=class{constructor(){this.console=new Glodon$1.Web.Common.Console,this.console.obsolete("The Class 'Glodon.Bimface.Plugins.NavigationMap.MapViewer'","Glodon.Bimface.Plugins.NavigationMapConfig.domElement",!1),this.map=null,this.domElement=[]}}}();var extendStatics$2=function(e,t){return extendStatics$2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},extendStatics$2(e,t)};function __extends$2(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics$2(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var CubeComponent=function(){function e(){this.faceDefaultColor=14936556,this.wireframeDefaultColor=13421772,this.faceHighlightColor=12255212,this.wireframeHighlightColor=3330982}return e.prototype.createMesh=function(e){for(var t=new THREE.BufferGeometry,i=e.length-2,n=new Uint32Array(3*i),o=0,s=1;s<=i;s++)n[o++]=0,n[o++]=s,n[o++]=s+1;for(var r=new THREE.MeshBasicMaterial({color:this.faceDefaultColor,side:THREE.DoubleSide}),a=new Float32Array(3*e.length),l=0;l<e.length;l++)a[3*l]=e[l].x,a[3*l+1]=e[l].y,a[3*l+2]=e[l].z;t.setAttribute("position",new THREE.Float32BufferAttribute(a,3)),t.setIndex(new THREE.BufferAttribute(n,1));var h=new THREE.Mesh(t,r);return h.componentId=this.componentId,h},e.prototype.createWireframe=function(e){for(var t=new THREE.LineGeometry,i=[],n=0;n<e.length;n++){var o=e[n];i.push(o.x,o.y,o.z)}t.setPositions(i);var s=new THREE.LineMaterial({color:this.wireframeDefaultColor,linewidth:1});s.resolution.set(160,160);var r=new THREE.Line2(t,s);return r.componentId=this.componentId,r},e.prototype.getMesh=function(){return this.mesh},e.prototype.getWireframe=function(){return this.wireframeMesh},e.prototype.transparent=function(e){e.material&&(e.material.transparent=!0,e.material.opacity=0)},e.prototype.opaque=function(e){e.material&&(e.material.transparent=!1,e.material.opacity=1)},e.prototype.getId=function(){return this.componentId},e}(),CubeEdge=function(e){function t(t,i,n){var o=e.call(this)||this;return o.highlightWidth=3,o.width=15,o.vertices=t,o.indices=i,o.componentId=n,o.highlightWireframeMesh=null,o.testWireframe=null,o.build(),o}return __extends$2(t,e),t.prototype.build=function(){var e=this.indices[0],t=this.indices[1],i=this.vertices[e],n=this.vertices[t],o=i.clone().add(n).multiplyScalar(.5).clone().multiplyScalar(-1),s=o.clone().normalize(),r=[],a=n.clone().sub(i).normalize(),l=i.clone().add(a.clone().multiplyScalar(20)),h=i.clone().add(a.clone().multiplyScalar(80)),d=[];if(0!==o.x){var c=o.x>0?this.width:-this.width;d.push((new THREE.Vector3).setX(c).add(s))}if(0!==o.y){var u=o.y>0?this.width:-this.width;d.push((new THREE.Vector3).setY(u).add(s))}if(0!==o.z){var p=o.z>0?this.width:-this.width;d.push((new THREE.Vector3).setZ(p).add(s))}2===d.length&&(r.push(l.clone().add(s)),r.push(l.clone().add(d[0])),r.push(h.clone().add(d[0])),r.push(h.clone().add(s)),r.push(h.clone().add(d[1])),r.push(l.clone().add(d[1]))),this.mesh=this.createMesh(r),this.transparent(this.mesh),this.wireframeMesh=this.createWireframe([l,h]),this.highlightWireframeMesh=this.createHighlightWireframe([l.sub(s),h.sub(s)])},t.prototype.createHighlightWireframe=function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i];t.push(n.x,n.y,n.z)}var o=new THREE.LineGeometry;o.setPositions(t);var s=new THREE.LineMaterial({color:this.wireframeHighlightColor,linewidth:this.highlightWidth,dashed:!1});s.resolution.set(160,160);var r=new THREE.Line2(o,s);return r.computeLineDistances(),r.scale.set(1,1,1),r.visible=!1,r.renderOrder=100,r},t.prototype.getTestWireframe=function(){return this.testWireframe},t.prototype.getHighlightWireframeMesh=function(){return this.highlightWireframeMesh},t.prototype.highlight=function(){this.highlightWireframeMesh.visible=!0,this.highlightWireframeMesh.renderOrder=100},t.prototype.cancelHighlight=function(){this.highlightWireframeMesh.visible=!1},t}(CubeComponent),CubeCorner=function(e){function t(t,i){var n=e.call(this)||this;return n.length=20,n.vertex=t,n.cornerFace=null,n.cornerWireframe=null,n.componentId=i,n.cornerVertices=null,n.build(),n}return __extends$2(t,e),t.prototype.build=function(){var e=[],t=this.vertex.clone(),i=t.clone().multiplyScalar(-1);e.push(t);var n=this.vertex.clone(),o=i.x>0?this.length:-this.length;n.x+=o,e.push(n);var s=this.vertex.clone(),r=i.y>0?this.length:-this.length;s.y+=r,e.push(s);var a=this.vertex.clone(),l=i.z>0?this.length:-this.length;a.z+=l,e.push(a),this.cornerVertices=e,this.mesh=this.createMesh([n,s,a]),this.wireframeMesh=this.createWireframe([n,s,a,n]),this.buildCornerFace(),this.buildCornerWireframe()},t.prototype.highlight=function(){this.wireframeMesh.material.color.setHex(this.wireframeHighlightColor),this.wireframeMesh.renderOrder=100,this.mesh.material.color.setHex(this.faceHighlightColor),this.cornerFace.material.color.setHex(this.faceHighlightColor),this.cornerFace.material.transparent=!0,this.cornerFace.material.opacity=.5,this.cornerWireframe.material.color.setHex(this.wireframeHighlightColor),this.cornerWireframe.visible=!0},t.prototype.cancelHighlight=function(){this.wireframeMesh.material.color.setHex(this.wireframeDefaultColor),this.wireframeMesh.renderOrder=0,this.mesh.material.color.setHex(this.faceDefaultColor),this.transparent(this.cornerFace),this.cornerWireframe.visible=!1},t.prototype.buildCornerFace=function(){if(!this.cornerFace){var e=this.cornerVertices;e.push(e[1]),this.cornerFace=this.createMesh(e),this.transparent(this.cornerFace)}},t.prototype.getCornerFace=function(){return this.cornerFace},t.prototype.getCornerWireframe=function(){return this.cornerWireframe},t.prototype.buildCornerWireframe=function(){if(!this.cornerWireframe){for(var e=[],t=1;t<this.cornerVertices.length;t++){var i=this.cornerVertices[0],n=this.cornerVertices[t];e.push(i,n)}this.cornerWireframe=this.createWireframe(e),this.cornerWireframe.visible=!1}},t}(CubeComponent),CubeFace=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.length=60,s.vertices=t,s.indices=i,s.componentId=n,s.vertexUvs=null,s.texture=o,s.highlightMesh=null,s.wireframeMesh=null,s.vertexUvs=[],s.vertexUvs.push(new THREE.Vector2(0,.2)),s.vertexUvs.push(new THREE.Vector2(0,.8)),s.vertexUvs.push(new THREE.Vector2(.2,1)),s.vertexUvs.push(new THREE.Vector2(.8,1)),s.vertexUvs.push(new THREE.Vector2(1,.8)),s.vertexUvs.push(new THREE.Vector2(1,.2)),s.vertexUvs.push(new THREE.Vector2(.8,0)),s.vertexUvs.push(new THREE.Vector2(.2,0)),s.build(),s}return __extends$2(t,e),t.prototype.build=function(){for(var e=[],t=null,i=null,n=0,o=this.indices.length;n<o;n++){var s=this.indices[n],r=this.indices[n+1];t=this.vertices[s],i=this.vertices[r],n===o-1&&(i=this.vertices[this.indices[0]]);var a=i.clone().sub(t).normalize(),l=t.clone().add(i).multiplyScalar(.5);e.push(l.clone().sub(a.clone().multiplyScalar(this.length/2))),e.push(l.clone().add(a.clone().multiplyScalar(this.length/2)))}this.createTexturedMesh(e);for(var h=new THREE.Box3,d=0;d<this.indices.length;d++){var c=this.indices[d];h.expandByPoint(this.vertices[c])}for(var u=h.getCenter(new THREE.Vector3).normalize(),p=[],g=0;g<e.length;g++){var m=e[g];p.push(m.clone().add(u))}this.highlightMesh=this.createMesh(p),this.highlightMesh.visible=!1,this.highlightMesh.isHighlightMesh=!0,p.push(p[0]),this.wireframeMesh=this.createWireframe(p)},t.prototype.highlight=function(){this.highlightMesh.visible=!0,this.highlightMesh.material.color.setHex(this.faceHighlightColor),this.highlightMesh.material.transparent=!0,this.highlightMesh.material.opacity=.5,this.wireframeMesh.material.color.setHex(this.wireframeHighlightColor)},t.prototype.cancelHighlight=function(){this.highlightMesh.visible=!1,this.wireframeMesh.material.color.setHex(this.wireframeDefaultColor)},t.prototype.createTexturedMesh=function(e){for(var t=e.length-2,i=new Uint32Array(3*t),n=0,o=1;o<=t;o++)i[n++]=0,i[n++]=o,i[n++]=o+1;for(var s=new THREE.BufferGeometry,r=new Float32Array(3*e.length),a=0;a<e.length;a++)r[3*a]=e[a].x,r[3*a+1]=e[a].y,r[3*a+2]=e[a].z;for(var l=new Float32Array(2*this.vertexUvs.length),h=0;h<this.vertexUvs.length;h++)l[2*h]=this.vertexUvs[h].x,l[2*h+1]=this.vertexUvs[h].y;s.setAttribute("position",new THREE.Float32BufferAttribute(r,3)),s.setAttribute("uv",new THREE.Float32BufferAttribute(l,2)),s.setIndex(new THREE.BufferAttribute(i,1));var d=new THREE.MeshBasicMaterial({map:this.texture,side:THREE.DoubleSide,transparent:!1});this.mesh=new THREE.Mesh(s,d),this.mesh.componentId=this.componentId},t.prototype.getHighlightMesh=function(){return this.highlightMesh},t.prototype.buildVertexUvs=function(e){var t=[],i=(new THREE.Box3).setFromPoints(e),n=i.min,o=new THREE.Vector2;i.getSize(o);for(var s=0==o.x?"x":0==o.y?"y":"z",r=0;r<e.length;r++){var a=e[r],l=(o.x+o.y+o.z)/2,h=a.clone().sub(n).multiplyScalar(1/l),d=new THREE.Vector2(h.x,h.y);"x"==s?d=new THREE.Vector2(h.y,h.z):"y"==s&&(d=new THREE.Vector2(h.x,h.z)),t.push(d)}return t},t}(CubeComponent),CubeArrow=function(e){function t(t,i,n){var o=e.call(this)||this;switch(n){case"X":o.wireframeDefaultColor=16722181;break;case"Y":o.wireframeDefaultColor=1647355;break;case"Z":o.wireframeDefaultColor=3330982}return o.width=0,o.vertices=t,o.indices=i,o.componentId=n,o.testWireframe=null,o.build(),o}return __extends$2(t,e),t.prototype.build=function(){var e=this.indices[0],t=this.indices[1],i=this.vertices[e],n=this.vertices[t],o=i.clone().add(n).multiplyScalar(.5).clone().multiplyScalar(-1),s=o.clone().normalize(),r=[],a=n.clone().sub(i).normalize(),l=i.clone(),h=i.clone().add(a.clone().multiplyScalar(105)),d=[];if(0!==o.x){var c=o.x>0?this.width:-this.width;d.push((new THREE.Vector3).setX(c).add(s))}if(0!==o.y){var u=o.y>0?this.width:-this.width;d.push((new THREE.Vector3).setY(u).add(s))}if(0!==o.z){var p=o.z>0?this.width:-this.width;d.push((new THREE.Vector3).setZ(p).add(s))}2===d.length&&(r.push(l.clone().add(s)),r.push(l.clone().add(d[0])),r.push(h.clone().add(d[0])),r.push(h.clone().add(s)),r.push(h.clone().add(d[1])),r.push(l.clone().add(d[1]))),this.mesh=this.createMesh(r),this.transparent(this.mesh),this.wireframeMesh=this.createWireframe([l,h]);var g=i.clone().add(a.clone().multiplyScalar("Z"==this.componentId?125:120));this.createTextWireframe(g),this.hide()},t.prototype.createWireframe=function(e){for(var t=new THREE.LineGeometry,i=[],n=0;n<e.length;n++){var o=e[n];i.push(o.x,o.y,o.z)}t.setPositions(i);var s=new THREE.LineMaterial({color:this.wireframeDefaultColor,linewidth:2});s.resolution.set(160,160);var r=new THREE.Line2(t,s);r.componentId=this.componentId;var a=new THREE.LineMaterial({color:this.wireframeDefaultColor,linewidth:2,depthTest:!0,transparent:!0,opacity:.3,depthFunc:THREE.GreaterDepth});a.resolution.set(160,160);var l=new THREE.Line2(t,a);return this.wireframeMeshBack=l,r},t.prototype.createTextWireframe=function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),n='32px -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",SimSun, sans-serif';i.font=n;var o=i.measureText(this.componentId.toString()),s=o.width,r=o.actualBoundingBoxAscent;t.width=64,t.height=64,i.font=n,i.fillStyle={X:"#FF2905",Y:"#1922FB",Z:"#32D3A6"}[this.componentId.toString()],i.fillText(this.componentId.toString(),(64-s)/2,(64+r)/2);var a=new THREE.CanvasTexture(t),l=new THREE.SpriteMaterial({map:a}),h=new THREE.Sprite(l);h.position.set(e.x,e.y,e.z),h.scale.set(45,45,45),h.renderOrder=100,this.textMesh=h;var d=new THREE.SpriteMaterial({map:a,transparent:!0,opacity:.3,depthFunc:THREE.GreaterDepth}),c=new THREE.Sprite(d);c.position.set(e.x,e.y,e.z),c.scale.set(45,45,45),c.renderOrder=100,this.textMeshBack=c},t.prototype.show=function(){this.mesh.visible=!0,this.wireframeMesh.visible=!0,this.wireframeMeshBack.visible=!0,this.textMesh.visible=!0,this.textMeshBack.visible=!0},t.prototype.hide=function(){this.mesh.visible=!1,this.wireframeMesh.visible=!1,this.wireframeMeshBack.visible=!1,this.textMesh.visible=!1,this.textMeshBack.visible=!1},t.prototype.getTestWireframe=function(){return this.testWireframe},t.prototype.getWireframeMeshBack=function(){return this.wireframeMeshBack},t.prototype.getTextMesh=function(){return this.textMesh},t.prototype.getTextMeshBack=function(){return this.textMeshBack},t.prototype.highlight=function(){},t.prototype.cancelHighlight=function(){},t}(CubeComponent),BimCubeData=function(){function e(e,t){this.languageType=e,this.initialize(),this.scene=new THREE.Scene,this.callback=t,this.buildEdges(),this.buildCorners(),this.buildFaces(),this.buildArrows()}return e.prototype.initialize=function(){this.enumViewMode={2673:"Top",4015:"Bottom","0231":"Front",5764:"Back",1375:"Right",4620:"Left",3:"RoofSouthEast",2:"RoofSouthWest",7:"RoofNorthEast",6:"RoofNorthWest",1:"BottomSouthEast",0:"BottomSouthWest",4:"BottomNorthWest",5:"BottomNorthEast",32:"RoofFront",76:"RoofBack",37:"RoofRight",26:"RoofLeft","01":"BottomFront",45:"BottomBack",15:"BottomRight","04":"BottomLeft",13:"SouthEast",20:"SouthWest",57:"NorthEast",64:"NorthWest"},this.length=100,this.vertices=[],this.vertexIds=[],this.edgeIds=[],this.edgeIndices=[],this.faceIds=[],this.faceIndices=[],this.componentList=[],this.texturesLoaded=0;var e=this.length;this.vertices.push(new THREE.Vector3(-e/2,-e/2,e/2)),this.vertices.push(new THREE.Vector3(e/2,-e/2,e/2)),this.vertices.push(new THREE.Vector3(-e/2,e/2,e/2)),this.vertices.push(new THREE.Vector3(e/2,e/2,e/2)),this.vertices.push(new THREE.Vector3(-e/2,-e/2,-e/2)),this.vertices.push(new THREE.Vector3(e/2,-e/2,-e/2)),this.vertices.push(new THREE.Vector3(-e/2,e/2,-e/2)),this.vertices.push(new THREE.Vector3(e/2,e/2,-e/2));for(var t=0;t<8;t++)this.vertexIds.push(t+"");this.edgeIndices.push([0,1],[1,3],[3,2],[2,0]),this.edgeIndices.push([0,4],[1,5],[2,6],[3,7]),this.edgeIndices.push([4,5],[5,7],[7,6],[6,4]);for(t=0;t<12;t++){var i=this.edgeIndices[t];this.edgeIds.push(i[0]+""+i[1])}this.faceIndices.push([0,2,3,1]),this.faceIndices.push([4,0,1,5]),this.faceIndices.push([4,6,2,0]),this.faceIndices.push([2,6,7,3]),this.faceIndices.push([1,3,7,5]),this.faceIndices.push([5,7,6,4]);for(t=0;t<6;t++){var n=this.faceIndices[t];this.faceIds.push(n[0]+""+n[1]+n[2]+n[3])}},e.prototype.buildFaces=function(){for(var e=this.vertices,t=this.faceIndices,i=this.faceIds,n=function(n){var s=window.BimfaceLoaderConfig.fullStaticHost+"/textures/"+o.languageType+"/"+o.enumViewMode[i[n]]+".png",r=new THREE.TextureLoader;r.setCrossOrigin("anonymous");var a=o;r.load(s,(function(o){o.colorSpace=THREE.SRGBColorSpace;var s=new CubeFace(e,t[n],i[n],o);a.componentList.push(s),a.scene.add(s.getMesh()),a.scene.add(s.getWireframe()),a.scene.add(s.getHighlightMesh()),6==++a.texturesLoaded&&a.callback&&a.callback()}))},o=this,s=0;s<6;s++)n(s)},e.prototype.buildEdges=function(){for(var e=this.vertices,t=this.edgeIndices,i=this.edgeIds,n=0;n<12;n++){var o=new CubeEdge(e,t[n],i[n]);this.componentList.push(o),this.scene.add(o.getMesh()),this.scene.add(o.getWireframe()),this.scene.add(o.getHighlightWireframeMesh())}},e.prototype.buildCorners=function(){for(var e=this.vertices,t=this.vertexIds,i=0;i<8;i++){var n=new CubeCorner(e[i],t[i]);this.componentList.push(n),this.scene.add(n.getMesh()),this.scene.add(n.getWireframe()),this.scene.add(n.getCornerFace()),this.scene.add(n.getCornerWireframe())}},e.prototype.buildArrows=function(){var e=[],t=this.length+10;e.push(new THREE.Vector3(-t/2,-t/2,t/2)),e.push(new THREE.Vector3(t/2,-t/2,t/2)),e.push(new THREE.Vector3(-t/2,-t/2,-t/2)),e.push(new THREE.Vector3(-t/2,t/2,t/2));for(var i=[[0,1],[0,2],[0,3]],n=["X","Y","Z"],o=0;o<3;o++){var s=new CubeArrow(e,i[o],n[o]);this.componentList.push(s),this.scene.add(s.getMesh()),this.scene.add(s.getWireframe()),this.scene.add(s.getWireframeMeshBack()),this.scene.add(s.getTextMesh()),this.scene.add(s.getTextMeshBack())}},e.prototype.getComponent=function(e){for(var t=0;t<this.componentList.length;t++){var i=this.componentList[t];if(i.getId()==e)return i}return null},e.prototype.transparentCorners=function(){},e.prototype.opaqueCorners=function(){},e.prototype.getScene=function(){return this.scene},e.prototype.getMeshes=function(){for(var e=[],t=this.scene.children,i=0;i<t.length;i++){var n=t[i];"Mesh"===n.type&&!0!==n.isHighlightMesh&&e.push(n)}return e},e.prototype.destroy=function(){this.scene=null,this.vertices=null,this.vertexIds=null,this.edgeIds=null,this.edgeIndices=null,this.faceIds=null,this.faceIndices=null,this.componentList=null,this.enumViewMode=null},e}(),BimCubeView=function(){function e(e,t){this.container=e,this.bimCubeData=t,this.activeCamera=new THREE.OrthographicCamera(-120,120,120,-120,.01,500),this.activeCamera.position.set(0,0,200),this.activeScene,this.initialize(),this.cameraTarget=new THREE.Vector3(0,0,0)}return e.prototype.initialize=function(){var e,t;this.renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),this.container.appendChild(this.renderer.domElement),"none"==this.container.style.display?(e=this.container.style.width.replace("px",""),t=this.container.style.height.replace("px","")):(e=this.container.offsetWidth,t=this.container.offsetHeight),this.renderer.setSize(e,t)},e.prototype.switchCameraType=function(e){},e.prototype.getActiveCamera=function(){return this.activeCamera},e.prototype.setActiveScene=function(e){this.activeScene=e},e.prototype.render=function(e){e&&(this.activeCamera.position.copy(new THREE.Vector3(0,0,200).applyQuaternion(e.quaternion)),this.activeCamera.up.copy(e.up),this.activeCamera.lookAt(this.cameraTarget),this.activeCamera.updateMatrixWorld());var t=this.activeScene||this.bimCubeData.getScene();this.renderer.autoClear=!0,this.renderer.render(t,this.activeCamera)},e.prototype.destroy=function(){this.container.removeChild(this.renderer.domElement),this.container=null,this.renderer.dispose(),this.renderer=null,this.activeScene=null,this.bimCubeData=null,this.activeCamera=null},e.enumTypes={PERSPECTIVE:1e3,ORTHOGRAPHIC:1001},e}(),EventManager$2=function(){function e(){this.eventDispatcher=new THREE.EventDispatcher}return e.prototype.addEventListener=function(e,t){this.eventDispatcher.addEventListener(e,t)},e.prototype.hasEventListener=function(e){this.eventDispatcher.hasEventListener(e)},e.prototype.removeEventListener=function(e,t){this.eventDispatcher.removeEventListener(e,t)},e.prototype.dispatchEvent=function(e){this.eventDispatcher.dispatchEvent(e)},e.enumTypes={ON_COMPONENT_HOVER:1e3,ON_COMPONENT_CLICK:1001},e}(),BimCubeEditor=function(){function e(e,t,i){this.eventManager=new EventManager$2,this.container=e,this.bimCubeData=t,this.bimCubeView=i,this.initialize()}return e.prototype.initialize=function(){this.onMouseDownBinded=this.onMouseDown.bind(this),this.onMouseUpBinded=this.onMouseUp.bind(this),this.onMouseMoveBinded=this.onMouseMove.bind(this);var e=this.container;e.addEventListener("mousemove",this.onMouseMoveBinded,!1),e.addEventListener("mousedown",this.onMouseDownBinded,!1),this.raycaster=new THREE.Raycaster,this.lastHoverComponentId=null,this.bMouseDown=!1,this.mouseDownPos=null,this.doubleClickFlag=!1},e.prototype.onMouseDown=function(e){this.bMouseDown=!0,this.mouseDownPos=new THREE.Vector2(e.offsetX,e.offsetY),window.addEventListener("mouseup",this.onMouseUpBinded,!1)},e.prototype.onMouseMove=function(e){if(!this.bMouseDown){var t={x:e.offsetX,y:e.offsetY},i=this.canvasToNormalized(t),n=this.hitTest(i),o=this.lastHoverComponentId;if(n){if(n!=this.lastHoverComponentId)this.bimCubeData.getComponent(n).highlight(),this.bimCubeView.render(),this.lastHoverComponentId=n}else this.lastHoverComponentId=null;if(o&&n!=o)this.bimCubeData.getComponent(o).cancelHighlight(),this.bimCubeView.render()}},e.prototype.onMouseUp=function(e){if(window.removeEventListener("mouseup",this.onMouseUpBinded),0!=this.bMouseDown){var t=this;if(0==this.doubleClickFlag){this.doubleClickFlag=!0,setTimeout((function(){t.doubleClickFlag=!1}),1e3),this.bMouseDown=!1;var i=new THREE.Vector2(e.offsetX,e.offsetY);if(i.x==this.mouseDownPos.x&&i.y==this.mouseDownPos.y){var n={x:e.offsetX,y:e.offsetY},o=this.canvasToNormalized(n),s=this.hitTest(o);if(s){if(this.lastHoverComponentId)this.bimCubeData.getComponent(this.lastHoverComponentId).cancelHighlight(),this.lastHoverComponentId=null,this.bimCubeView.render();var r={type:EventManager$2.enumTypes.ON_COMPONENT_CLICK,componentId:s,viewType:this.bimCubeData.enumViewMode[s]};this.eventManager.dispatchEvent(r)}}}else this.bMouseDown=!1}},e.prototype.canvasToNormalized=function(e){var t=this.container.offsetWidth,i=this.container.offsetHeight,n={x:0,y:0};return n.x=e.x/t*2-1,n.y=-e.y/i*2+1,n},e.prototype.hitTest=function(e){var t=this.bimCubeView.getActiveCamera();this.raycaster.setFromCamera(e,t);var i=this.bimCubeData.getMeshes(),n=this.raycaster.intersectObjects(i,!0);if(0!=n.length){var o=n[0].object.componentId;if(n.length>=2){var s=n[1].object.componentId;4==o.length&&2==s.length&&n[1].distance<n[0].distance+5&&(o=s)}return o}},e.prototype.addEventListener=function(e,t){this.eventManager.addEventListener(e,t)},e.prototype.destroy=function(){window.removeEventListener("mouseup",this.onMouseUpBinded),this.container.removeEventListener("mousemove",this.onMouseMoveBinded),this.container.removeEventListener("mousedown",this.onMouseDownBinded),this.container=null,this.eventManager=null,this.bimCubeData=null,this.bimCubeView=null,this.onMouseDownBinded=null,this.onMouseUpBinded=null,this.onMouseMoveBinded=null,this.raycaster=null,this.lastHoverComponentId=null,this.mouseDownPos=null},e}(),BimCube=function(){function e(e,t,i){this.callback=i,this.functionsUnexecuted=[];var n=this;this.bimCubeData=new BimCubeData(t,(function(){n.bimCubeView=new BimCubeView(e,n.bimCubeData),n.bimCubeEditor=new BimCubeEditor(e,n.bimCubeData,n.bimCubeView),n.callback&&n.callback(),n.applyFunctionsUnexecuted()}))}return e.prototype.applyFunctionsUnexecuted=function(){for(var e=this.functionsUnexecuted,t=0;t<e.length;t++){switch(e[t]){case"show":this.show();break;case"hide":this.hide();break;case"showCoordinateSystem":this.showCoordinateSystem();break;case"hideCoordinateSystem":this.hideCoordinateSystem()}}this.functionsUnexecuted=[]},e.prototype.switchCameraType=function(e){this.bimCubeView.switchCameraType(e)},e.prototype.addEventListener=function(e,t){this.bimCubeEditor.addEventListener(e,t)},e.prototype.show=function(){if(this.bimCubeView){var e=this.bimCubeData.getScene();this.bimCubeView.setActiveScene(e),this.bimCubeView.render()}else this.functionsUnexecuted.push("show")},e.prototype.hide=function(){if(this.bimCubeView){var e=new THREE.Scene;this.bimCubeView.setActiveScene(e),this.bimCubeView.render()}else this.functionsUnexecuted.push("hide")},e.prototype.showCoordinateSystem=function(){this.bimCubeView?(this.bimCubeData.getComponent("X").show(),this.bimCubeData.getComponent("Y").show(),this.bimCubeData.getComponent("Z").show(),this.bimCubeView.render()):this.functionsUnexecuted.push("showCoordinateSystem")},e.prototype.hideCoordinateSystem=function(){this.bimCubeView?(this.bimCubeData.getComponent("X").hide(),this.bimCubeData.getComponent("Y").hide(),this.bimCubeData.getComponent("Z").hide(),this.bimCubeView.render()):this.functionsUnexecuted.push("hideCoordinateSystem")},e.prototype.update=function(e){this.bimCubeView.render(e)},e.prototype.destroy=function(){this.bimCubeData&&this.bimCubeData.destroy(),this.bimCubeData=null,this.bimCubeEditor&&this.bimCubeEditor.destroy(),this.bimCubeEditor=null,this.bimCubeView&&this.bimCubeView.destroy(),this.bimCubeView=null,this.callback=null,this.functionsUnexecuted=null},e}();!function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins");e.ViewHouseNavi=class{constructor(e,t){this.viewer=e.getViewer(),this.enumEventTypes={ON_COMPONENT_HOVER:1e3,ON_COMPONENT_CLICK:1001},this.initialize();var i=this;this.bimcube=new BimCube(t,BimfaceLanguage.name,(function(){i.hookEvents(),i.bimcube.update(i.viewer.getActiveCameraInfo())}))}initialize(){this.enumViewMode={Home:0,Top:1,Bottom:2,Front:3,Back:4,Right:5,Left:6,SouthEast:7,SouthWest:8,NorthEast:9,NorthWest:10,BottomFront:11,BottomBack:12,BottomRight:13,BottomLeft:14,BottomSouthEast:15,BottomSouthWest:16,BottomNorthEast:17,BottomNorthWest:18,RoofFront:19,RoofBack:20,RoofRight:21,RoofLeft:22,RoofSouthEast:23,RoofSouthWest:24,RoofNorthEast:25,RoofNorthWest:26,TopTurnRight:27,TopTurnBack:28,TopTurnLeft:29,BottomTurnRight:30,BottomTurnBack:31,BottomTurnLeft:32,FrontTurnRight:33,FrontTurnTop:34,FrontTurnLeft:35,RightTurnBack:36,RightTurnTop:37,RightTurnFront:38,BackTurnRight:39,BackTurnTop:40,BackTurnLeft:41,LeftTurnFront:42,LeftTurnTop:43,LeftTurnBack:44}}hookEvents(){var e=this.bimcube,t=this.viewer,i=this.enumViewMode,n=function(){t.render()};e.addEventListener(this.enumEventTypes.ON_COMPONENT_CLICK,(function(e){var o=i[e.viewType];o&&t.setStandardView(o,null,n,n)})),t.addRenderCallback((function(){e.update(t.getActiveCameraInfo())}))}setVisible(e){!0===e?this.bimcube.show():this.bimcube.hide()}setCoordinateSystemVisible(e){!0===e?this.bimcube.showCoordinateSystem():this.bimcube.hideCoordinateSystem()}getImpl(){return this.bimcube}destroy(){this.viewer=null,this.enumEventTypes=null,this.enumViewMode=null,this.bimcube.destroy(),this.bimcube=null}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").ViewHouseConfig=function(){return{width:150,height:150,domElement:null,viewer:null}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Application.UI.Menu").ViewHouseMenu=function(e){var t=this,i=e.viewer;this.viewer=i;var n=e.domElement,o=Glodon$1.Bimface.UI.Control.ControlEvent,s=Glodon$1.Bimface.Viewer.Viewer3DEvent,r=i.getDomElement(),a=new Glodon$1.Bimface.UI.Menu.MenuConfig;a.element=n,this.menu=new Glodon$1.Bimface.UI.Menu.Menu(a),this.menu.element.style.backgroundColor="#EBEFF1",this.menu.element.style.border="1px solid #D0D6D6";var l=this.menu,h=new Glodon$1.Bimface.UI.Menu.MenuItemConfig;h.id="home";var d=new Glodon$1.Bimface.UI.Menu.MenuItem(h);function c(){t.switchHomeView()}function u(){t.switchHomeView(),t.hide()}d.setText(BimfaceLanguage.bf_viewHouse_home),d.element.addClass("bf-menu-item1"),i.getEventManager().addEvent(s.ToolbarHomeClick,c),d.addEventListener(o.Click,u),this.switchHomeView=function(){var e=i.getCustomHomeview(),t=i.getDefaultHomeview(),n=e||t,o=i.getCameraStatus().name;n.name=o,"orth"==o&&g.setText(BimfaceLanguage.bf_viewHouse_perspective),"persp"==o&&g.setText(BimfaceLanguage.bf_viewHouse_orthographic),i.setCameraStatus(n,(function(){0==i.getCameraAnimation()&&i.render()}))};var p=new Glodon$1.Bimface.UI.Menu.MenuItemConfig;p.id="orthographic";var g=new Glodon$1.Bimface.UI.Menu.MenuItem(p);function m(){t.hide(),g.element.textContent==BimfaceLanguage.bf_viewHouse_orthographic?(i.setCameraType("OrthographicCamera"),i.render(),g.setText(BimfaceLanguage.bf_viewHouse_perspective)):(i.setCameraType("PerspectiveCamera"),i.render(),g.setText(BimfaceLanguage.bf_viewHouse_orthographic))}g.setText(BimfaceLanguage.bf_viewHouse_orthographic),g.element.addClass("bf-menu-item1"),g.addEventListener(o.Click,m),this.orthographic=g;var f=new Glodon$1.Bimface.UI.Menu.MenuItemConfig;f.id="setAsHome";var w=new Glodon$1.Bimface.UI.Menu.MenuItem(f);function v(){t.hide();var e=i.getCameraStatus();i.recordCustomHomeview(e)}w.setText(BimfaceLanguage.bf_viewHouse_setAsHome),w.element.addClass("bf-menu-item1"),w.addEventListener(o.Click,v);var y=new Glodon$1.Bimface.UI.Menu.MenuItemConfig;y.id="resetHome";var b=new Glodon$1.Bimface.UI.Menu.MenuItem(y);function E(){t.hide(),i.recordCustomHomeview(null)}b.setText(BimfaceLanguage.bf_viewHouse_resetHome),b.element.addClass("bf-menu-item1"),b.addEventListener(o.Click,E);var x=new Glodon$1.Bimface.UI.Menu.Spacer;x.element.style.backgroundColor="#D0D6D6";var C=new Glodon$1.Bimface.UI.Menu.Spacer;function M(e){l&&t.hide()}C.element.style.backgroundColor="#D0D6D6",this.menu.addControl(d),this.menu.addControl(x),this.menu.addControl(g),this.menu.addControl(C),this.menu.addControl(w),this.menu.addControl(b),this.hide=function(){this.menu.element.style.display="none"},this.show=function(){this.menu.element.style.display=""},this.isHide=function(){return"none"==this.menu.element.style.display},this.update=function(){var e=this.viewer.getCameraStatus().name;"orth"==e&&this.orthographic.setText(BimfaceLanguage.bf_viewHouse_perspective),"persp"==e&&this.orthographic.setText(BimfaceLanguage.bf_viewHouse_orthographic)},this.destroy=function(){i.getEventManager().removeEvent(s.ToolbarHomeClick,c),d.removeEventListener(o.Click,u),g.removeEventListener(o.Click,m),w.removeEventListener(o.Click,v),b.removeEventListener(o.Click,E),r.removeEventListener("mousedown",M),this.viewer=null,this.menu=null,this.orthographic=null},r.addEventListener("mousedown",M)},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=function(e){var i=e,n=t.create("div","bf-house");n.style.width=`${i.width}px`,n.style.height=`${i.height}px`,i.domElement.appendChild(n),this._domElement=n,this._opt=i,this.viewer=i.viewer,this.init()};i.prototype={init:function(){var e=this;this.viewHouseNavi=new Glodon$1.Bimface.Plugins.ViewHouseNavi(this._opt.viewer,this._domElement);var i=t.createNS("svg","bf-home-svg");i.setAttribute("viewBox","0 0 20 20");var n=t.createNS("g","");n.setAttribute("fill","none"),n.setAttribute("fill-rule","evenodd");var o=t.createNS("polygon","");o.setAttribute("fill","#E3E9EC"),o.setAttribute("points","1.207 9.5 3.5 9.5 3.5 16.499 7.501 16.499 7.503 12.5 12.5 12.5 12.5 16.499 16.5 16.499 16.5 9.5 18.793 9.5 10 .707"),i.addEventListener("mouseover",(function(){o.setAttribute("fill","#BAFFEC"),s.setAttribute("fill","#32D3A6")})),i.addEventListener("mouseout",(function(){o.setAttribute("fill","#E3E9EC"),s.setAttribute("fill","#BCC0C2")})),i.addEventListener("mousedown",(function(){e.viewHouseMenu.switchHomeView()}));var s=t.createNS("path","");s.setAttribute("fill","#BCC0C2"),s.setAttribute("d","M10,0 L0,10 L3,10 L3,17 L8,17 L8.003,13.001 L12,13.001 L12,17 L17,17 L17,10 L20,10 L10,0 Z M10,1.414 L17.586,9 L17,9 L16,9 L16,10 L16,16 L13,16 L13,13.001 L13,12 L12,12 L8.003,12 L7.004,12 L7.003,12.999 L7.001,16 L4,16 L4,10 L4,9 L3,9 L2.414,9 L10,1.414 Z"),n.appendChild(o),n.appendChild(s),i.appendChild(n),e._domElement.appendChild(i),this.homeSvg=i;var r=t.createNS("svg","bf-menu-svg");r.setAttribute("viewBox","0 0 20 20"),r.style.position="absolute";var a=t.createNS("g","");a.setAttribute("fill","none"),a.setAttribute("fill-rule","evenodd"),a.setAttribute("transform","translate(3 6)");var l=t.createNS("polygon","");l.setAttribute("fill","#E3E9EC"),l.setAttribute("points","1.207 4.5 6.999 10.292 12.793 4.5");var h=t.createNS("path","");h.setAttribute("fill","#BCC0C2"),h.setAttribute("d","M0.0004,3.9998 L6.9994,10.9998 L13.9994,3.9998 L0.0004,3.9998 Z M2.4144,4.9998 L11.5864,4.9998 L6.9994,9.5858 L2.4144,4.9998 Z");var d=t.createNS("polygon","");d.setAttribute("fill","#E3E9EC"),d.setAttribute("points",".5 2.5 13.5 2.5 13.5 .5 .5 .5");var c=t.createNS("path","");c.setAttribute("fill","#BCC0C2"),c.setAttribute("d","M0,3 L14,3 L14,0 L0,0 L0,3 Z M1,2 L13,2 L13,1 L1,1 L1,2 Z"),r.addEventListener("mouseover",(function(){l.setAttribute("fill","#BAFFEC"),h.setAttribute("fill","#32D3A6"),d.setAttribute("fill","#BAFFEC"),c.setAttribute("fill","#32D3A6")})),r.addEventListener("mouseout",(function(){l.setAttribute("fill","#E3E9EC"),h.setAttribute("fill","#BCC0C2"),d.setAttribute("fill","#E3E9EC"),c.setAttribute("fill","#BCC0C2")})),a.appendChild(l),a.appendChild(h),a.appendChild(d),a.appendChild(c),r.appendChild(a),e._domElement.appendChild(r),this.menuSvg=r;var u=new Glodon$1.Bimface.Application.UI.Menu.ViewHouseMenu(this._opt);this.viewHouseMenu=u,u.hide(),r.addEventListener("click",(function(t){e.viewer.getDomElement().getBoundingClientRect();u.isHide()?(u.update(),u.show()):u.hide()}))},enableViewHouse:function(e){this.viewHouseNavi.setVisible(e),this._domElement.style.display=!0===e?"block":"none"},enableCoordinateSystem:function(e){this.viewHouseNavi.setCoordinateSystemVisible(e)},getDomElement:function(){return this._domElement},destroy:function(){this.viewHouseNavi.destroy(),this.viewHouseNavi=null,this.viewHouseMenu.destroy(),this.viewHouseMenu=null,this._domElement.removeChild(this.menuSvg),this.menuSvg=null,this._domElement.removeChild(this.homeSvg),this.homeSvg=null,this._domElement=null,this.viewer=null,this._opt=null}},e.ViewHouse=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").AnnotationConfig=function(){return{background:null,domElement:null,viewer:null,style:{"stroke-width":3,"stroke-color":"#ff0000","stroke-opacity":1,"fill-color":"#ff0000","fill-opacity":0,"font-family":"Arial","font-size":16,"font-style":"italic","font-weight":"bold"}}},function(){let e=Object.freeze({Arrow:"Arrow",Rectangle:"Rectangle",Circle:"Circle",Cross:"Cross",Cloud:"Cloud",Text:"Text"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").AnnotationTypeOption=e}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){this._opt=e,this.init()});t.prototype={init:function(){var e,t=this._opt;if(t.viewer)e=new CLOUD$1.Extensions.AnnotationHelper3D(t.viewer.getViewer());else{if(!t.domElement)return alert("domElement must not be empty."),!1;(e=new CLOUD$1.Extensions.AnnotationHelper2D).setDomContainer(t.domElement)}this._helper=e},begin:function(){var e=this._helper,t=this._opt;e.editAnnotationBegin(t.absBasePoint,t.screenBasePoint,t.zoomFactor)},end:function(){this._helper.editAnnotationEnd()},save:function(){return this._helper.getAnnotationInfoList()},load:function(e){var t=this._helper;this._opt;t.loadAnnotations(e)},createSnapshot:function(e,t){return this._helper.captureAnnotationsScreenSnapshot(e,t)},setType:function(e){this._helper.setAnnotationType({arrow:0,rectangle:1,circle:2,cross:3,cloud:4,text:5}[e.toLocaleLowerCase()])},setStyle:function(e){this._helper.setAnnotationStyle(e)},destroy:function(){this._helper.destroy()}},e.Annotation=t,e.Annotation.Annotation=e.Annotation,e.Annotation.AnnotationConfig=e.AnnotationConfig}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation").AnnotationManagerConfig=function(){return{viewer:null,lineWidth:3,lineColor:new Glodon$1.Web.Graphics.Color(208,2,27,1),fillColor:new Glodon$1.Web.Graphics.Color(255,255,255,0),fontFamily:"Arial",fontSize:14,windowAdaption:!1}},function(){let e=Object.freeze({Arrow:"Arrow",Rectangle:"Rectangle",Circle:"Ellips",Ellips:"Ellips",Cross:"Cross",Cloud:"Cloud",CloudRect:"Cloud-rect",Text:"Text",Polyline:"Polyline",Handdrawing:"Handdrawing"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation").AnnotationTypeOption=e}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){});t.prototype={init:function(){var e,t=this._opt;e=new CLOUD$1.Extensions.AnnotationHelper3D(t.viewer.getViewer(),t),this._helper=e},startDrawing:function(){var e=this._helper;this._opt;e.editAnnotationBegin(),this.isShowAnnotation=!0},getAnnotationList:function(){return this._helper.getAnnotationInfoList()},setAnnotationList:function(e){e&&0!=e.length?(this._annotationList=e,this._helper.loadAnnotations(e),this.isShowAnnotation=!0):this.clear()},createSnapshot:function(e){this._opt.viewer;this._helper.captureAnnotationsScreenSnapshot("",e)},setState:function(e){var t=this,i=t._opt.viewer;i.setState(e.state),i.render(),setTimeout((function(){t.setAnnotationList(e.annotationList)}),1e3)},updateSvg:function(){var e=this._annotationList,t=this._opt.viewer.getZoomScale();if(!e||0==e.length)return!1;for(var i=0,n=e.length;i<n;i++)e[i].position=this.getSVGPosition(e[i],t),e[i].size.width=e[i].defaultSize.width*t,e[i].size.height=e[i].defaultSize.height*t;this.isShowAnnotation&&this.setAnnotationList(e)},getSVGPosition:function(e,t){var i=this._opt.viewer,n=i.screenWidth/2,o=i.screenHeight/2,s=i.worldToClient(e.worldPosition);return{x:s.x-n,y:o-s.y}},revoke:function(){}},e.AnnotationViewer3dManager=t}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){var t=Glodon$1.Bimface.Viewer.Viewer2DEvent,i=e.viewer,n=this;i.addEventListener(t.ViewMoving,(function(e){n.updateSvg()})),i.addEventListener(t.ViewZooming,(function(e){n.updateSvg()}))});t.prototype={init:function(){var e,t=this._opt;(e=new CLOUD$1.Extensions.AnnotationHelper2D(t)).setDomContainer(t.viewer.getDomElement()),this._helper=e},startDrawing:function(){var e=this._helper,t=this._opt;e.editAnnotationBegin();t.viewer.getZoomScale();e.editor.svg.addEventListener("mousewheel",(function(e){e.preventDefault(),e.stopPropagation()})),this.isShowAnnotation=!0},getAnnotationList:function(){var e=this._helper.getAnnotationInfoList();if(e&&e.length>0)for(var t=this._opt.viewer.getZoomScale(),i=0,n=e.length;i<n;i++)e[i].worldPosition=this.getWorldPosition(e[i]),e[i].defaultSize={width:e[i].size.width/t,height:e[i].size.height/t};return e},setAnnotationList:function(e){if(e&&0!=e.length){for(var t=this._opt.viewer.getZoomScale(),i=0,n=e.length;i<n;i++)e[i].position=this.getSVGPosition(e[i],t),e[i].size.width=e[i].defaultSize.width*t,e[i].size.height=e[i].defaultSize.height*t;this._annotationList=e,this._helper.loadAnnotations(e),this.isShowAnnotation=!0}else this.clear()},createSnapshot:function(e){var t=this;t._opt.viewer.createSnapshotAsync("",(function(i){t._helper.captureAnnotationsScreenSnapshot(i,e)}))},setState:function(e){this._opt.viewer.setState(e.state),this.setAnnotationList(e.annotationList)},updateSvg:function(){var e=this._annotationList,t=this._opt.viewer.getZoomScale();if(!e||0==e.length)return!1;for(var i=0,n=e.length;i<n;i++)e[i].position=this.getSVGPosition(e[i],t),e[i].size.width=e[i].defaultSize.width*t,e[i].size.height=e[i].defaultSize.height*t;this.isShowAnnotation&&this.setAnnotationList(e)},getSVGPosition:function(e,t){var i=this._opt.viewer,n=i.screenWidth/2,o=i.screenHeight/2,s=i.worldToClient(e.worldPosition);return{x:s.x-n,y:o-s.y}},revoke:function(){}},e.AnnotationViewer2dManager=t}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){this._viewer=e,this.drawingViewer=e.getViewer()});t.prototype={init:function(){var e,t=this._opt;e=this.drawingViewer.mouseEditorMgr,this.type="arrow",this.setLineWidth(t.lineWidth),this.setLineColor(t.lineColor),this.setFillColor(t.fillColor),this.setFontFamily(t.fontFamily),this.setFontSize(t.fontSize),this._helper=e},startDrawing:function(){var e,t=this._helper;this._opt;t.activeEditorByName("markup"),(e=t.getEditor()).setMarkupType(this.type),this.annotationToolbar&&(this.setLineColor({red:208,green:2,blue:27,alpha:1}),this.setLineWidth(2)),this.editor=e,this.isShowAnnotation=!0},endDrawing:function(){this.drawingViewer.markupManager.setFillColor("transparent"),this.clear(),this._helper.activeEditorByName("pick"),this.drawingViewer.update(),this.isShowAnnotation=!1},getAnnotationList:function(){return this.drawingViewer.markupManager.markups},setAnnotationList:function(e){this.drawingViewer.markupManager.markups=e,this.drawingViewer.update()},clear:function(){this.drawingViewer.markupManager.clear(),this.drawingViewer.update()},createSnapshot:function(e){var t=this._viewer.getRootElement();e(this.drawingViewer.snapshot(t.style.background))},resize:function(){this._viewer.resize()},setAnnotationType:function(e){this.type={arrow:"arrow",rectangle:"rectangle","cloud-rect":"cloud-rect",circle:"ellips",cross:"cross",cloud:"cloud",text:"text"}[e.toLocaleLowerCase()],this.editor&&this.editor.setMarkupType(this.type)},setLineWidth:function(e){this.drawingViewer.markupManager.setLineWidth(e)},setLineColor:function(e){this.drawingViewer.markupManager.setColor(`rgba(${e.red},${e.green},${e.blue},${e.alpha})`)},setFillColor:function(e){this.drawingViewer.markupManager.setFillColor(`rgba(${e.red},${e.green},${e.blue},${e.alpha})`)},setFontFamily:function(e){this.drawingViewer.markupManager.setFontFamily(e)},setFontSize:function(e){this.drawingViewer.markupManager.setFontSize(e)},getCurrentState:function(){var e=this._opt.viewer,t=this.getAnnotationList();return{annotationList:this.stringifyAnnotationList(t),state:e.getCurrentState()}},stringifyAnnotationList(e){return this.drawingViewer.markupManager.toString(e)},jsonifyAnnotationList(e){return this.drawingViewer.markupManager.fromString(e)},setState:function(e){var t=this._opt.viewer;if("string"==typeof e.annotationList){var i=this.jsonifyAnnotationList(e.annotationList);this.setAnnotationList(i)}else this.setAnnotationList(e.annotationList);t.setState(e.state)},updateSvg:function(){var e=this._annotationList,t=this._opt.viewer.getZoomScale();if(!e||0==e.length)return!1;for(var i=0,n=e.length;i<n;i++)e[i].position=this.getSVGPosition(e[i],t),e[i].size.width=e[i].defaultSize.width*t,e[i].size.height=e[i].defaultSize.height*t;this.isShowAnnotation&&this.setAnnotationList(e)},getWorldPosition:function(e){var t=this._opt.viewer,i=t.screenWidth/2,n=t.screenHeight/2,o={x:i+e.position.x,y:n-e.position.y};return t.clientToWorld(o)},getSVGPosition:function(e,t){var i=this._opt.viewer,n=i.screenWidth/2,o=i.screenHeight/2,s=i.worldToClient(e.worldPosition);return{x:s.x-n,y:o-s.y}},revoke:function(){}},e.AnnotationDrawingManager=t}();var extendStatics$3=function(e,t){return extendStatics$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},extendStatics$3(e,t)};function __extends$3(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics$3(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var MouseButtons,__assign=function(){return __assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)},MarkupTool=function(){function e(){}return e.prototype.onDrawing=function(e,t,i,n){this.markup&&(t.strokeStyle=this.markup.strokeStyle,t.lineWidth=this.markup.lineWidth,t.fillStyle=this.markup.fillStyle,this.markup.draw(e,this.markupManager.viewer,t,i,n))},e.prototype.addMarkup=function(e,t){t.drawEnd=!0,this.markupManager.add(t),"function"==typeof this.markupManager.viewer.functions.itemCompleted&&this.markupManager.viewer.functions.itemCompleted(t)},e.prototype.redraw=function(e){},e.prototype.onExit=function(e){},e.prototype.onMouseMove=function(e,t,i,n){},e}(),Markups=function(){function e(){}return e.prototype.getCenter=function(e){var t=e.worldToClientPoint(this.drawPoints[0]),i=e.worldToClientPoint(this.drawPoints[1]);return[(t[0]+i[0])/2,(t[1]+i[1])/2]},e.prototype.getColor=function(){return this.strokeStyle},e.prototype.getHighlightFillColor=function(){return"rgba(61, 204, 147, 0.5)"},e.prototype.getHoverColor=function(e){return(e.markupManager.getHighlightConfig&&e.markupManager.getHighlightConfig()||{}).hoverColor||""},e.prototype.getHighlightColor=function(e){return(e.markupManager.getHighlightConfig&&e.markupManager.getHighlightConfig()||{}).highlightColor||""},e}(),EllipsMarkup=function(e){function t(t,i,n,o,s){var r=e.call(this)||this;return r.rotation=o||0,r.markupType="Ellipse",r.drawPoints=t,r.strokeStyle=i,r.lineWidth=n,r.fillStyle=s,r.bNeedHitByBbox=!0,r}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),a=e.worldToClientPoint([this.drawPoints[1][0],this.drawPoints[1][1],this.drawPoints[1][2]]),l=.5*Math.abs(a[0]-r[0]),h=.5*Math.abs(a[1]-r[1]),d=this.getCenter(e);i.save(),i.translate(d[0],d[1]),i.rotate(this.rotation),i.beginPath(),i.ellipse(0,0,l,h,0,0,2*Math.PI),i.restore(),i.closePath(),this.highlightColor?(i.fillStyle=this.getHighlightFillColor(),"rgba(255,255,255,0)"===this.fillStyle&&(i.fillStyle=this.fillStyle),i.strokeStyle=this.highlightColor):(i.fillStyle=this.fillStyle,i.strokeStyle=this.strokeStyle);var c=this.getHoverColor(t);c&&s?(i.shadowColor=c,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),this.fillStyle&&i.fill(),i.stroke(),n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth,n.ctx.fillStyle=this.fillStyle,n.drawEllips(r,a,d,this.rotation,o,l,h)}},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]),n=e.worldToClientPoint(this.drawPoints[1]),o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=[];return s.push(i[0],i[1]),s.push(i[0],o[1]),s.push(i[0],n[1]),s.push(o[0],n[1]),s.push(n[0],n[1]),s.push(n[0],o[1]),s.push(n[0],i[1]),s.push(o[0],i[1]),s},t}(Markups);!function(e){e[e.CONTINUE=0]="CONTINUE",e[e.FINISHED=1]="FINISHED",e[e.LelftButton=1]="LelftButton",e[e.RightButton=2]="RightButton",e[e.MiddleButton=4]="MiddleButton",e[e.MouseMode=1]="MouseMode",e[e.TouchMode=2]="TouchMode"}(MouseButtons||(MouseButtons={}));var Mouse$b=MouseButtons,EllipsMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth(),r=this.markupManager.getFillStyleState()?this.markupManager.getFillColor():void 0;this.markup=new EllipsMarkup([],o,s,0,r)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([this.startX,this.startY]),s=e.clientToWorldPoint([t,i]);this.markup.setPoints([o,s]),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$b.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$b.FINISHED)},t}(MarkupTool),RectMarkup=function(e){function t(t,i,n,o,s){var r=e.call(this)||this;return r.rotation=o||0,r.markupType="Rectangle",r.drawPoints=t,r.strokeStyle=i,r.lineWidth=n,r.fillStyle=s,r.bNeedHitByBbox=!0,r}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),a=e.worldToClientPoint([this.drawPoints[1][0],this.drawPoints[1][1],this.drawPoints[1][2]]),l=this.getCenter(e);i.save(),i.translate(l[0],l[1]),i.rotate(this.rotation),i.beginPath(),i.rect(-.5*(a[0]-r[0]),-.5*(a[1]-r[1]),a[0]-r[0],a[1]-r[1]),i.restore(),i.closePath(),this.highlightColor?(i.fillStyle=this.getHighlightFillColor(),"rgba(255,255,255,0)"===this.fillStyle&&(i.fillStyle=this.fillStyle),i.strokeStyle=this.highlightColor):(i.fillStyle=this.fillStyle,i.strokeStyle=this.strokeStyle);var h=this.getHoverColor(t);h&&s?(i.shadowColor=h,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),this.fillStyle&&i.fill(),i.stroke(),n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth,n.ctx.fillStyle=this.fillStyle,n.drawRect(this,r,a,l,this.rotation,o)}},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]),n=e.worldToClientPoint(this.drawPoints[1]),o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=[];return s.push(i[0],i[1]),s.push(i[0],o[1]),s.push(i[0],n[1]),s.push(o[0],n[1]),s.push(n[0],n[1]),s.push(n[0],o[1]),s.push(n[0],i[1]),s.push(o[0],i[1]),s},t.prototype.getRotateGrips=function(e){var t=e.worldToClientPoint(this.drawPoints[0]),i=e.worldToClientPoint(this.drawPoints[1]);return[[(t[0]+i[0])/2,(t[1]+i[1])/2][0],t[1]-20]},t}(Markups),Mouse$a=MouseButtons,RectMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth(),r=this.markupManager.getFillStyleState()?this.markupManager.getFillColor():void 0;this.markup=new RectMarkup([],o,s,0,r)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([this.startX,this.startY]),s=e.clientToWorldPoint([t,i]);this.markup.setPoints([o,s]),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$a.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$a.FINISHED)},t}(MarkupTool),ArrowMarkup=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.rotation=o||0,s.markupType="Arrow",s.drawPoints=t,s.strokeStyle=i,s.lineWidth=n,s.bNeedHitByBbox=!1,s}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),a=e.worldToClientPoint([this.drawPoints[1][0],this.drawPoints[1][1],this.drawPoints[1][2]]),l=10+this.lineWidth,h=r[0],d=r[1],c=a[0],u=a[1],p=180*Math.atan2(d-u,h-c)/Math.PI,g=(p+30)*Math.PI/180,m=(p-30)*Math.PI/180,f=l*Math.cos(g),w=l*Math.sin(g),v=l*Math.cos(m),y=l*Math.sin(m),b=h-f,E=d-w,x=[(r[0]+a[0])/2,(r[1]+a[1])/2];this.highlightColor?(i.fillStyle=this.highlightColor,i.strokeStyle=this.highlightColor):(i.fillStyle=this.strokeStyle,i.strokeStyle=this.strokeStyle);var C=this.getHoverColor(t);C&&s?(i.shadowColor=C,i.shadowBlur=1):(i.shadowColor="",i.shadowBlur=0),i.beginPath(),b=c+f,E=u+w,i.moveTo(b,E),i.lineTo(c,u),b=c+v,E=u+y,i.lineTo(b,E),i.closePath(),i.fill(),i.beginPath(),i.moveTo(h,d),f=(l-3)*Math.cos(g),w=(l-3)*Math.sin(g);var M=[c+(f+(v=(l-3)*Math.cos(m)))/2,u+(w+(y=(l-3)*Math.sin(m)))/2];i.lineTo(M[0],M[1]),i.stroke(),n.drawArrow(this,h,d,c,u,f,w,v,y,x,this.rotation,o,r,a)}},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]),n=e.worldToClientPoint(this.drawPoints[1]);return i.concat(n)},t}(Markups),Mouse$9=MouseButtons,ArrowMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth();this.markup=new ArrowMarkup([],o,s)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([this.startX,this.startY]),s=e.clientToWorldPoint([t,i]);this.markup.setPoints([o,s]),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$9.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$9.FINISHED)},t}(MarkupTool),CrossMarkup=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.rotation=o||0,s.markupType="Cross",s.drawPoints=t,s.strokeStyle=i,s.lineWidth=n,s.bNeedHitByBbox=!1,s}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),a=e.worldToClientPoint([this.drawPoints[1][0],this.drawPoints[1][1],this.drawPoints[1][2]]),l=this.getCenter(e);i.save(),i.translate(l[0],l[1]),i.rotate(this.rotation),i.beginPath(),i.moveTo(-.5*(a[0]-r[0]),-.5*(a[1]-r[1])),i.lineTo(.5*(a[0]-r[0]),.5*(a[1]-r[1])),i.moveTo(-.5*(a[0]-r[0]),.5*(a[1]-r[1])),i.lineTo(.5*(a[0]-r[0]),-.5*(a[1]-r[1])),this.highlightColor?i.strokeStyle=this.highlightColor:i.strokeStyle=this.strokeStyle;var h=this.getHoverColor(t);h&&s?(i.shadowColor=h,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),i.stroke(),i.restore(),n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth,n.drawCross(r,a,l,this.rotation,o)}},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]),n=e.worldToClientPoint(this.drawPoints[1]),o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=[];return s.push(i[0],i[1]),s.push(i[0],o[1]),s.push(i[0],n[1]),s.push(o[0],n[1]),s.push(n[0],n[1]),s.push(n[0],o[1]),s.push(n[0],i[1]),s.push(o[0],i[1]),s},t}(Markups),Mouse$8=MouseButtons,CrossMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth();this.markup=new CrossMarkup([],o,s)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([this.startX,this.startY]),s=e.clientToWorldPoint([t,i]);this.markup.setPoints([o,s]),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$8.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$8.FINISHED)},t}(MarkupTool),MathUtil=function(){function e(){}return e.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},e.center=function(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}},e.centerByArr=function(e,t){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},e.distanceByArr=function(e,t){var i=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(i*i+n*n)},e.normalize=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]);return[e[0]/t,e[1]/t]},e.isPointInBBox=function(e,t,i,n){var o=.5*n[0];if(e<i[0]-o||e>i[0]+o)return!1;var s=.5*n[1];return!(t<i[1]-s||t>i[1]+s)},e.rotateAround=function(e,t,i){var n=[0,0],o=Math.cos(i),s=Math.sin(i),r=e[0]-t[0],a=e[1]-t[1];return n[0]=r*o-a*s+t[0],n[1]=r*s+a*o+t[1],n},e}(),CloudMarkup=function(e){function t(t,i,n,o,s,r,a){var l=e.call(this)||this;return l.rotation=s||0,l.fillStyle=r||0,l.close=a||!1,l.markupType="Cloud",l.drawPoints=t,l.strokeStyle=i,l.lineWidth=n,l.controlPt=[],l.editPt=null,l.bNeedHitByBbox=!0,l}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=t.markupManager.getMarkupCenter(e,o);r||(r=[0,0]),i.save(),i.translate(r[0],r[1]),i.rotate(this.rotation),i.beginPath(),n.ctx.save(),n.ctx.translate(r[0],r[1]),n.ctx.rotate(this.rotation),n.ctx.beginPath(),n.ctx.strokeStyle="rgba("+(2*o+2)+",60,60,1)",n.ctx.fillStyle="rgba("+(2*o+2)+",60,255,1)",n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth;for(var a=1,l=this.drawPoints.length;a<l;a++){var h=e.worldToClientPoint([this.drawPoints[a-1][0],this.drawPoints[a-1][1],this.drawPoints[a-1][2]]),d=e.worldToClientPoint([this.drawPoints[a][0],this.drawPoints[a][1],this.drawPoints[a][2]]),c=void 0;if(1==a&&(i.moveTo(h[0]-r[0],h[1]-r[1]),n.ctx.moveTo(h[0]-r[0],h[1]-r[1])),this.editPt&&this.editPt[a-1])c=e.worldToClientPoint([this.editPt[a-1][0],this.editPt[a-1][1],this.editPt[a-1][2]]);else if(this.controlPt[a-1]&&a<l-1)c=e.worldToClientPoint([this.controlPt[a-1][0],this.controlPt[a-1][1],this.controlPt[a-1][2]]);else{c=this.getControlPt(h,d);var u=e.clientToWorldPoint(c);u[0]&&u[1]&&(this.controlPt[a-1]=u)}i.quadraticCurveTo(c[0]-r[0],c[1]-r[1],d[0]-r[0],d[1]-r[1]),n.ctx.quadraticCurveTo(c[0]-r[0],c[1]-r[1],d[0]-r[0],d[1]-r[1])}n.ctx.stroke(),this.highlightColor?(i.fillStyle=this.getHighlightFillColor(),"rgba(255,255,255,0)"===this.fillStyle&&(i.fillStyle=this.fillStyle),i.strokeStyle=this.highlightColor):(i.fillStyle=this.fillStyle,i.strokeStyle=this.strokeStyle);var p=this.getHoverColor(t);p&&s?(i.shadowColor=p,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),this.close&&this.fillStyle&&i.fill(),i.stroke(),i.restore(),n.ctx.restore()}},t.prototype.shouldClose=function(e,t,i){if(this.drawPoints.length<3)return!1;var n=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]);return MathUtil.distanceByArr(n,[t,i])<5?(this.close=!0,!0):(this.close=!1,!1)},t.prototype.getControlPt=function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],o=.6*MathUtil.distanceByArr(e,t),s=[t[1]-e[1],e[0]-t[0]];return s=MathUtil.normalize(s),[n[0]+s[0]*o,n[1]+s[1]*o]},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.addPoint=function(e){this.drawPoints.push(e)},t.prototype.getStartPoint=function(){return this.drawPoints[0]},t.prototype.popPoint=function(){this.drawPoints.pop()},t.prototype.isEmpty=function(){return 0==this.drawPoints.length},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t,i){if(null==i)return this.drawPoints;var n=t.getMarkupBbox(e,i),o=[n[0],n[1]],s=[n[2],n[3]],r=[(o[0]+s[0])/2,(o[1]+s[1])/2],a=[];return a.push(o[0],o[1]),a.push(o[0],r[1]),a.push(o[0],s[1]),a.push(r[0],s[1]),a.push(s[0],s[1]),a.push(s[0],r[1]),a.push(s[0],o[1]),a.push(r[0],o[1]),a},t}(Markups),Mouse$7=MouseButtons,CloudMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i.bFirstCloudMarkup=!0,i.uncertainty=!1,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){if(this.bFirstCloudMarkup){if(this.markupManager.hitTest(e,t,i)>-1)return;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth(),r=this.markupManager.getFillStyleState()?this.markupManager.getFillColor():void 0;this.markup=new CloudMarkup([],o,s,null,0,r),this.bFirstCloudMarkup=!1}if(this.markup.shouldClose(e,t,i))this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0;else{var a=e.clientToWorldPoint([t,i]);this.markup.popPoint(),this.markup.addPoint(a)}this.uncertainty=!1},t.prototype.onEditing=function(e,t,i,n){if(!this.bFirstCloudMarkup){var o=void 0;o=this.markup.shouldClose(e,t,i)?this.markup.getStartPoint():e.clientToWorldPoint([t,i]),this.uncertainty&&this.markup.drawPoints.length>1?this.markup.popPoint():this.uncertainty=!0,this.markup.addPoint(o),this.redraw(e)}},t.prototype.onMouseMove=function(e,t,i,n){this.onEditing(e,t,i,n)},t.prototype.end=function(e,t,i,n){if(this.bFirstCloudMarkup)return Mouse$7.FINISHED},t.prototype.onMouseRightClick=function(e,t){this.bFirstCloudMarkup||(this.markup.popPoint(),this.markup.drawPoints.length>1&&this.addMarkup(e,this.markup),this.markup.close=!1,this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0)},t.prototype.onDoubleClick=function(e,t){if(!this.bFirstCloudMarkup){this.markup.popPoint();var i=this.markup.drawPoints.length;i>1&&this.addMarkup(e,this.markup);var n=e.worldToClientPoint([this.markup.drawPoints[i-1][0],this.markup.drawPoints[i-1][1],this.markup.drawPoints[i-1][2]]);MathUtil.distanceByArr(n,[t.x,t.y])<5&&this.markup.popPoint(),this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0}},t.prototype.getIsEndDrawing=function(){return this.bFirstCloudMarkup},t}(MarkupTool),CloudRectMarkup=function(e){function t(t,i,n,o,s){var r=e.call(this)||this;return r.rotation=o||0,r.markupType="CloudRect",r.drawPoints=t,r.strokeStyle=i,r.lineWidth=n,r.fillStyle=s,r.baseUnit="30",r.bNeedHitByBbox=!0,r}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),a=e.worldToClientPoint([this.drawPoints[1][0],this.drawPoints[1][1],this.drawPoints[1][2]]),l=this.getCenter(e),h=a[1]-r[1],d=a[0]-r[0],c=Math.abs(d),u=Math.abs(h),p=c/this.baseUnit,g=u/this.baseUnit,m=parseInt(p),f=parseInt(g),w=0==m?c:c/m,v=0==f?u:u/f;i.save(),i.translate(l[0],l[1]),i.rotate(this.rotation),i.beginPath(),n.ctx.save(),n.ctx.translate(l[0],l[1]),n.ctx.rotate(this.rotation),n.ctx.beginPath();var y=[-c/2,-u/2],b=[c/2,u/2];n.ctx.strokeStyle="rgba("+(2*o+2)+",40,40,1)",n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth,i.lineJoin="round",this.drawSide("orientation",w,c,y[0],y[1],i,null,o,n,!0),this.drawSide("portrait",v,u,b[0],y[1],i,null,o,n),this.drawSide("orientation",w,c,b[0],b[1],i,!0,o,n),this.drawSide("portrait",v,u,y[0],b[1],i,!0,o,n),this.highlightColor?(i.fillStyle=this.getHighlightFillColor(),"rgba(255,255,255,0)"===this.fillStyle&&(i.fillStyle=this.fillStyle),i.strokeStyle=this.highlightColor):(i.fillStyle=this.fillStyle,i.strokeStyle=this.strokeStyle);var E=this.getHoverColor(t);E&&s?(i.shadowColor=E,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),this.fillStyle&&i.fill(),i.stroke(),i.restore(),n.ctx.stroke(),n.ctx.restore()}},t.prototype.drawSide=function(e,t,i,n,o,s,r,a,l,h){var d,c=0,u=0,p=i/t,g=n,m=o;"orientation"==e?c=t:u=t;for(var f=0;f<p;f++){h&&0==f&&s.moveTo(n,o),d=r?[n-c,o-u]:[n+c,o+u],c&&Math.abs(d[0]-g)>i?d[0]=r?g-i:g+i:u&&Math.abs(d[1]-m)>i&&(d[1]=r?m-i:m+i);var w=this.getControlPt([n,o],d);s.quadraticCurveTo(w[0],w[1],d[0],d[1]),l.drawCloudRect(n,o,w,d,a),n=d[0],o=d[1]}},t.prototype.getControlPt=function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],o=.5*MathUtil.distanceByArr(e,t),s=[t[1]-e[1],e[0]-t[0]];return s=MathUtil.normalize(s),[n[0]+s[0]*o,n[1]+s[1]*o]},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]),n=e.worldToClientPoint(this.drawPoints[1]),o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=[];return s.push(i[0],i[1]),s.push(i[0],o[1]),s.push(i[0],n[1]),s.push(o[0],n[1]),s.push(n[0],n[1]),s.push(n[0],o[1]),s.push(n[0],i[1]),s.push(o[0],i[1]),s},t}(Markups),Mouse$6=MouseButtons,CloudRectMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth(),r=this.markupManager.getFillStyleState()?this.markupManager.getFillColor():void 0;this.markup=new CloudRectMarkup([],o,s,0,r)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([this.startX,this.startY]),s=e.clientToWorldPoint([t,i]);this.markup.setPoints([o,s]),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$6.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$6.FINISHED)},t}(MarkupTool),TextMarkup=function(e){function t(t,i,n,o,s,r,a,l,h){var d=e.call(this)||this;d.rotation=r||0,d.textAreaId=a||null,d.center=l||null,d.markupType="Text",d.drawPoints=h?t:[t],d.pureText=i,d.userText=i,d.strokeStyle=n,d.fontSize=o,d.fontFamily=s;var c=document.createElement("canvas");return d.virtualCtx=c.getContext("2d"),d.bNeedHitByBbox=!1,d}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){var r=e.worldToClientPoint(this.drawPoints[0]),a=this.getTextBbox(e),l=[(a[2]+a[0])/2,(a[3]+a[1])/2];this.center&&(l=e.worldToClientPoint(this.center)),i.save(),i.translate(l[0],l[1]),i.rotate(this.rotation),i.beginPath(),n.init(l,this.rotation),i.fillStyle=i.strokeStyle,i.font=this.fontSize+"px "+this.fontFamily,i.zIndex=120,n.ctx.font="bold "+this.fontSize+"px "+this.fontFamily,n.ctx.strokeStyle="rgba("+(2*o+2)+",80,80,1)",n.ctx.fillStyle="rgba("+(2*o+2)+",80,80,1)";var h=this.userText.split(/\n/);this.highlightColor?i.fillStyle=this.getHighlightFillColor():i.fillStyle=this.strokeStyle;var d=this.getHoverColor(t);d&&s?(i.shadowColor=d,i.shadowBlur=1):(i.shadowColor="",i.shadowBlur=0);for(var c=0;c<h.length;c++){i.fillText(h[c],r[0]-l[0],r[1]-l[1]+(c+1)*this.fontSize),n.ctx.fillText(h[c],r[0]-l[0],r[1]-l[1]+(c+1)*this.fontSize);var u=h[c].replace(/[a-z]/g,"aa").replace(/[^\u0000-\u00ff]/g,"aaaa").replace(/[A-Z]/g,"aaa").replace(/[0-9]/g,"aa").length;n.ctx.fillRect(r[0]-l[0],r[1]-l[1]+c*this.fontSize,u*this.fontSize*4/14,20)}i.restore(),n.ctx.restore()},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getId=function(){return this.textAreaId},t.prototype.getUserText=function(){return this.userText},t.prototype.getPureText=function(){return this.pureText},t.prototype.setUserText=function(e){this.userText=e},t.prototype.setPureText=function(e){this.pureText=e},t.prototype.show=function(e){var t=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]),i=document.getElementById(this.textAreaId),n=e.wrapDom.getBoundingClientRect();i.style.left=t[0]+n.left+"px",i.style.top=t[1]+n.top+"px",i.style.fontFamily=this.fontFamily,i.style.fontSize=this.fontSize,i.style.border="4px",i.style.resize="none",i.style.zIndex=100,i.style.display="block",i.value=this.userText},t.prototype.resizeText=function(e){this.virtualCtx.font=this.fontSize+"px "+this.fontFamily;var t=(this.pureText||this.userText).split(/\n/),i=e[0];e[1];this.fontSize;for(var n=0;n<t.length;n++){for(var o="",s=t[n].slice(),r="",a=0,l=0;l<s.length;l++){var h=this.virtualCtx.measureText(s[l]).width;a+=h,o+=s[l],a>i&&o.length>1?(r+="\n"+s[l],a=h,o=s[l]):a==i?(t[n]=s.slice(0,l+1)+"\n"+s.slice(l+1),r+=s[l]+"\n",a=0,o=""):r+=s[l]}t[n]=r}this.userText=t.join("\n")},t.prototype.resizeTextarea=function(){var e=document.getElementById(this.textAreaId);e.value=this.userText;var t=this.userText.split(/\n/),i=0;e.rows=t.length;for(var n=0;n<t.length;n++){var o=t[n].replace(/[^\u0000-\u00ff]/g,"aa").replace(/[A-Z]/g,"aa").length;o>i&&(i=o)}e.cols=i},t.prototype.getTextBbox=function(e){var t,i=this.getTextSize(),n=e.worldToClientPoint(this.drawPoints[0]);return t=this.drawPoints[1]?e.worldToClientPoint(this.drawPoints[1]):[n[0]+i[0],n[1]+i[1]],n.concat(t)},t.prototype.getTextSize=function(){var e=0;this.virtualCtx.font=this.fontSize+"px "+this.fontFamily;for(var t,i=this.userText.split(/\n/),n=0;n<i.length;n++)(t=this.virtualCtx.measureText(i[n])).width>e&&(e=t.width);return[e,i.length*this.fontSize]},t.prototype.getEndPt=function(e){var t=this.getTextBbox(e);return[t[2],t[3]]},t.prototype.getGrips=function(e,t){var i=e.worldToClientPoint(this.drawPoints[0]);if(this.drawPoints[1]){s=e.worldToClientPoint(this.drawPoints[1]);var n=[(i[0]+s[0])/2,(i[1]+s[1])/2]}else var o=this.getTextBbox(e),s=(n=[(o[2]+o[0])/2,(o[3]+o[1])/2],[o[2],o[3]]);var r=[];return r.push(i[0],i[1]),r.push(i[0],n[1]),r.push(i[0],s[1]),r.push(n[0],s[1]),r.push(s[0],s[1]),r.push(s[0],n[1]),r.push(s[0],i[1]),r.push(n[0],i[1]),r},t}(Markups),Mouse$5=MouseButtons,TextMarkupTool=function(e){function t(t,i,n){var o=e.call(this)||this;return o.editorMode=-1,o.rotation=i,o.worldPoint=[],o.drawPoints=n,o.markupManager=t,o}return __extends$3(t,e),t.prototype.begin=function(e,i,n,o){this.startX=i,this.startY=n,this.textAreaId="";var s=!0;null==this.userText&&(s=this.initDom(e)),s&&""==t.lastTextareaId&&(this.createDiv(t.divId),this.insertTextArea2Dom(e),this.addKeyDownListener(e),this.addInputListener(e))},t.prototype.onEditing=function(e,t,i,n){},t.prototype.end=function(e,t,i,n){return Mouse$5.FINISHED},t.prototype.onExit=function(e){""!=t.lastTextareaId&&(this.removeTextAreaInDom(t.lastTextareaId),t.lastTextareaId="")},t.prototype.initDom=function(e){if(""!=t.lastTextareaId){var i=document.getElementById(t.lastTextareaId),n=i.value.trim();if(""==n)this.removeTextAreaInDom(t.lastTextareaId);else{var o=e.wrapDom.getBoundingClientRect(),s=parseInt(i.style.left.split("px")[0]),r=parseInt(i.style.top.split("px")[0]),a=[s-o.left,r-o.top],l=this.drawPoints&&this.drawPoints[0]||this.worldPoint!==[]&&this.worldPoint||e.clientToWorldPoint(a),h=i.style.color,d=this.markupManager.getFontSize(),c=i.style.fontFamily,u=new TextMarkup(l,n,h,d,c,this.rotation||0,t.lastTextareaId);this.size&&(u.setPureText(n),this.setPureText(n),u.resizeText(this.size)),this.rotation=0,this.hideTextArea(t.lastTextareaId),this.addMarkup(e,u),u=null,this.redraw(e)}return t.lastTextareaId="",!1}return!0},t.prototype.createDiv=function(e){if(null==document.getElementById(e)){console.log("Create div in dom.");var i=document.createElement("div");i.addEventListener("mousedown",(function(e){e.stopImmediatePropagation()})),i.addEventListener("mouseup",(function(e){e.stopImmediatePropagation()})),i.addEventListener("mousemove",(function(e){e.stopImmediatePropagation()})),i.setAttribute("id",t.divId),i.style.position="absolute",i.style.left="0",i.style.top="0",this.markupManager.viewer.wrapDom.appendChild(i);var n=document.createElement("span");n.id="box",n.style.visibility="hidden",i.appendChild(n);var o=document.createElement("span");n.id="boxEdit",n.style.visibility="hidden",n.style.wordBreak="break-all",n.style.display="inline-block",i.appendChild(o)}},t.prototype.setEditBox=function(e){this.size=e},t.prototype.hideTextArea=function(e){var t=document.getElementById(e);t.blur(),t.style.display="none"},t.prototype.showTextArea=function(e){document.getElementById(e).style.display="block"},t.prototype.setUserText=function(e){this.userText=e},t.prototype.setPureText=function(e){this.pureText=e},t.prototype.addKeyDownListener=function(e){var t=this,i=document.getElementById(this.textAreaId);i&&i.addEventListener("keydown",(function(i){return t.keyDownFunction(e,i)}),!0)},t.prototype.addInputListener=function(e){var t=this,i=document.getElementById(this.textAreaId);i&&(i.addEventListener("input",(function(n){t.resize(i,e)})),i.addEventListener("blur",(function(e){})))},t.prototype.resize=function(e,i){var n=e.value.split(/\n/),o=document.querySelectorAll("#"+t.divId+" span")[0];o.innerText=e.value,o.style.fontSize=this.markupManager.getFontSize()+"px",e.style.width=o.offsetWidth+20+"px",e.rows=n.length},t.prototype.keyDownFunction=function(e,t){var i=document.getElementById(this.textAreaId);13==t.keyCode&&(i.rows=i.rows+1,console.log("Key enter pressed."))},t.prototype.addMouseDownListener=function(){var e=document.getElementById(this.textAreaId);e&&e.addEventListener("click",(function(e){console.log("Mouse click textarea now.")}))},t.prototype.createTextArea=function(e){var t=[this.startX,this.startY];this.worldPoint=e.clientToWorldPoint(t);var i=document.createElement("textArea");i.setAttribute("id",this.textAreaId),i.setAttribute("maxlength",999),i.value=null==this.userText?"":this.userText,i.style.color=this.markupManager.getColor(),i.style.position="fixed",i.style.lineHeight="100%",this.editorMode,i.style.width="10px",i.style.paddingLeft="6px",i.style.overflow="hidden",i.style.webkitUserSelect="auto",i.style.webkitAppearance="none",i.style.borderRadius=0,null!=this.userText?this.resize(i,e):i.rows="1";var n=e.wrapDom.getBoundingClientRect();return i.style.left=t[0]+n.left+"px",i.style.top=t[1]+n.top+"px",i.style.fontFamily=this.markupManager.getFontFamily(),i.style.fontSize=this.markupManager.getFontSize()+"px",i.style.border="1px solid red",i.style.background="transparent",i.style.outline="none",i.style.resize="none",i.style.zIndex=100,i.style.display="block",i},t.prototype.insertTextArea2Dom=function(e){var i=document.getElementById(t.divId),n=i.childElementCount+1;this.textAreaId="textArea_"+n;var o=this.createTextArea(e);this.textArea=o,i.appendChild(o),o.focus(),t.lastTextareaId=this.textAreaId},t.prototype.reposition=function(e){var t=e.worldToClientPoint(this.worldPoint),i=e.wrapDom.getBoundingClientRect();this.textArea.style.left=t[0]+i.left+"px",this.textArea.style.top=t[1]+i.top+"px"},t.prototype.removeTextAreaInDom=function(e){var i=document.getElementById(t.divId),n=document.getElementById(e);try{i.removeChild(n)}catch(e){}},t.lastTextareaId="",t.divId="bf-drawing-textEditor",t}(MarkupTool),PolylineMarkup=function(e){function t(t,i,n,o,s,r){var a=e.call(this)||this;return a.rotation=o||0,a.close=r||!1,a.fillStyle=s,a.markupType="Polyline",a.drawPoints=t,a.strokeStyle=i,a.lineWidth=n,a.editPt=null,a.bNeedHitByBbox=!1,a}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o,s){if(!(this.drawPoints.length<2)){var r=t.markupManager.getMarkupCenter(e,o);r||(r=[0,0]),i.save(),i.translate(r[0],r[1]),i.rotate(this.rotation),i.beginPath(),i.lineJoin="round",n.init(r,this.rotation),n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth;for(var a=1,l=this.drawPoints.length;a<l;a++){var h=e.worldToClientPoint([this.drawPoints[a-1][0],this.drawPoints[a-1][1],this.drawPoints[a-1][2]]),d=e.worldToClientPoint([this.drawPoints[a][0],this.drawPoints[a][1],this.drawPoints[a][2]]);1==a&&i.moveTo(h[0]-r[0],h[1]-r[1]),i.lineTo(d[0]-r[0],d[1]-r[1]),n.drawPolyline(h,d,r,this.rotation,o)}this.highlightColor?(i.fillStyle=this.getHighlightFillColor(),"rgba(255,255,255,0)"===this.fillStyle&&(i.fillStyle=this.fillStyle),i.strokeStyle=this.highlightColor):(i.fillStyle=this.fillStyle,i.strokeStyle=this.strokeStyle);var c=this.getHoverColor(t);c&&s?(i.shadowColor=c,i.shadowBlur=2):(i.shadowColor="",i.shadowBlur=0),this.close&&this.fillStyle&&(i.fill(),this.bNeedHitByBbox=!0),i.stroke(),i.restore(),n.ctx.restore()}},t.prototype.shouldClose=function(e,t,i){if(this.drawPoints.length<3)return!1;var n=e.worldToClientPoint([this.drawPoints[0][0],this.drawPoints[0][1],this.drawPoints[0][2]]);return MathUtil.distanceByArr(n,[t,i])<5?(this.close=!0,!0):(this.close=!1,!1)},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.addPoint=function(e){this.drawPoints.push(e)},t.prototype.getStartPoint=function(){return this.drawPoints[0]},t.prototype.popPoint=function(){this.drawPoints.pop()},t.prototype.isEmpty=function(){return 0==this.drawPoints.length},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t,i){if(null==i)return this.drawPoints;var n=t.getMarkupBbox(e,i),o=[n[0],n[1]],s=[n[2],n[3]],r=[(o[0]+s[0])/2,(o[1]+s[1])/2],a=[];return a.push(o[0],o[1]),a.push(o[0],r[1]),a.push(o[0],s[1]),a.push(r[0],s[1]),a.push(s[0],s[1]),a.push(s[0],r[1]),a.push(s[0],o[1]),a.push(r[0],o[1]),a},t}(Markups),Mouse$4=MouseButtons,PolylineMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i.bFirstCloudMarkup=!0,i.uncertainty=!1,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){if(this.bFirstCloudMarkup){if(this.markupManager.hitTest(e,t,i)>-1)return;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth(),r=this.markupManager.getFillStyleState()?this.markupManager.getFillColor():void 0;this.markup=new PolylineMarkup([],o,s,0,r),this.bFirstCloudMarkup=!1}if(this.markup.shouldClose(e,t,i))this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0;else{var a=e.clientToWorldPoint([t,i]);this.markup.popPoint(),this.markup.addPoint(a)}this.uncertainty=!1},t.prototype.onEditing=function(e,t,i,n){if(!this.bFirstCloudMarkup){var o=void 0;o=this.markup.shouldClose(e,t,i)?this.markup.getStartPoint():e.clientToWorldPoint([t,i]),this.uncertainty&&this.markup.drawPoints.length>1?this.markup.popPoint():this.uncertainty=!0,this.markup.addPoint(o),this.redraw(e)}},t.prototype.onMouseMove=function(e,t,i,n){this.onEditing(e,t,i,n)},t.prototype.end=function(e,t,i,n){if(this.bFirstCloudMarkup)return Mouse$4.FINISHED},t.prototype.onMouseRightClick=function(e,t){this.bFirstCloudMarkup||(this.markup.popPoint(),this.markup.drawPoints.length>1&&this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0)},t.prototype.onDoubleClick=function(e,t){this.bFirstCloudMarkup||(this.markup.popPoint(),this.markup.drawPoints.length>1&&this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),this.bFirstCloudMarkup=!0)},t.prototype.getIsEndDrawing=function(){return this.bFirstCloudMarkup},t}(MarkupTool),HanddrawingMarkup=function(e){function t(t,i,n,o){var s=e.call(this)||this;return s.markupType="Handdrawing",s.drawPoints=t,s.strokeStyle=i,s.lineWidth=n,s.rotation=o||0,s.bNeedHitByBbox=!1,s}return __extends$3(t,e),t.prototype.draw=function(e,t,i,n,o){if(!(this.drawPoints.length<2)){i.lineJoin="round",n.ctx.lineWidth=MarkupViewer.isMobile?18:this.lineWidth+n.lineWidth;var s=t.markupManager.getMarkupCenter(e,o);s||(s=[0,0]),i.save(),i.translate(s[0],s[1]),i.rotate(this.rotation),i.beginPath(),n.ctx.save(),n.ctx.translate(s[0],s[1]),n.ctx.rotate(this.rotation),n.ctx.beginPath(),n.ctx.strokeStyle="rgba("+(2*o+2)+",90,90,1)";var r=this.drawPoints.length,a=this.drawPoints;if(r<3)for(var l=1;l<r;l++){var h=e.worldToClientPoint([a[l-1][0],a[l-1][1],a[l-1][2]]),d=e.worldToClientPoint([a[l][0],a[l][1],a[l][2]]);i.moveTo(h[0]-s[0],h[1]-s[1]),i.lineTo(d[0]-s[0],d[1]-s[1]),n.ctx.moveTo(h[0]-s[0],h[1]-s[1]),n.ctx.lineTo(d[0]-s[0],d[1]-s[1])}else for(h=e.worldToClientPoint([a[0][0],a[0][1],a[0][2]]),l=0;l<r-2;l++){var c=e.worldToClientPoint([a[l+1][0],a[l+1][1],a[l+1][2]]),u=e.worldToClientPoint([a[l+2][0],a[l+2][1],a[l+2][2]]);d=MathUtil.centerByArr(c,u);i.moveTo(h[0]-s[0],h[1]-s[1]),i.quadraticCurveTo(c[0]-s[0],c[1]-s[1],d[0]-s[0],d[1]-s[1]),n.drawHanddrawing(h,c,d,s),h=d}this.highlightColor?i.strokeStyle=this.highlightColor:i.strokeStyle=this.strokeStyle,i.stroke(),n.ctx.stroke(),i.restore(),n.ctx.restore()}},t.prototype.setPoints=function(e){this.drawPoints=e},t.prototype.addPoint=function(e){this.drawPoints.push(e)},t.prototype.getPoints=function(){return this.drawPoints},t.prototype.getGrips=function(e,t,i){if(null==i)return this.drawPoints;var n=t.getMarkupBbox(e,i),o=[n[0],n[1]],s=[n[2],n[3]],r=[(o[0]+s[0])/2,(o[1]+s[1])/2],a=[];return a.push(o[0],o[1]),a.push(o[0],r[1]),a.push(o[0],s[1]),a.push(r[0],s[1]),a.push(s[0],s[1]),a.push(s[0],r[1]),a.push(s[0],o[1]),a.push(r[0],o[1]),a},t}(Markups),Mouse$3=MouseButtons,HanddrawingMarkupTool=function(e){function t(t){var i=e.call(this)||this;return i.markupManager=t,i}return __extends$3(t,e),t.prototype.begin=function(e,t,i,n){this.startX=t,this.startY=i;var o=this.markupManager.getColor(),s=this.markupManager.getLineWidth();this.markup=new HanddrawingMarkup([],o,s,0)},t.prototype.onEditing=function(e,t,i,n){var o=e.clientToWorldPoint([t,i]);this.markup.addPoint(o),this.redraw(e)},t.prototype.end=function(e,t,i,n){return this.startX==t&&this.startY==i?(console.log("Ignore single point."),Mouse$3.FINISHED):(this.addMarkup(e,this.markup),this.markup=null,this.redraw(e),Mouse$3.FINISHED)},t}(MarkupTool),Mouse$2=MouseButtons,MarkupEditor=function(){function e(e,t,i,n,o){this.canvas=e,this.MarkupVirtualPad=i,this.modelViewer=o,this.ctx=e.getContext("2d"),this.markupManager=t,this.setMarkupType("arrow"),this.curIndex=-1,this.editIndex=-1,this.preEdit=-1,this.inEditMode=!1,this.currentGrip=-1,this.bFirstClick=!0,this.firstPos=[],this.touchPos=[],this.device=n,this.hightLightColor="yellow",this.isEndDrawingForRightClick=!0,new TextMarkupTool(this.markupManager).createDiv(TextMarkupTool.divId)}return e.prototype.onDrawing=function(e,t,i){if(this.tool.onDrawing(e,t,this.MarkupVirtualPad,this.curIndex),this.curIndex!=this.highLightId&&this.highLightId>=0&&(this.canvas.style.cursor="",this.highLightId=-1),this.curIndex>=0){if(!(o=this.markupManager.get(this.curIndex)))return;i&&this.markupManager.hitTest(e,i[0],i[1])==this.curIndex&&this.markupManager.viewer.isEnableAnnotationPick&&(this.canvas.style.cursor="pointer",this.highLightId=this.curIndex,this.device.isPc&&(t.lineWidth=o.lineWidth,this.markupManager.viewer.alwaysMode&&o.draw(e,this.markupManager.viewer,t,this.MarkupVirtualPad,this.curIndex,!0)))}if(this.editIndex>=0){if(this.markupManager.viewer.alwaysMode)return;if(0==this.markupManager.markups.length)return this.editIndex,!1;var n=this.markupManager.getMarkupBbox(e,this.editIndex);if(!n)return;var o,s=[n[0],n[1]],r=[n[2],n[3]],a=(o=this.markupManager.get(this.editIndex)).getGrips(e,this.markupManager,this.editIndex),l=this.markupManager.getMarkupCenter(e,this.editIndex);if(!l)return;t.save(),t.translate(l[0],l[1]),"Arrow"!=o.markupType&&t.rotate(o.rotation),t.beginPath(),t.lineWidth="1",t.strokeStyle="red",t.fillStyle="#ffffff";var h=(o.lineWidth||0)/2;4!=a.length&&(this.markupManager.viewer.operationTypes&&!this.markupManager.viewer.operationTypes.includes("Move")&&(t.strokeStyle="#999999"),t.strokeRect(-.5*(r[0]-s[0])-h,-.5*(r[1]-s[1])-h,r[0]-s[0]+2*h,r[1]-s[1]+2*h),t.strokeStyle="red",this.markupManager.viewer.operationTypes&&!this.markupManager.viewer.operationTypes.includes("Rotate")&&(t.strokeStyle="#ffffff",t.fillStyle="#999999"),t.arc(0,s[1]-l[1]-20,6,0,2*Math.PI,!1),t.fill(),t.stroke(),t.closePath(),t.beginPath(),t.arc(0,s[1]-l[1]-20,3,.5*Math.PI,1.8*Math.PI,!1),t.moveTo(3,s[1]-l[1]-21),t.lineTo(.5,s[1]-l[1]-19.5),t.moveTo(3,s[1]-l[1]-21),t.lineTo(3,s[1]-l[1]-24.5),t.stroke()),t.closePath(),t.strokeStyle="red",t.fillStyle="#ffffff";var d=void 0,c=void 0;if("Arrow"==o.markupType){this.markupManager.viewer.operationTypes&&!this.markupManager.viewer.operationTypes.includes("Stretch")&&(t.strokeStyle="#999999");var u=this.markupManager.getMarkupSize(e,this.editIndex),p=Math.sqrt(u[0]*u[0]+u[1]*u[1]),g=u[0]/p*4,m=u[1]/p*4;t.beginPath(),t.arc(a[0]-l[0]+(a[0]<a[2]?-g/2:g/2),a[1]-l[1]+(a[1]<a[3]?-m/2:m/2),4,0,2*Math.PI,!1),t.fill(),t.stroke(),t.closePath(),t.beginPath(),t.arc(a[2]-l[0]+(a[0]<a[2]?g:-g),a[3]-l[1]+(a[1]<a[3]?m:-m),4,0,2*Math.PI,!1),t.fill(),t.stroke(),t.closePath()}else{this.markupManager.viewer.operationTypes&&!this.markupManager.viewer.operationTypes.includes("Rotate")&&(t.strokeStyle="#999999"),t.moveTo(0,s[1]-l[1]),t.lineTo(0,s[1]-l[1]-15),t.stroke();for(var f=0;f<a.length;f+=2){t.beginPath(),this.markupManager.viewer.operationTypes&&!this.markupManager.viewer.operationTypes.includes("Stretch")?t.strokeStyle="#999999":t.strokeStyle="red";var w=[a[f],a[f+1]];if("Text"==o.markupType||"Handdrawing"==o.markupType)d=1,c=1;else{var v=e.worldToClientPoint(o.drawPoints[0]),y=e.worldToClientPoint(o.drawPoints[1]);d=v[0]<y[0]?1:-1,c=v[1]<y[1]?1:-1}switch(f){case 0:t.arc(w[0]-l[0]-h*d,w[1]-l[1]-h*c,4,0,2*Math.PI,!1);break;case 2:t.arc(w[0]-l[0]-h*d,w[1]-l[1],4,0,2*Math.PI,!1);break;case 4:t.arc(w[0]-l[0]-h*d,w[1]-l[1]+h*c,4,0,2*Math.PI,!1);break;case 6:t.arc(w[0]-l[0],w[1]-l[1]+h*c,4,0,2*Math.PI,!1);break;case 8:t.arc(w[0]-l[0]+h*d,w[1]-l[1]+h*c,4,0,2*Math.PI,!1);break;case 10:t.arc(w[0]-l[0]+h*d,w[1]-l[1],4,0,2*Math.PI,!1);break;case 12:t.arc(w[0]-l[0]+h*d,w[1]-l[1]-h*c,4,0,2*Math.PI,!1);break;case 14:t.arc(w[0]-l[0],w[1]-l[1]-h*c,4,0,2*Math.PI,!1)}t.fill(),t.stroke(),t.closePath()}}t.restore(),this.MarkupVirtualPad.drawEdit(s,r,l,o,a,this.editIndex,g,m,h,[d,c])}},e.prototype.canCreateMarkup=function(e){if(-1==this.curIndex)return!0;var t=this.markupManager.get(this.curIndex);if(!t)return!0;var i=t.getGrips(e,this.markupManager);return this.editIndex!=this.curIndex&&0!=i.length&&"Text"!=t.markupType},e.prototype.setMarkupType=function(e){if(!MarkupViewer.isMobile||"cloud"!==e&&"polyline"!==e){switch(this.tool&&this.tool.onExit(),this.crtMarkupType=e,this.start=!1,e){case"ellips":this.tool=new EllipsMarkupTool(this.markupManager);break;case"rectangle":this.tool=new RectMarkupTool(this.markupManager);break;case"arrow":this.tool=new ArrowMarkupTool(this.markupManager);break;case"cross":this.tool=new CrossMarkupTool(this.markupManager);break;case"cloud":this.tool=new CloudMarkupTool(this.markupManager);break;case"cloud-rect":this.tool=new CloudRectMarkupTool(this.markupManager);break;case"text":this.tool=new TextMarkupTool(this.markupManager);break;case"polyline":this.tool=new PolylineMarkupTool(this.markupManager);break;case"handdrawing":this.tool=new HanddrawingMarkupTool(this.markupManager);break;default:console.log("Current type is not supported.")}this.tool.redraw=this.redraw.bind(this),this.tool.type=e}},e.prototype.begin=function(e,t,i,n){if(this.modelViewer&&"ViewerDrawing"===this.modelViewer.viewerType&&this.modelViewer.snapIsEnabled){var o=this.modelViewer._drawingViewer.snapToPoint(t,i),s=this.modelViewer._drawingViewer.toScreenPoint([o.GetPoint()[0],o.GetPoint()[1]]);t=s[0],i=s[1]}else this.modelViewer&&"Viewer3D"===this.modelViewer.viewerType&&this.modelViewer.snap&&(t=this.modelViewer.snap.context.hoverPosition.x,i=this.modelViewer.snap.context.hoverPosition.y);this.curIndex=this.markupManager.hitTest(e,t,i,!0);var r=this.MarkupVirtualPad.isEdge(t,i);if(!this.markupManager.viewer.isEnableAnnotationPick||this.curIndex<0&&this.canCreateMarkup(e)&&!r){if(this.editIndex>-1)return this.editIndex=-1,void this.redraw(e);if(n==Mouse$2.LelftButton){if(this.start=!0,this.textMarkupTool)return this.textMarkupTool.initDom(e),this.textMarkupTool=null,void this.redraw(e);this.tool.begin(e,t,i,n)}this.start&&n==Mouse$2.RightButton&&this.tool.begin(e,t,i,n)}this.bFirstClick=!0;var a=this.editIndex;if(this.preEdit=a,this.curIndex>=0){var l=this.markupManager.get(this.curIndex),h=null==l?void 0:l.markupType;if(MarkupViewer.isMobile&&("Cloud"===h||"Polyline"===h))return;if(this.markupManager.viewer.hasOwnProperty("isEnableAnnotationPick")&&!this.markupManager.viewer.isEnableAnnotationPick)return;this.editIndex=this.curIndex,this.inEditMode=!0,this.redraw(e)}else this.editIndex=-1,this.redraw(e);this.editIndex!=a&&this.markupManager.viewer.functions.onSelectChange(this.editIndex)},e.prototype.onEditing=function(e,t,i,n){if(this.start?-1!=this.curIndex&&this.editIndex==this.curIndex||this.tool.onEditing(e,t,i,n):this.tool.onMouseMove(e,t,i,n),this.inEditMode){var o=this.markupManager.hitGrip(e,[t,i],this.editIndex);if(this.bFirstClick){this.firstPos=[t,i],this.bFirstClick=!1,this.currentGrip=o>=0?o:-1;var s=this.markupManager.get(this.editIndex);if(!s)return;return s.originPoints=s.getPoints(),s.originRotation=s.rotation,"Text"==s.markupType&&(this.editIndex==this.preEdit&&s.userText&&s.originUserText&&this.currentGrip<9?s.userText=s.originUserText:-1!=this.currentGrip&&this.currentGrip<9&&(s.originUserText=s.userText)),s.controlPt&&(s.originControlPt=s.controlPt),void(s.editPt&&(s.originEditPt=s.editPt))}var r=[t,i];9==this.currentGrip?this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Rotate")&&(this.markupManager.gripRotate(e,this.editIndex,this.firstPos,r),this.redraw(e,r)):this.currentGrip>=0&&this.currentGrip<9?this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Stretch")&&(this.markupManager.gripDragging(e,this.editIndex,this.currentGrip,this.firstPos,r),this.redraw(e,r)):this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Move")&&(this.markupManager.translatePos(e,this.editIndex,this.firstPos,r),this.redraw(e,r))}else this.bFirstClick=!0,this.currentGrip=-1},e.prototype.end=function(e,t,i,n){if(this.modelViewer&&"ViewerDrawing"===this.modelViewer.viewerType&&this.modelViewer.snapIsEnabled){var o=this.modelViewer._drawingViewer.snapToPoint(t,i),s=this.modelViewer._drawingViewer.toScreenPoint([o.GetPoint()[0],o.GetPoint()[1]]);t=s[0],i=s[1]}else this.modelViewer&&"Viewer3D"===this.modelViewer.viewerType&&this.modelViewer.snap&&(t=this.modelViewer.snap.context.hoverPosition.x,i=this.modelViewer.snap.context.hoverPosition.y);this.start&&(-1!=this.curIndex&&this.editIndex==this.curIndex||Mouse$2.FINISHED==this.tool.end(e,t,i,n)&&(this.start=!1)),this.onEditing(e,t,i,n),this.inEditMode&&(this.inEditMode=!1),this.start=!1},e.prototype.onExit=function(e){this.tool.onExit(e)},e.prototype.onMouseWheel=function(e,t){this.start},e.prototype.onKeyDown=function(e,t){this.editIndex>=0&&("Delete"==t.code||"Backspace"==t.code)&&this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Delete")&&(this.markupManager.remove(this.editIndex),this.curIndex=-1,this.editIndex=-1,this.redraw(e))},e.prototype.onClick=function(e,t){var i=this.formatEventOffset(e,t),n=this.markupManager.hitTest(e,i.x,i.y,!0);if(n>-1){var o=this.markupManager.get(n);if(0==t.button||2==t.button&&this.isEndDrawingForRightClick){var s={click:0==t.button?0:1,clientPosition:{x:t.clientX,y:t.clientY},screenPosition:{x:t.screenX,y:t.screenY},eventType:0==t.button?"Click":"RightClick"};this.markupManager.viewer.functions.onClick(__assign(__assign({},s),o))}}this.isEndDrawingForRightClick=!0},e.prototype.onTouch=function(e,t){var i=this.formatEventOffset(e,t),n=this.markupManager.hitTest(e,i.x,i.y,!0);if(n>-1){var o=this.markupManager.get(n),s={click:2,clientPosition:{x:t.touches[0].pageX,y:t.touches[0].pageY},screenPosition:{x:t.touches[0].screenX,y:t.touches[0].screenY},eventType:"touch"};this.markupManager.viewer.functions.onTouch(__assign(__assign({},s),o))}this.isEndDrawingForRightClick=!0},e.prototype.onLongPress=function(e,t){var i=this.formatEventOffset(e,t),n=this.markupManager.hitTest(e,i.x,i.y,!0);if(n>-1){var o=this.markupManager.get(n),s={click:2,clientPosition:{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY},screenPosition:{x:t.changedTouches[0].screenX,y:t.changedTouches[0].screenY},eventType:"longPress"};this.markupManager.viewer.functions.onLongPress(__assign(__assign({},s),o))}},e.prototype.onDoubleClick=function(e,t){var i=this.formatEventOffset(e,t),n=this.markupManager.hitTest(e,i.x,i.y,!0);if(n>-1){var o=this.markupManager.get(n),s={clientPosition:{x:t.clientX,y:t.clientY},screenPosition:{x:t.screenX,y:t.screenY}};this.markupManager.viewer.functions.onDoubleClick(__assign(__assign({},s),o))}this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Edit")&&(this.tool.onDoubleClick&&this.tool.onDoubleClick(e,t),this.editText(e))},e.prototype.onDoubleTouch=function(e,t){this.markupManager.viewer.operationTypes&&this.markupManager.viewer.operationTypes.includes("Edit")&&(this.tool.onDoubleTouch&&this.tool.onDoubleTouch(e,t),this.editText(e))},e.prototype.editText=function(e){if(!(this.curIndex<0||null==this.curIndex)){var t=this.markupManager.get(this.curIndex);if(t){var i=t.getPoints();if("Text"==t.markupType){""!=TextMarkupTool.lastTextareaId&&(this.textMarkupTool?this.textMarkupTool.initDom(e):this.tool.initDom(e));var n=new TextMarkupTool(this.markupManager,t.rotation,i),o=e.worldToClientPoint([i[0][0],i[0][1],i[0][2]]);n.setUserText(t.getPureText()),this.tool.rotation=t.rotation,n.begin(e,o[0],o[1],Mouse$2.LelftButton),n.setEditBox(t.getTextSize()),this.device.isMobileApple||this.device.isPc||setTimeout((function(){n.reposition(e)}),500),this.markupManager.remove(this.curIndex),this.highLightId=-1,this.curIndex=-1,this.editIndex=-1,this.textMarkupTool=n,this.redraw(e)}}}},e.prototype.onMouseDown=function(e,t){2==t.button?(e.startX=null,e.startY=null,this.isEndDrawingForRightClick=!0,(this.tool instanceof PolylineMarkupTool||this.tool instanceof CloudMarkupTool)&&(this.isEndDrawingForRightClick=this.tool.getIsEndDrawing()),this.tool.onMouseRightClick&&this.tool.onMouseRightClick(e,t)):this.begin(e,t.offsetX,t.offsetY,t.buttons)},e.prototype.onMouseMove=function(e,t){var i=this.formatEventOffset(e,t);this.onEditing(e,i.x,i.y,t.buttons)},e.prototype.onMouseUp=function(e,t,i){var n=this.formatEventOffset(e,t);this.markupManager.viewer.alwaysMode&&2==t.button&&(this.markupManager.hitTest(e,n.x,n.y,!0)>-1&&(t.preventDefault(),t.stopPropagation()));if(this.curIndex>=0&&this.markupManager.viewer.alwaysMode){if(!this.device.isPc)return;var o=this.markupManager.get(this.curIndex),s=this.markupManager.getHighlightConfig()||{highlightColor:""};o&&(o.highlightColor=o.highlightColor?"":s.highlightColor,this.redraw(e))}return this.end(e,n.x,n.y,t.buttons)},e.prototype.onTouchstart=function(e,t){var i=this.formatEventOffset(e,t);this.touchPos=[i.x,i.y],this.begin(e,i.x,i.y,1)},e.prototype.onTouchmove=function(e,t){var i=this.formatEventOffset(e,t);this.touchPos=[i.x,i.y],this.onEditing(e,i.x,i.y,1)},e.prototype.onTouchend=function(e,t){var i=this.formatEventOffset(e,t);return this.end(e,this.touchPos.length>0?this.touchPos[0]:i.x,this.touchPos.length>0?this.touchPos[1]:i.y,1)},e.prototype.isPanMode=function(e){return e==Mouse$2.MiddleButton||e==Mouse$2.RightButton},e.prototype.formatEventOffset=function(e,t){var i,n,o=this.canvas.getBoundingClientRect();if(MarkupViewer.isMobile){var s=t.touches.length>0?t.touches:t.changedTouches;i=s[0].pageX-(o.x||o.left),n=s[0].pageY-(o.y||o.top)}else i=t.clientX-(o.x||o.left),n=t.clientY-(o.y||o.top);return{x:i,y:n}},e.prototype.redraw=function(e,t){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.MarkupVirtualPad.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.MarkupVirtualPad.ctx.fillStyle="rgba(0,0,0,0)",this.MarkupVirtualPad.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.markupManager.draw(e,this.ctx),this.onDrawing(e,this.ctx,t),this.markupManager.viewer.redrawOtherMarkups()},e.prototype.setCurIndex=function(e){this.curIndex=e},e.prototype.redrawOnlySelf=function(e,t){this.MarkupVirtualPad.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.MarkupVirtualPad.ctx.fillStyle="rgba(0,0,0,0)",this.MarkupVirtualPad.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.markupManager.draw(e,this.ctx),this.onDrawing(e,this.ctx,t)},e.prototype.getStart=function(){return this.start},e}(),MarkupIO=function(){function e(){}return e.markups2string=function(e){return JSON.stringify(e)},e.string2markups=function(e){var t=JSON.parse(e);return this.transform2markups(t)},e.transform2markups=function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i],o=n.drawPoints,s=n.strokeStyle,r=n.lineWidth,a=n.fillStyle,l=n.close,h=n.userText,d=n.fontSize,c=n.rotation,u=n.fontFamily,p=n.textAreaId,g=n.center,m=n.markupId,f=n.controlPt,w=null;switch(n.markupType){case"Ellipse":w=new EllipsMarkup(o,s,r,c,a);break;case"Rectangle":w=new RectMarkup(o,s,r,c,a);break;case"Arrow":w=new ArrowMarkup(o,s,r);break;case"Cross":w=new CrossMarkup(o,s,r,c);break;case"Cloud":w=new CloudMarkup(o,s,r,f,c,a,l);break;case"CloudRect":w=new CloudRectMarkup(o,s,r,c,a);break;case"Text":if(2==o.length&&"number"==typeof o[0]){if(w=new TextMarkup(o,h,s,d,u,c,p,g,!0),n.pureText){var v=w.getTextSize();w.resizeText(v)}}else w=new TextMarkup(o[0],h,s,d,u,c,p,g);break;case"Polyline":w=new PolylineMarkup(o,s,r,c,a,l);break;case"Handdrawing":w=new HanddrawingMarkup(o,s,r,c);default:console.log("Current type is not supported.")}m&&(w.markupId=m),t.push(w)}return t},e}(),MarkupManager=function(){function e(e,t){this.MarkupVirtualPad=e,this.viewer=t,this.markups=[],this.strokeStyle="red",this.lineWidth=3,this.fontSize=14,this.fontFamily="Arial",this.fillStyle="",this.enableFillStyle=!0,this.highlightConfig={hoverColor:"#FFFFFF",highlightColor:"#3DCC93"}}return e.prototype.toString=function(e){return MarkupIO.markups2string(e||this.markups)},e.prototype.fromString=function(e){return MarkupIO.string2markups(e)},e.prototype.add=function(e){e.markupId=Date.now(),this.markups.push(e)},e.prototype.setMarkups=function(e){this.markups=e.slice(),this.viewer.editor.editIndex=-1},e.prototype.clear=function(){this.markups=[],this.viewer.editor.tool.markup&&(this.viewer.editor.tool.markup.setPoints([]),this.viewer.editor.tool.bFirstCloudMarkup=!0)},e.prototype.draw=function(e,t){for(var i=this.markups,n=0,o=i.length;n<o;++n){var s=i[n];t.strokeStyle=s.strokeStyle,t.lineWidth=(MarkupViewer.isMobile,s.lineWidth),t.fillStyle=s.fillStyle,t.fontFamily=s.fontFamily,s.highLight&&(t.strokeStyle=s.highLight,s.highLight=null),s.highlightColor&&(t.strokeStyle=s.highlightColor,t.fillStyle=s.highlightColor),s.draw(e,this.viewer,t,this.MarkupVirtualPad,n)}},e.prototype.getColor=function(){return this.strokeStyle},e.prototype.setColor=function(e){this.strokeStyle=e},e.prototype.setHighlightConfig=function(e){this.highlightConfig=e},e.prototype.getHighlightConfig=function(){return this.highlightConfig},e.prototype.getFillColor=function(){return this.fillStyle},e.prototype.setFillColor=function(e){this.enableFillStyle=!0,e.getRGBA&&(e=e.getRGBA()),this.fillStyle=e},e.prototype.setFillStyleState=function(e){this.enableFillStyle=e},e.prototype.getFillStyleState=function(){return this.enableFillStyle},e.prototype.getLineWidth=function(){return this.lineWidth},e.prototype.setLineWidth=function(e){this.lineWidth=e},e.prototype.getFont=function(){return this.font},e.prototype.getFontSize=function(){return this.fontSize},e.prototype.setFont=function(e){this.font=e},e.prototype.get=function(e){return this.markups[e]},e.prototype.remove=function(e){e<0||this.markups.splice(e,1)},e.prototype.hitTest=function(e,t,i,n){var o=this.viewer.isEnableAnnotationPick?this.MarkupVirtualPad.hitTest(t,i):-1;if(null==n||o>=0)return o;o=-1;for(var s=this.markups.length-1;s>=0;s--){var r=this.markups[s];if(0!=r.bNeedHitByBbox&&"rgba(255,255,255,0)"!=r.fillStyle){var a=this.getMarkupBbox(e,s),l=this.getMarkupCenter(e,s),h=MathUtil.rotateAround([t,i],l,-r.rotation);if(1==!(h[0]<a[0]||h[0]>a[2]||h[1]<a[1]||h[1]>a[3])){o=s;break}}}return o},e.prototype.getMarkupBbox=function(e,t){var i=this.markups[t];if(!(t<0)&&i){var n=[Number.MAX_VALUE,Number.MAX_VALUE],o=[-Number.MAX_VALUE,-Number.MAX_VALUE],s=i.getPoints();if("Text"==i.markupType)return i.getTextBbox(e);i.editPt?s=s.concat(i.editPt):i.controlPt&&(s=s.concat(i.controlPt));for(var r=0;r<s.length;r++){var a=e.worldToClientPoint(s[r]);a[0]<n[0]&&(n[0]=a[0]),a[1]<n[1]&&(n[1]=a[1]),a[0]>o[0]&&(o[0]=a[0]),a[1]>o[1]&&(o[1]=a[1])}return n.concat(o)}},e.prototype.getMarkupCenter=function(e,t){var i=this.getMarkupBbox(e,t);if(i)return[(i[0]+i[2])/2,(i[1]+i[3])/2]},e.prototype.setFontSize=function(e){this.fontSize=e},e.prototype.getMarkupSize=function(e,t){var i=this.getMarkupBbox(e,t);return[Math.abs(i[2]-i[0]),Math.abs(i[3]-i[1])]},e.prototype.getFontFamily=function(){return this.fontFamily},e.prototype.setFontFamily=function(e){this.fontFamily=e},e.prototype.translatePos=function(e,t,i,n){var o=this.markups[t];if(o&&(o.setPoints(o.originPoints),o.editPt&&(o.editPt=o.originEditPt),o.controlPt&&(o.controlPt=o.originControlPt),this.getMarkupCenter(e,t))){for(var s=n[0]-i[0],r=n[1]-i[1],a=o.originPoints,l=[],h=[],d=0;d<a.length;d++)h[d]=e.worldToClientPoint(a[d]),h[d][0]+=s,h[d][1]+=r,l[d]=e.clientToWorldPoint(h[d]);if(o.setPoints(l),"Cloud"==o.markupType){var c=(o.editPt&&o.originEditPt||o.controlPt&&o.originControlPt).slice();if(c){var u=[];for(d=0;d<c.length;d++)u[d]=e.worldToClientPoint(c[d]),u[d][0]+=s,u[d][1]+=r,c[d]=e.clientToWorldPoint(u[d]);o.editPt?o.editPt=c:o.controlPt=c}}}},e.prototype.isPointInCircle=function(e,t,i){return MathUtil.distanceByArr(e,t)<=i},e.prototype.hitGrip=function(e,t,i){return this.MarkupVirtualPad.hitGrip(t[0],t[1])},e.prototype.getX=function(e,t,i,n){return(n-t)/i+e},e.prototype.getY=function(e,t,i,n){return(n-e)*i+t},e.prototype.gripRotate=function(e,t,i,n){var o=this.markups[t];o.rotation=o.originRotation;var s=this.getMarkupCenter(e,t),r=Math.sqrt(Math.pow(i[0]-s[0],2)+Math.pow(i[1]-s[1],2)),a=Math.sqrt(Math.pow(n[0]-s[0],2)+Math.pow(n[1]-s[1],2)),l=Math.sqrt(Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2)),h=(l*l-r*r-a*a)/(-2*r*a),d=Math.acos(h),c=(i[1]-s[1])/(i[0]-s[0]),u=this.getY(i[0],i[1],c,n[0]),p=this.getX(i[0],i[1],c,n[1]);i[0]>s[0]&&i[1]<s[1]?n[0]<p&&n[1]<u&&(d=2*Math.PI-d):i[0]>s[0]&&i[1]>s[1]?n[0]>p&&n[1]<u&&(d=2*Math.PI-d):i[0]<s[0]&&i[1]>s[1]?n[0]>p&&n[1]>u&&(d=2*Math.PI-d):i[0]<s[0]&&i[1]<s[1]&&n[0]<p&&n[1]>u&&(d=2*Math.PI-d),o.rotation=o.originRotation+d},e.prototype.rotateTransform=function(e,t,i,n,o){i=-(i%=2*Math.PI);var s,r,a=Math.sin(i),l=Math.cos(i),h=(s=n-e)*a+(r=o-t)*l;return[s=s*l-r*a+e,r=h+t]},e.prototype.gripDragging=function(e,t,i,n,o){var s=this.markups[t],r=s.originPoints;s.setPoints(r),s.originUserText&&(s.userText=s.originUserText);var a=s.getGrips(e,this,t),l=this.getMarkupSize(e,t),h=l.slice(),d=this.getMarkupCenter(e,t),c=d.slice();if("Arrow"==s.markupType){var u=o[0]-n[0],p=o[1]-n[1],g=e.worldToClientPoint(r[0]),m=e.worldToClientPoint(r[1]);switch(i){case 0:g[0]+=u,g[1]+=p;break;case 4:m[0]+=u,m[1]+=p;break;default:console.log("default grip id."+i)}return g=e.clientToWorldPoint(g),m=e.clientToWorldPoint(m),void s.setPoints([g,m])}var f=this.rotateTransform(n[0],n[1],s.rotation,o[0],o[1]),w=f[0]-n[0],v=f[1]-n[1];switch(i){case 0:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[1]-=v,h[0]-=w;break;case 1:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),h[0]-=w;break;case 2:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[1]+=v,h[0]-=w;break;case 3:c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[1]+=v;break;case 4:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[0]+=w,h[1]+=v;break;case 5:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),h[0]+=w;break;case 6:c[0]+=.5*w*Math.cos(s.rotation),c[1]+=.5*w*Math.sin(s.rotation),c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[1]-=v,h[0]+=w;break;case 7:c[0]-=.5*v*Math.sin(s.rotation),c[1]+=.5*v*Math.cos(s.rotation),h[1]-=v}if("Cloud"!=s.markupType&&"Polyline"!=s.markupType&&"Handdrawing"!==s.markupType){var y=[c[0]-.5*h[0],c[1]-.5*h[1]],b=[c[0]+.5*h[0],c[1]+.5*h[1]];"Text"==s.markupType&&s.resizeText(h),y=e.clientToWorldPoint(y),b=e.clientToWorldPoint(b),s.setPoints([y,b])}else this.draggingMultipleGrip(e,s,i,n,o,w,v,a,l,h,d,c)},e.prototype.draggingMultipleGrip=function(e,t,i,n,o,s,r,a,l,h,d,c){var u=t.originPoints.slice(),p=d[0]-l[0]/2,g=d[1]-l[1]/2,m=c[0]-h[0]/2,f=c[1]-h[1]/2,w=function(t){for(var i=0;i<t.length;i++){var n=e.worldToClientPoint(t[i]),o=n[0],s=n[1],r=o-p,a=s-g;n[0]=r/l[0]*h[0]+m,n[1]=a/l[1]*h[1]+f,t[i]=e.clientToWorldPoint(n)}return t},v=w(u);if(t.setPoints(v),"Cloud"==t.markupType){var y=(t.originEditPt||t.originControlPt).slice();t.editPt=w(y)}},e}(),MarkupVirtualPad=function(){function e(e,t,i){this.isMobile=i,this.canvas=document.createElement("canvas"),this.viewer=e,this.canvas.id="markupVirtual",this.canvas.width=t.clientWidth,this.canvas.height=t.clientHeight,document.body.appendChild(this.canvas),this.canvas.style.display="none",this.ctx=this.canvas.getContext("2d"),this.lineWidth=MarkupViewer.isMobile?18:6}return e.prototype.init=function(e,t){var i=this.ctx;i.save(),i.translate(e[0],e[1]),i.rotate(t),i.beginPath()},e.prototype.drawEdit=function(e,t,i,n,o,s,r,a,l,h){var d=this.ctx;if(d.save(),d.translate(i[0],i[1]),"Arrow"!=n.markupType&&("Text"===n.markupType&&(n.lineWidth=3),d.rotate(n.rotation)),d.beginPath(),d.lineWidth=n.lineWidth+2,d.fillStyle="rgba("+(2*s+2)+",255,255,1)",d.fillRect(-.5*(t[0]-e[0]),-.5*(t[1]-e[1]),t[0]-e[0],t[1]-e[1]),d.fillStyle=d.strokeStyle="rgba("+(2*s+2)+",100,255,1)",d.arc(0,e[1]-i[1]-20,14,0,2*Math.PI,!1),d.fill(),"Arrow"==n.markupType){var c=this.isMobile?12:6;d.fillStyle=d.strokeStyle="rgba("+(2*s+2)+",110,255,1)",d.beginPath(),d.arc(o[0]-i[0]+(o[0]<o[2]?-r/2:r/2),o[1]-i[1]+(o[1]<o[3]?-a/2:a/2),c,0,2*Math.PI,!1),d.fill(),d.stroke(),d.closePath(),d.fillStyle=d.strokeStyle="rgba("+(2*s+2)+",150,255,1)",d.beginPath(),d.arc(o[2]-i[0]+(o[0]<o[2]?r:-r),o[3]-i[1]+(o[1]<o[3]?a:-a),c,0,2*Math.PI,!1),d.fill(),d.stroke(),d.closePath()}else for(var u=h[0],p=h[1],g=0;g<o.length;g+=2){d.fillStyle=d.strokeStyle="rgba("+(2*s+2)+","+(5*g+110)+",255,1)",d.beginPath();var m=[o[g],o[g+1]];c=this.isMobile?12:6;switch(g){case 0:d.arc(m[0]-i[0]-l*u,m[1]-i[1]-l*p,c,0,2*Math.PI,!1);break;case 2:d.arc(m[0]-i[0]-l*u,m[1]-i[1],c,0,2*Math.PI,!1);break;case 4:d.arc(m[0]-i[0]-l*u,m[1]-i[1]+l*p,c,0,2*Math.PI,!1);break;case 6:d.arc(m[0]-i[0],m[1]-i[1]+l*p,c,0,2*Math.PI,!1);break;case 8:d.arc(m[0]-i[0]+l*u,m[1]-i[1]+l*p,c,0,2*Math.PI,!1);break;case 10:d.arc(m[0]-i[0]+l*u,m[1]-i[1],c,0,2*Math.PI,!1);break;case 12:d.arc(m[0]-i[0]+l*u,m[1]-i[1]-l*p,c,0,2*Math.PI,!1);break;case 14:d.arc(m[0]-i[0],m[1]-i[1]-l*p,c,0,2*Math.PI,!1)}d.fill(),d.stroke(),d.closePath()}d.restore()},e.prototype.drawArrow=function(e,t,i,n,o,s,r,a,l,h,d,c,u,p){var g=t-s,m=i-r,f=this.ctx;f.save(),f.lineWidth=MarkupViewer.isMobile?18:e.lineWidth+this.lineWidth,f.strokeStyle="rgba("+(2*c+2)+",20,20,1)",f.fillStyle="rgba("+(2*c+2)+",20,255,1)",f.beginPath(),f.moveTo(t,i),f.lineTo(n,o),g=n+s,m=o+r,f.moveTo(g,m),f.lineTo(n,o),g=n+a,m=o+l,f.lineTo(g,m),f.stroke(),f.restore()},e.prototype.drawRect=function(e,t,i,n,o,s){var r=this.ctx;r.save(),r.translate(n[0],n[1]),r.rotate(o),r.beginPath(),r.lineWidth=MarkupViewer.isMobile?18:e.lineWidth+this.lineWidth,r.strokeStyle="rgba("+(2*s+2)+",10,10,1)",r.fillStyle="rgba("+(2*s+2)+",10,255,1)",r.rect(-.5*(i[0]-t[0]),-.5*(i[1]-t[1]),i[0]-t[0],i[1]-t[1]),r.closePath(),r.stroke(),r.restore()},e.prototype.drawCross=function(e,t,i,n,o){var s=this.ctx;s.save(),s.translate(i[0],i[1]),s.rotate(n),s.strokeStyle="rgba("+(2*o+2)+",30,30,1)",s.fillStyle="rgba("+(2*o+2)+",30,255,1)",s.beginPath(),s.moveTo(-.5*(t[0]-e[0]),-.5*(t[1]-e[1])),s.lineTo(.5*(t[0]-e[0]),.5*(t[1]-e[1])),s.moveTo(-.5*(t[0]-e[0]),.5*(t[1]-e[1])),s.lineTo(.5*(t[0]-e[0]),-.5*(t[1]-e[1])),s.stroke(),s.restore()},e.prototype.drawCloudRect=function(e,t,i,n,o){var s=this.ctx;s.moveTo(e,t),s.quadraticCurveTo(i[0],i[1],n[0],n[1])},e.prototype.drawEllips=function(e,t,i,n,o,s,r){var a=this.ctx;a.save(),a.strokeStyle="rgba("+(2*o+2)+",50,50,1)",a.fillStyle="rgba("+(2*o+2)+",50,255,1)",a.translate(i[0],i[1]),a.rotate(n),a.beginPath(),a.ellipse(0,0,s,r,0,0,2*Math.PI),a.closePath(),a.stroke(),a.restore()},e.prototype.drawPolyline=function(e,t,i,n,o){var s=this.ctx;s.strokeStyle="rgba("+(2*o+2)+",70,70,1)",s.moveTo(e[0]-i[0],e[1]-i[1]),s.lineTo(t[0]-i[0],t[1]-i[1]),s.stroke()},e.prototype.drawHanddrawing=function(e,t,i,n){var o=this.ctx;o.moveTo(e[0]-n[0],e[1]-n[1]),o.quadraticCurveTo(t[0]-n[0],t[1]-n[1],i[0]-n[0],i[1]-n[1])},e.prototype.isEdge=function(e,t){var i=this.ctx.getImageData(e,t,1,1).data,n=i[0],o=i[1],s=i[2],r=i[3];return s==o&&o<100&&s%10==0&&n>=2&&255==r},e.prototype.hitTest=function(e,t){var i=this.ctx.getImageData(e,t,1,1).data,n=i[0],o=i[1],s=i[2],r=i[3];return n+o+s<3?-1:s==o&&o<100&&s%10==0&&n>=2&&255==r||255==s&&o>99?(n-2)/2:void 0},e.prototype.hitGrip=function(e,t){var i=this.ctx.getImageData(e,t,1,1).data,n=i[0],o=i[1],s=i[2];if(n+o+s+i[3]<3)return-1;if(255==s){if(100==o)return 9;if(255==o)return 10;if(o>=110)return(o-110)/10}return-1},e}(),Mouse$1=MouseButtons,MarkupViewer=function(){function e(t,i,n){var o=this;this.getDevice=function(){var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),o=/(?:Firefox)/.test(e);/(?:Chrome|CriOS)/.test(e);var s=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||o&&/(?:Tablet)/.test(e),r=/(?:iPhone)/.test(e)&&!s,a=/(?:iPhone|iPad)/.test(e);return{isPc:!(this.isMobileAgent||r||n||i||s),isMobileApple:a}},this.work=!1,this.alwaysMode=!1,this.restoreState=!1,this.firstTouch=0,this.longPressTime=0,this.longPressTimer=null,this.modelViewer=t,this.canvas=this.modelViewer._markupCanvas||document.createElement("canvas"),this.canvas.id="markup",this.canvas.style.zIndex=10,this.canvas.width=i.clientWidth,this.canvas.height=i.clientHeight,this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",!this.modelViewer._markupCanvas&&(this.modelViewer._markupCanvas=this.canvas),this.ctx=this.canvas.getContext("2d"),this.wrapDom=i,this.canvas.style.display="none",this.isShow=!1,this.functions={},this.isMobileAgent=n,e.isMobile=n||!this.getDevice().isPc,i.appendChild(this.canvas),this.modelViewer._markupViewers||(this.modelViewer._markupViewers=[]),this.modelViewer._markupViewers.push(this),this.bindEvent();var s=this;this.viewer=t.getViewer?t.getViewer():t,this.viewer.wrapDom=i,this.MarkupVirtualPad=new MarkupVirtualPad(this.viewer,i,e.isMobile),this.viewer.markupManager=this.markupManager=new MarkupManager(this.MarkupVirtualPad,this),this.editor=this.viewer.markupEditor=new MarkupEditor(this.canvas,this.markupManager,this.MarkupVirtualPad,this.getDevice(),this.modelViewer),this.editor.markupManager=this.viewer.markupManager,this.functions.onSelectChange=function(e){},this.functions.onClick=function(e){},this.functions.onTouch=function(e){},this.functions.onLongPress=function(e){},this.functions.itemCompleted=function(e){},this.functions.onDoubleClick=function(e){},this.isEnableAnnotationPick=!0,this.operationTypes=["Delete","Edit","Move","Rotate","Stretch"];this.modelViewer.addEventListener("Resized",(function(){s.canvas.width=i.clientWidth,s.canvas.height=i.clientHeight,s.MarkupVirtualPad.canvas.width=i.clientWidth,s.MarkupVirtualPad.canvas.height=i.clientHeight,s.update()})),e.isMobile&&(this.offsetHeight=this.wrapDom.offsetHeight,setInterval((function(){var e=o.wrapDom.offsetHeight;o.offsetHeight!=e&&(o.offsetHeight=e,o.resize())}),500))}return e.prototype.resize=function(){this.editor.tool.reposition&&this.editor.tool.reposition(this.viewer)},e.prototype.getContainerSize=function(){return this.wrapDom.getBoundingClientRect()},e.prototype.setOperationTypes=function(e){this.operationTypes=e},e.prototype.setIsEnableAnnotationPick=function(e){this.isEnableAnnotationPick=e},e.prototype.hideCanvas=function(){this.isShow=!1,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.modelViewer._markupViewers.map((function(e){e.isShow&&e.update()}));var e=!0;this.modelViewer._markupViewers.map((function(t){t.isShow&&(e=!1)})),e&&(this.canvas.style.display="none")},e.prototype.showCanvas=function(){this.isShow=!0,this.canvas.style.display="block",this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.modelViewer._markupViewers.map((function(e){e.isShow&&e.update()}))},e.prototype.redrawOtherMarkups=function(){var e=this;this.modelViewer._markupViewers.map((function(t){t.isShow&&t!==e&&t.updateOnlySelf()}))},e.prototype.startDrawing=function(){var e=this;this.work=!0,this.alwaysMode=!1,this.modelViewer._markupViewers.map((function(t){t!==e&&(t.editor.setCurIndex(-1),t.alwaysMode=!0)})),this.showCanvas()},e.prototype.switchMode=function(){},e.prototype.initStyle=function(){var e=this.viewer.markupManager;e.markups=[],e.strokeStyle="red",e.lineWidth=3,e.fontSize=14,e.fontFamily="Arial",e.fillStyle="white",e.enableFillStyle=!1},e.prototype.update=function(){this.editor.redraw(this.viewer)},e.prototype.updateOnlySelf=function(){this.editor.redrawOnlySelf(this.viewer)},e.prototype.onlyShowSelf=function(){var e=this;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.modelViewer._markupViewers.map((function(t){t===e&&t.updateOnlySelf()}))},e.prototype.recoverAllMarkupState=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.modelViewer._markupViewers.map((function(e){e.isShow&&e.updateOnlySelf()}))},e.prototype.bindEvent=function(){this.getDevice().isPc?(this.wrapDom.addEventListener("dblclick",this.onDoubleClick.bind(this),!1),this.wrapDom.addEventListener("mousedown",this.onMouseDown.bind(this),!0),"ViewerDrawing"===this.modelViewer.getViewerType()?this.wrapDom.parentElement.parentElement.addEventListener("mouseup",this.onMouseUp.bind(this),!0):this.wrapDom.addEventListener("mouseup",this.onMouseUp.bind(this),!1),this.wrapDom.addEventListener("mousemove",this.onMouseMove.bind(this),!1),this.wrapDom.addEventListener("mousewheel",this.onMouseWheel.bind(this),!1),this.wrapDom.addEventListener("DOMMouseScroll",this.onMouseWheel.bind(this),!1),this.wrapDom.addEventListener("contextmenu",this.oncontextmenu.bind(this),!1)):(this.wrapDom.addEventListener("touchstart",this.onTouchstart.bind(this),!0),this.wrapDom.addEventListener("touchend",this.onTouchend.bind(this),!0),this.wrapDom.addEventListener("touchmove",this.onTouchmove.bind(this),!0)),document.addEventListener("keydown",this.onKeyDown.bind(this)),document.addEventListener("keyup",this.onKeyUp.bind(this))},e.prototype.endDrawing=function(){this.work=!1,this.clearAnnotations(),this.editor.redraw(this.viewer),this.hideCanvas(),this.switchMode(),this.restoreState=!1;var e=document.querySelector("#bf-drawing-textEditor");if(e){var t=e.querySelectorAll("textarea");t.length&&(t[t.length-1].style.display="none",t[t.length-1].value="")}},e.prototype.clearAnnotations=function(){this.markupManager.clear(),this.update()},e.prototype.removeSelectedAnnotation=function(){-1!=this.editor.editIndex&&(this.markupManager.remove(this.editor.editIndex),this.editor.editIndex=-1,this.update())},e.prototype.createSnapshot=function(e){},e.prototype.showAnnotation=function(){},e.prototype.setAnnotationType=function(e){this.editor.setMarkupType(e),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer)},e.prototype.setAnnotationStyle=function(e){e["stroke-color"]&&this.markupManager.setColor(e["stroke-color"]),e["font-size"]&&this.markupManager.setFontSize(e["font-size"]),e["stroke-width"]&&this.markupManager.setLineWidth(e["stroke-width"]),e["fill-color"]&&this.markupManager.setFillColor(e["fill-color"]),e["font-family"]&&this.markupManager.setFontFamily(e["font-family"])},e.prototype.getAnnotationList=function(){return this.markupManager.markups.slice()},e.prototype.setAnnotationList=function(e){var t=e[0];if(!t)return this.clearAnnotations();if(t.drawPoints&&"number"==typeof t.drawPoints[0])for(var i=0;i<e.length;i++){for(var n=e[i].drawPoints,o=[],s=0;s<n.length;s+=2)o.push([n[s],n[s+1]]);e[i].drawPoints=o}t&&t.draw||(e=MarkupIO.transform2markups(e)),this.markupManager.setMarkups(e),this.restoreState=!0,this.showCanvas(),this.update()},e.prototype.editAnnotationEnd=function(){this.endDrawing()},e.prototype.getCurrentState=function(){return{annotationList:this.getAnnotationList(),state:this.modelViewer.getCurrentState()}},e.prototype.transform=function(e){return e},e.prototype.setState=function(e){var t=this;this.clearAnnotations(),this.modelViewer.setState(e.state),0!==("string"==typeof e.annotationList?JSON.parse(e.annotationList):e.annotationList).length&&setTimeout((function(){if("string"==typeof e.annotationList){var i=t.markupManager.fromString(e.annotationList);t.setAnnotationList(i)}else e.annotationList[0].id?t.setAnnotationList(t.transform(e.annotationList)):t.setAnnotationList(e.annotationList)}),1500)},e.prototype.oncontextmenu=function(e){e.preventDefault()},e.prototype.onDoubleClick=function(e){if(this.isShow){if(clearTimeout(this.clickStore),this.alwaysMode)return e.preventDefault(),void this.editor.onDoubleClick(this.viewer,e);!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),e.preventDefault(),this.editor.onDoubleClick(this.viewer,e)}},e.prototype.onMouseDown=function(e){this.isShow&&(this.mouseDownClientX=e.clientX,this.mouseDownClientY=e.clientY,this.alwaysMode||(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&e.target==this.canvas&&(e.preventDefault(),e.buttons==Mouse$1.LelftButton?(e.stopPropagation(),this.editor.onMouseDown(this.viewer,e)):this.editor.onMouseDown(this.viewer,e))))},e.prototype.onTouchstart=function(e){if(this.isShow){!this.work&&e.touches.length<2&&this.editor.onTouch(this.viewer,e);var t=this;if(clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((function(){t.work||1!==e.changedTouches.length||t.editor.onLongPress(t.viewer,e)}),this.longPressTime),!this.alwaysMode&&"CANVAS"==e.target.tagName.toUpperCase()){var i=Date.now();i-this.firstTouch<500&&this.editor.crtMarkupType&&"handdrawing"!==this.editor.crtMarkupType?this.editor.onDoubleTouch(this.viewer,e):(this.firstTouch=i,!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&e.target==this.canvas&&(e.preventDefault(),e.buttons==Mouse$1.LelftButton&&e.stopPropagation(),this.editor.onTouchstart(this.viewer,e),this.containerSize=this.getContainerSize()))}}},e.prototype.onMouseMove=function(e){if(this.isShow)return this.alwaysMode?(this.update(),void this.editor.onMouseMove(this.viewer,e)):void(this.work&&("Viewer3D"===this.modelViewer.viewerType&&this.modelViewer.snap||"ViewerDrawing"===this.modelViewer.viewerType&&this.modelViewer.snapIsEnabled||(e.preventDefault(),e.stopPropagation()),this.editor.onMouseMove(this.viewer,e)))},e.prototype.onTouchmove=function(e){if(this.isShow){if(clearTimeout(this.longPressTimer),this.alwaysMode||"CANVAS"!=e.target.tagName.toUpperCase())return this.update(),void this.editor.onMouseMove(this.viewer,e);if(this.work){var t=e.touches[0],i=this.containerSize,n=i.left,o=i.top,s=i.width,r=i.height;e.preventDefault(),e.stopPropagation(),t.pageX>n&&t.pageX<n+s&&t.pageY>o&&t.pageY<o+r&&this.editor.onTouchmove(this.viewer,e)}}},e.prototype.onTouchend=function(e){this.isShow&&(clearTimeout(this.longPressTimer),this.alwaysMode||"CANVAS"!=e.target.tagName.toUpperCase()?this.update():(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&(e.preventDefault(),e.stopPropagation(),this.editor.onTouchend(this.viewer,e))))},e.prototype.onMouseWheel=function(e){this.isShow&&(this.alwaysMode||(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&(e.preventDefault(),e.stopPropagation(),this.editor.onMouseWheel(this.viewer,e))))},e.prototype.onMouseUp=function(e){var t=this;this.isShow&&(clearTimeout(this.clickStore),this.mouseDownClientX!==e.clientX||this.mouseDownClientY!==e.clientY||this.editor.getStart()||(this.clickStore=setTimeout((function(){t.editor.onClick(t.viewer,e)}),500)),this.alwaysMode||e.button==Mouse$1.FINISHED?this.editor.onMouseUp(this.viewer,e,!0):(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&(e.preventDefault(),e.stopPropagation(),this.editor.onMouseUp(this.viewer,e,!0))))},e.prototype.onKeyDown=function(e){this.isShow&&this.work&&("textarea"!=document.activeElement.tagName.toLowerCase()&&e.stopPropagation(),this.editor.onKeyDown(this.viewer,e))},e.prototype.onKeyUp=function(e){this.isShow&&this.work&&"textarea"!=document.activeElement.tagName.toLowerCase()&&(e.preventDefault(),e.stopPropagation())},e.prototype.setLongPressTime=function(e){this.longPressTime=e},e}(),MarkupDrawing=function(e){function t(t,i,n){var o=e.call(this,t,i,n)||this;return o.modelViewer.addEventListener("Rendered",(function(){o.update()})),o.viewer.clientToWorldPoint=function(e){return o.viewer.toWorldPoint(e)},o.viewer.worldToClientPoint=function(e){return e?o.viewer.toScreenPoint([e[0],e[1]]):[]},o.isLock=!1,o}return __extends$3(t,e),t.prototype.getCurrentState=function(){return{annotationList:this.getAnnotationList(),state:JSON.parse(this.modelViewer.getCurrentState())}},t.prototype.startDrawing=function(){var e=this;this.isLock||(this.canvas.style.zIndex=10,this.work=!0,this.alwaysMode=!1,this.modelViewer._markupViewers.map((function(t){t!==e&&(t.editor.setCurIndex(-1),t.alwaysMode=!0)})),this.showCanvas(),this.switchMode())},t.prototype.onTouchstart=function(e){!this.work&&e.target==this.canvas&&e.touches.length<2&&this.editor.onTouch(this.viewer,e);var t=this;if(clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((function(){t.work||1!==e.changedTouches.length||t.editor.onLongPress(t.viewer,e)}),this.longPressTime),!this.alwaysMode&&!this.isLock){var i=Date.now();i-this.firstTouch<500&&this.editor.crtMarkupType&&"handdrawing"!==this.editor.crtMarkupType?this.editor.onDoubleTouch(this.viewer,e):(this.firstTouch=i,!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&e.target==this.canvas&&e.touches.length<2&&(e.preventDefault(),this.editor.onTouchstart(this.viewer,e),this.containerSize=this.getContainerSize()))}},t.prototype.onTouchmove=function(e){if(clearTimeout(this.longPressTimer),this.alwaysMode||this.isLock)this.update();else if(this.work){var t=e.touches[0],i=this.containerSize,n=i.left,o=i.top,s=i.width,r=i.height;e.touches.length<2?(e.preventDefault(),e.stopPropagation(),t.pageX>n&&t.pageX<n+s&&t.pageY>o&&t.pageY<o+r&&this.editor.onTouchmove(this.viewer,e)):this.update()}},t.prototype.showAnnotation=function(){this.alwaysMode=!0,this.canvas.style.zIndex=5,this.editor.editIndex=-1,this.update(),this.showCanvas()},t.prototype.hideAnnotation=function(){this.editor.editIndex=-1,this.editor.setCurIndex(-1),this.hideCanvas()},t.prototype.setState=function(e){if("string"!=typeof e.state&&(e.state=JSON.stringify(e.state)),this.modelViewer.setState(e.state),0!==("string"==typeof e.annotationList?JSON.parse(e.annotationList):e.annotationList).length)if("string"==typeof e.annotationList){var t=this.markupManager.fromString(e.annotationList);this.setAnnotationList(t)}else e.annotationList[0].id?this.setAnnotationList(this.transform(e.annotationList)):this.setAnnotationList(e.annotationList)},t.prototype.onMouseWheel=function(e){this.alwaysMode?this.update():(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&(e.preventDefault(),this.update(),this.editor.onMouseWheel(this.viewer,e)))},t.prototype.createSnapshot=function(e){var t=this.viewer.snapshotPure(),i=document.createElement("canvas");i.width=this.wrapDom.clientWidth,i.height=this.wrapDom.clientHeight,this.onlyShowSelf();var n=i.getContext("2d");n.beginPath(),n.fillStyle=this.wrapDom.style.background,n.fillRect(0,0,i.width,i.height),n.drawImage(t,0,0),n.drawImage(this.canvas,0,0),this.onlyShowSelf(),e(i.toDataURL())},t.prototype.switchMode=function(){},t.prototype.lockAnnotationAction=function(){this.isLock=!0,this.alwaysMode=!0,document.getElementById(TextMarkupTool.lastTextareaId)&&this.editor.tool.onExit(),this.editor.tool.markup=null,this.editor.tool.bFirstCloudMarkup=!0,this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer)},t.prototype.restoreAnnotationAction=function(){this.isLock=!1,this.alwaysMode=!1,this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer),this.startDrawing()},t.prototype.highlightAnnotationByIds=function(e){var t=this,i=this.getAnnotationList();if(e&&i.length&&e.length){Array.isArray(e)||(e=[e]);var n=null;e.forEach((function(e){(n=i.find((function(t){return t.markupId==e})))&&(n.highlightColor=t.markupManager.highlightConfig.highlightColor)})),this.setAnnotationList(i),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer)}},t.prototype.clearHighlight=function(){var e=this.getAnnotationList();e.length&&(e.map((function(e){e.highlightColor=""})),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer))},t.prototype.setHighlightConfig=function(e){this.markupManager.highlightConfig=e},t}(MarkupViewer),MarkupPDF=function(e){function t(t,i,n){var o=e.call(this,t,i,n)||this;return o.modelViewer.addEventListener("Rendered",(function(){o.update()})),o.viewer.clientToWorldPoint=function(e){return o.viewer.views[o.modelViewer._defaultViewId].toWorldPoint(e)},o.viewer.worldToClientPoint=function(e){return e?o.viewer.views[o.modelViewer._defaultViewId].toScreenPoint([e[0],e[1]]):[]},o}return __extends$3(t,e),t.prototype.getCurrentState=function(){return{annotationList:this.getAnnotationList(),state:JSON.parse(this.modelViewer.getCurrentState())}},t.prototype.startDrawing=function(){var e=this;this.canvas.style.zIndex=10,this.work=!0,this.alwaysMode=!1,this.modelViewer._markupViewers.map((function(t){t!==e&&(t.editor.setCurIndex(-1),t.alwaysMode=!0)})),this.showCanvas(),this.switchMode()},t.prototype.onTouchstart=function(e){if(!this.alwaysMode){var t=Date.now();t-this.firstTouch<500?this.editor.onDoubleTouch(this.viewer,e):(this.firstTouch=t,!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&e.target==this.canvas&&e.touches.length<2&&(e.preventDefault(),this.editor.onTouchstart(this.viewer,e),this.containerSize=this.getContainerSize()))}},t.prototype.onTouchmove=function(e){if(this.alwaysMode)this.update();else if(this.work){var t=e.touches[0],i=this.containerSize,n=i.left,o=i.top,s=i.width,r=i.height;e.touches.length<2?(e.preventDefault(),e.stopPropagation(),t.pageX>n&&t.pageX<n+s&&t.pageY>o&&t.pageY<o+r&&this.editor.onTouchmove(this.viewer,e)):this.update()}},t.prototype.showAnnotation=function(){this.alwaysMode=!0,this.canvas.style.zIndex=5,this.editor.editIndex=-1,this.update(),this.showCanvas()},t.prototype.hideAnnotation=function(){this.editor.editIndex=-1,this.editor.setCurIndex(-1),this.hideCanvas()},t.prototype.setState=function(e){if("string"!=typeof e.state&&(e.state=JSON.stringify(e.state)),this.modelViewer.setState(e.state),0!==("string"==typeof e.annotationList?JSON.parse(e.annotationList):e.annotationList).length)if("string"==typeof e.annotationList){var t=this.markupManager.fromString(e.annotationList);this.setAnnotationList(t)}else e.annotationList[0].id?this.setAnnotationList(this.transform(e.annotationList)):this.setAnnotationList(e.annotationList)},t.prototype.onMouseWheel=function(e){this.alwaysMode?this.update():(!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&(e.preventDefault(),this.update(),this.editor.onMouseWheel(this.viewer,e)))},t.prototype.createSnapshot=function(e){var t=document.createElement("canvas");t.width=this.canvas.clientWidth,t.height=this.canvas.clientHeight,this.onlyShowSelf();var i=t.getContext("2d");i.beginPath(),i.drawImage(this.canvas,0,0),this.recoverAllMarkupState();var n=this;n.viewer.views[n.modelViewer._defaultViewId].snapshotPure().then((function(i){var o=document.createElement("canvas");o.width=n.wrapDom.clientWidth,o.height=n.wrapDom.clientHeight;var s=o.getContext("2d");s.beginPath(),s.fillStyle=n.wrapDom.style.background,s.fillRect(0,0,o.width,o.height),s.drawImage(i,0,0),s.drawImage(t,0,0),e(o.toDataURL())}))},t.prototype.switchMode=function(){},t.prototype.highlightAnnotationByIds=function(e){var t=this,i=this.getAnnotationList();if(e&&i.length&&e.length){Array.isArray(e)||(e=[e]);var n=null;e.forEach((function(e){(n=i.find((function(t){return t.markupId==e})))&&(n.highlightColor=t.markupManager.highlightConfig.highlightColor)})),this.setAnnotationList(i),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer)}},t.prototype.clearHighlight=function(){var e=this.getAnnotationList();e.length&&(e.map((function(e){e.highlightColor=""})),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer))},t.prototype.setHighlightConfig=function(e){this.markupManager.highlightConfig=e},t}(MarkupViewer),MarkupViewer3D=function(e){function t(t,i,n){var o=e.call(this,t,i,n)||this;return o.cameraControl=o.viewer.cameraControl,o.viewBox={width:1e3,height:1e3},o.viewer.clientToWorldPoint=function(e){var t={x:e[0],y:e[1],z:0},i=o.modelViewer.clientToWorld(t);return[i.x,i.y,i.z]},o.viewer.worldToClientPoint=function(e){var t={x:e[0],y:e[1],z:e[2]||0},i=o.modelViewer.worldToClient(t);return[i.x,i.y]},o}return __extends$3(t,e),t.prototype.bindEvent=function(){this.getDevice().isPc?(this.wrapDom.addEventListener("dblclick",this.onDoubleClick.bind(this),!0),this.wrapDom.addEventListener("mousedown",this.onMouseDown.bind(this),!0),this.wrapDom.addEventListener("mouseup",this.onMouseUp.bind(this),!0),this.wrapDom.addEventListener("mousemove",this.onMouseMove.bind(this),!0),this.wrapDom.addEventListener("mousewheel",this.onMouseWheel.bind(this),!0),this.wrapDom.addEventListener("DOMMouseScroll",this.onMouseWheel.bind(this),!0),this.wrapDom.addEventListener("contextmenu",this.oncontextmenu.bind(this),!0),document.addEventListener("keydown",this.onKeyDown.bind(this),!0),document.addEventListener("keyup",this.onKeyUp.bind(this),!0)):(this.wrapDom.addEventListener("touchstart",this.onTouchstart.bind(this),!0),this.wrapDom.addEventListener("touchend",this.onTouchend.bind(this),!0),this.wrapDom.addEventListener("touchmove",this.onTouchmove.bind(this),!0))},t.prototype.showAnnotation=function(){this.alwaysMode=!0,this.canvas.style.zIndex=5,this.editor.editIndex=-1,this.update(),this.showCanvas()},t.prototype.hideAnnotation=function(){this.editor.editIndex=-1,this.editor.setCurIndex(-1),this.hideCanvas()},t.prototype.createSnapshot=function(e){var t=this.wrapDom.querySelector(".bf-view canvas"),i=document.createElement("canvas");i.width=this.wrapDom.clientWidth,i.height=this.wrapDom.clientHeight,this.onlyShowSelf();var n=i.getContext("2d");n.beginPath();var o=window.devicePixelRatio||1;n.drawImage(t,0,0,i.width*o,i.height*o,0,0,i.width,i.height),n.drawImage(this.canvas,0,0),this.recoverAllMarkupState(),e(i.toDataURL())},t.prototype.transform=function(e){for(var t=[],i=0;i<e.length;i++){var n,o=e[i],s=o.style,r=s["fill-opacity"];switch(o.shapeType){case 0:var a=this.getArrowPoints(o.size,o.position,-o.rotation);n=new ArrowMarkup(a,s["stroke-color"],s["stroke-width"],o.rotation);break;case 7:n=new CloudRectMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 4:var l=this.getCloudPoints(o);(n=new CloudMarkup(l[0],s["stroke-color"],s["stroke-width"],l[1],o.rotation,r&&s["fill-color"],!0)).close=!0;break;case 1:n=new RectMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 2:n=new EllipsMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 3:n=new CrossMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation);break;case 5:var h=this.worldToClient({x:o.position.x-.5*o.size.width,y:o.position.y+.5*o.size.height,z:o.position.z}),d=this.worldToClient(o.position),c=this.viewer.clientToWorldPoint([d.x,d.y]);n=new TextMarkup(this.viewer.clientToWorldPoint([h.x,h.y]),decodeURIComponent(o.text),s["stroke-color"],s["font-size"],s["font-family"],o.rotation,null,c)}t.push(n)}return t},t.prototype.getCloudPoints=function(e){var t=e.size.width/e.originSize.width,i=e.size.height/e.originSize.height,n=(new window.THREE.Matrix4).makeScale(t,i,1),o=(new window.THREE.Matrix4).makeRotationZ(-e.rotation),s=(new window.THREE.Matrix4).makeTranslation(e.position.x,e.position.y,e.position.z).multiply(o).multiply(n),r=e.shapePoints.split(","),a=[],l=[],h=!0;e.position;for(var d=1;d<r.length;d+=2){var c=new window.THREE.Vector3,u=this.viewBoxToWorld({x:parseInt(r[d-1]),y:parseInt(r[d])},e.originSize);c.x=u.x,c.y=u.y,c.z=0,c.applyMatrix4(s);var p=this.worldToClient(c),g=this.viewer.clientToWorldPoint([p.x,p.y]);h?a.push(g):l.push(g),h=!h}return[a,l]},t.prototype.viewBoxToWorld=function(e,t){var i=t.width,n=t.height,o=this.viewBox.width,s=this.viewBox.height;return{x:e.x/o*i,y:e.y/s*n}},t.prototype.getDrawPoints=function(e,t){var i=this.worldToClient({x:t.x-.5*e.width,y:t.y-.5*e.height,z:t.z}),n=this.worldToClient({x:t.x+.5*e.width,y:t.y+.5*e.height,z:t.z});return[this.viewer.clientToWorldPoint([i.x,i.y]),this.viewer.clientToWorldPoint([n.x,n.y])]},t.prototype.getArrowPoints=function(e,t,i){var n=this.worldToClient({x:t.x-.5*e.width,y:t.y,z:t.z}),o=this.worldToClient({x:t.x+.5*e.width,y:t.y,z:t.z}),s=this.worldToClient(t);return n=this.markupManager.rotateTransform(s.x,s.y,i,n.x,n.y),o=this.markupManager.rotateTransform(s.x,s.y,i,o.x,o.y),[this.viewer.clientToWorldPoint(n),this.viewer.clientToWorldPoint(o)]},t.prototype.worldToClient=function(e){var t=this.getContainerOffsetToClient(this.wrapDom),i=this.cameraControl.getCamera(),n=new window.THREE.Vector3(e.x,e.y,e.z);return n.applyMatrix4(i.matrixWorld),n.sub(i.position),n.project(i),n.x=Math.floor(.5*(n.x+1)*t.width+.5),n.y=Math.floor(-.5*(n.y-1)*t.height+.5),n.z=0,n},t.prototype.getContainerOffsetToClient=function(e){var t,i;if(e!=document){var n=(i=e).getBoundingClientRect?function(e){var t=e.getBoundingClientRect(),i=document.body,n=document.documentElement,o=n.clientTop||i.clientTop,s=n.clientLeft||i.clientLeft,r=t.top-o,a=t.left-s;return{top:Math.round(r),left:Math.round(a)}}(i):function(e){for(var t=0,i=0;e;)t+=e.offsetTop,i+=e.offsetLeft,e=e.offsetParent;var n=document.body,o=document.documentElement;return{top:t-=window.pageYOffset||o.scrollTop||n.scrollTop,left:i-=window.pageXOffset||o.scrollLeft||n.scrollLeft}}(i);t={width:e.offsetWidth,height:e.offsetHeight,left:n.left,top:n.top}}else t={width:window.innerWidth,height:window.innerHeight,left:0,top:0};return t},t.prototype.highlightAnnotationByIds=function(e){var t=this,i=this.getAnnotationList();if(e&&i.length&&e.length){Array.isArray(e)||(e=[e]);var n=null;e.forEach((function(e){(n=i.find((function(t){return t.markupId==e})))&&(n.highlightColor=t.markupManager.highlightConfig.highlightColor)})),this.setAnnotationList(i),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer)}},t.prototype.clearHighlight=function(){var e=this.getAnnotationList();e.length&&(e.map((function(e){e.highlightColor=""})),this.editor.tool.redraw&&this.editor.tool.redraw(this.viewer))},t.prototype.setHighlightConfig=function(e){this.markupManager.highlightConfig=e},t}(MarkupViewer),Mouse=MouseButtons,MarkupViewer2D=function(e){function t(t,i,n){var o=e.call(this,t,i,n)||this;return o.absoluteBasePoint=null,o.screenBasePoint=null,o.zoomFactor={x:1,y:1},o.viewBox={width:1e3,height:1e3},o.viewer.clientToWorldPoint=function(e){var t=o.viewer.clientToWorld({x:e[0],y:e[1]});return[t.x,t.y]},o.viewer.worldToClientPoint=function(e){var t=o.viewer.worldToClient({x:e[0],y:e[1]});return[t.x,t.y]},o}return __extends$3(t,e),t.prototype.onMouseUp=function(e){!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&this.editor.onMouseUp(this.viewer,e)},t.prototype.setState=function(e){if(this.modelViewer.setState(e.state),0!==("string"==typeof e.annotationList?JSON.parse(e.annotationList):e.annotationList).length)if("string"==typeof e.annotationList){var t=this.markupManager.fromString(e.annotationList);this.setAnnotationList(t)}else e.annotationList[0].id?this.setAnnotationList(this.transform(e.annotationList)):this.setAnnotationList(e.annotationList)},t.prototype.createSnapshot=function(e){var t=this;this.viewer._imageRender.createSnapshotAsync("",(function(i){t.getScreenSnapshot(i,e)}))},t.prototype.getScreenSnapshot=function(e,t){var i=document.createElement("canvas"),n=this.getContainerOffsetToClient(this.wrapDom);i.width=n.width,i.height=n.height;var o,s=i.getContext("2d"),r=this;if(t&&e)return(o=new Image).onload=function(){s.drawImage(o,0,0),s.drawImage(r.canvas,0,0);var e=i.toDataURL("image/png");i=s=null,t(e)},o.src=e,null;e&&((o=new Image).src=e,s.drawImage(o,0,0));s.drawImage(this.canvas,0,0);var a=i.toDataURL("image/png");return i=s=null,a},t.prototype.transform=function(e){for(var t=[],i=0;i<e.length;i++){var n,o=e[i],s=o.style,r=s["fill-opacity"];switch(o.shapeType){case 0:var a=this.getArrowPoints(o.size,o.position,-o.rotation);n=new ArrowMarkup(a,s["stroke-color"],s["stroke-width"],o.rotation);break;case 7:n=new CloudRectMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 4:var l=this.getCloudPoints(o);n=new CloudMarkup(l[0],s["stroke-color"],s["stroke-width"],l[1],o.rotation,r&&s["fill-color"]);break;case 1:n=new RectMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 2:n=new EllipsMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation,r&&s["fill-color"]);break;case 3:n=new CrossMarkup(this.getDrawPoints(o.size,o.position),s["stroke-color"],s["stroke-width"],o.rotation);break;case 5:var h=this.worldToClient({x:o.position.x-.5*o.size.width,y:o.position.y+.5*o.size.height,z:o.position.z}),d=this.worldToClient(o.position),c=this.viewer.clientToWorldPoint([d.x,d.y]);n=new TextMarkup(this.viewer.clientToWorldPoint([h.x,h.y]),decodeURIComponent(o.text),s["stroke-color"],s["font-size"],s["font-family"],o.rotation,null,c)}t.push(n)}return t},t.prototype.getContainerOffsetToClient=function(e){var t,i;if(e!=document){var n=(i=e).getBoundingClientRect?function(e){var t=e.getBoundingClientRect(),i=document.body,n=document.documentElement,o=n.clientTop||i.clientTop,s=n.clientLeft||i.clientLeft,r=t.top-o,a=t.left-s;return{top:Math.round(r),left:Math.round(a)}}(i):function(e){for(var t=0,i=0;e;)t+=e.offsetTop,i+=e.offsetLeft,e=e.offsetParent;var n=document.body,o=document.documentElement;return{top:t-=window.pageYOffset||o.scrollTop||n.scrollTop,left:i-=window.pageXOffset||o.scrollLeft||n.scrollLeft}}(i);t={width:e.offsetWidth,height:e.offsetHeight,left:n.left,top:n.top}}else t={width:window.innerWidth,height:window.innerHeight,left:0,top:0};return t},t.prototype.getCloudPoints=function(e){var t=e.size.width/e.originSize.width,i=e.size.height/e.originSize.height,n=(new window.THREE.Matrix4).makeScale(t,i,1),o=(new window.THREE.Matrix4).makeRotationZ(-e.rotation),s=(new window.THREE.Matrix4).makeTranslation(e.position.x,e.position.y,e.position.z).multiply(o).multiply(n),r=e.shapePoints.split(","),a=[],l=[],h=!0;e.position;for(var d=1;d<r.length;d+=2){var c=new window.THREE.Vector3,u=this.viewBoxToWorld({x:parseInt(r[d-1]),y:parseInt(r[d])},e.originSize);c.x=u.x,c.y=u.y,c.z=0,c.applyMatrix4(s);var p=this.worldToClient(c),g=this.viewer.clientToWorldPoint([p.x,p.y]);h?a.push(g):l.push(g),h=!h}return[a,l]},t.prototype.worldToClient=function(e){var t=this.getContainerOffsetToClient(this.wrapDom),i=new window.THREE.Vector3,n=this.absoluteBasePoint,o=this.screenBasePoint;return this.absoluteBasePoint||(n={x:0,y:0}),this.screenBasePoint||(o={x:.5*t.width,y:.5*t.height}),i.x=(e.x-n.x)*this.zoomFactor.x+o.x,i.y=(-e.y-n.y)*this.zoomFactor.y+o.y,i.z=0,i},t.prototype.viewBoxToWorld=function(e,t){var i=t.width,n=t.height,o=this.viewBox.width,s=this.viewBox.height;return{x:e.x/o*i,y:e.y/s*n}},t.prototype.getDrawPoints=function(e,t){var i=this.worldToClient({x:t.x-.5*e.width,y:t.y-.5*e.height,z:t.z}),n=this.worldToClient({x:t.x+.5*e.width,y:t.y+.5*e.height,z:t.z});return[this.viewer.clientToWorldPoint([i.x,i.y]),this.viewer.clientToWorldPoint([n.x,n.y])]},t.prototype.getArrowPoints=function(e,t,i){var n=this.worldToClient({x:t.x-.5*e.width,y:t.y,z:t.z}),o=this.worldToClient({x:t.x+.5*e.width,y:t.y,z:t.z}),s=this.worldToClient(t);return n=this.markupManager.rotateTransform(s.x,s.y,i,n.x,n.y),o=this.markupManager.rotateTransform(s.x,s.y,i,o.x,o.y),[this.viewer.clientToWorldPoint(n),this.viewer.clientToWorldPoint(o)]},t.prototype.onMouseDown=function(e){!this.work&&this.restoreState&&(this.restoreState=!1,this.endDrawing()),this.work&&e.target==this.canvas&&(e.preventDefault(),e.buttons==Mouse.LelftButton?(e.stopPropagation(),this.editor.onMouseDown(this.viewer,e)):this.editor.onMouseDown(this.viewer,e))},t.prototype.onMouseWheel=function(e){this.work&&(e.preventDefault(),this.update(),this.editor.onMouseWheel(this.viewer,e))},t}(MarkupViewer);!function(){var e="Bimface.Plugins.Annotation.AnnotationManager",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation"),n=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){var t=this,i=e.viewer;this._opt=e,this.console=i.console,this.isShowAnnotation=!1,this.historyQueue=[],skipVueObserver(this);const n="Mobile"===i._opt.navigatorType;if(Glodon$1.Bimface.Viewer.Viewer3D&&"Viewer3D"===i.viewerType)this._helper=new MarkupViewer3D(i,i._opt.domElement,n);else if(Glodon$1.Bimface.Viewer.Viewer2D&&i instanceof Glodon$1.Bimface.Viewer.Viewer2D)this.isViewer2D=!0,this._helper=new MarkupViewer2D(i,i._opt.domElement.querySelector(".bf-image"),n);else if(Glodon$1.Bimface.Viewer.ViewerPDF&&i instanceof Glodon$1.Bimface.Viewer.ViewerPDF)this._helper=new MarkupPDF(i,i._opt.domElement.querySelector(".bf-pdf-outer"),n);else{this._helper=new MarkupDrawing(i,i._opt.domElement,n);let e={hoverColor:"#ADADAD",highlightColor:"#3DCC93"};i.getDisplayMode&&0===i.getDisplayMode()&&(e={hoverColor:"#FFFFFF",highlightColor:"#3DCC93"}),this._helper.setHighlightConfig&&this._helper.setHighlightConfig(e),this._helper.modelViewer&&this._helper.modelViewer.addEventListener(Glodon$1.Bimface.Viewer.ViewerDrawingEvent.ViewChanged,(function(){t.hideAnnotation(),t.showAnnotation()}))}this._helper.functions.onSelectChange=e=>{this.onSelectChange(e)},this._helper.functions.itemCompleted=e=>{this.itemCompleted(e)},window.addEventListener("resize",(()=>{this._helper.update()})),this.init()});n.prototype={init:function(){var e=this._opt;e.lineWidth&&this.setLineWidth(e.lineWidth),e.lineColor&&this.setLineColor(e.lineColor),e.fillColor&&this.setFillColor(e.fillColor),e.fontFamily&&this.setFontFamily(e.fontFamily),e.fontSize&&this.setFontSize(e.fontSize)},exit:function(){this.endDrawing()},onSelectChange(e){},onClick(e){this._helper.functions.onClick=e},onTouch(e){this._helper.functions.onTouch=e},onLongPress(i,n){t.send(e,"onLongPress"),0==arguments.length||1==arguments.length&&"number"!=typeof arguments[0]?this.console.warn("Parameter pressTime is required"):2!=arguments.length||"number"==typeof arguments[0]?(this._helper.setLongPressTime(i),this._helper.functions.onLongPress=n):this.console.warn("Incorrect parameter type of pressTime")},itemCompleted(e){this._helper.functions.itemCompleted=e},onDoubleClick(e){this._helper.functions.onDoubleClick=e},enablePick(e){this._helper.setIsEnableAnnotationPick(e)},setOperationMode(e){"[object Array]"===Object.prototype.toString.call(e)&&this._helper.setOperationTypes(e)},restoreOperationMode(){this._helper.setOperationTypes(["Delete","Edit","Move","Rotate","Stretch"])},getAnnotationList:function(){if(this._helper.viewer&&this._helper.viewer.getActiveLayoutId){const e=this._helper.viewer.getActiveLayoutId();0!=e&&(this._helper.currentLayoutId=e)}else this._helper.currentLayoutId&&delete this._helper.currentLayoutId;return this._helper.getAnnotationList()},setAnnotationList:function(e){e.length>0&&e[0].id&&(e=this._helper.transform(e)),this._helper.setAnnotationList(e),this._helper.update()},setState:function(e){this._opt.viewer&&"ViewerDrawing"==this._opt.viewer.viewerType&&void 0!==e.state.viewId&&this._opt.viewer.showViewById(e.state.viewId),this._helper.setState(e)},createSnapshot:function(e){this._helper.createSnapshot(e)},startDrawing:function(){this._helper.startDrawing();var e=document.querySelector(".bf-toolbar-select");e&&(e.style.display="none")},endDrawing:function(){t.send(e,"endDrawing"),this._helper.editAnnotationEnd(),this.isShowAnnotation=!1;var i=document.querySelector(".bf-toolbar-select");i&&(i.style.display="block")},clear:function(){t.send(e,"clear"),this._helper.clearAnnotations()},resize:function(){},setAnnotationType:function(i){t.send(e,"setAnnotationType"),this.restoreAnnotationAction(),this._helper.setAnnotationType(i.toLocaleLowerCase())},setLineWidth:function(i){t.send(e,"setLineWidth"),this._helper.setAnnotationStyle({"stroke-width":i})},setLineColor:function(i){t.send(e,"setLineColor"),this._helper.setAnnotationStyle({"stroke-color":`${i.getRGBA()}`})},setFillColor:function(i){t.send(e,"setFillColor"),this._helper.setAnnotationStyle({"fill-color":`${i.getRGBA()}`})},setFontFamily:function(i){t.send(e,"setFontFamily"),this._helper.setAnnotationStyle({"font-family":i})},setFontSize:function(i){t.send(e,"setFontSize"),this._helper.setAnnotationStyle({"font-size":i})},removeSelectedAnnotation:function(){this._helper.removeSelectedAnnotation()},showAnnotation:function(){this._helper.viewer&&this._helper.viewer.getActiveLayoutId&&this._helper.currentLayoutId&&this._helper.viewer.getActiveLayoutId()!=this._helper.currentLayoutId||this._helper.showAnnotation()},hideAnnotation:function(){this._helper.hideAnnotation()},setStyle:function(e){this._helper.setAnnotationStyle(e)},destroy:function(){this.endDrawing()},getCurrentState:function(){if(this.isViewer2D)var e=this._helper.getCurrentState();else{var t=this._opt.viewer.getViewer();this._opt.windowAdaption&&t.setCameraStateWithFrustum&&t.setCameraStateWithFrustum(!0);e=this._helper.getCurrentState();t.setCameraStateWithFrustum&&t.setCameraStateWithFrustum(!1)}return e},getWorldPosition:function(e){var t=this._opt.viewer,i=t.screenWidth/2,n=t.screenHeight/2,o={x:i+e.position.x,y:n-e.position.y};return t.clientToWorld(o)},inherit:function(e){for(var t in e)this[t]=e[t]},stringifyAnnotationList(e){return this._helper.markupManager.toString(e)},jsonifyAnnotationList(e){return this._helper.markupManager.fromString(e)},lockAnnotationAction(){this._helper.lockAnnotationAction&&this._helper.lockAnnotationAction()},restoreAnnotationAction(){this._helper.restoreAnnotationAction&&this._helper.restoreAnnotationAction()},highlightAnnotationByIds(e){this._helper.highlightAnnotationByIds&&this._helper.highlightAnnotationByIds(e)},clearHighlight(){this._helper.clearHighlight&&this._helper.clearHighlight()},setHighlightConfig(e){this._helper.setHighlightConfig&&this._helper.setHighlightConfig(e)}},i.AnnotationManager=n}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation").AnnotationToolbarConfig=function(){return{viewer:null,windowAdaption:!1,enableWebHanddrawing:!1}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation");let t=Object.freeze({Saved:"Saved",Cancelled:"Cancelled"});e.AnnotationToolbarEvent=t}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Annotation"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Bimface.Plugins.Annotation.AnnotationToolbarEvent,n=function(e){return skipVueObserver(this),e.viewer.getIsMobileNew&&e.viewer.getIsMobileNew()?function(e,n){var o=n._eventManager=new Glodon$1.Web.Lang.EventManager;let s=Glodon$1.Bimface.UI.Control.ControlEvent;var r=e.viewer,a=Glodon$1.Bimface.Viewer.ViewerDrawing&&r instanceof Glodon$1.Bimface.Viewer.ViewerDrawing;n.isDrawing=a;var l=Glodon$1.Bimface.Viewer.ViewerPDF&&r instanceof Glodon$1.Bimface.Viewer.ViewerPDF;n.isPDF=l;var h=r.getDomElement();a||(h=r.getDomElement().parentElement);var d=t.create("div","bf-annotation bf-hide");n.domElement=d;var c=Glodon$1.Bimface.Plugins.Annotation.AnnotationTypeOption,u=new Glodon$1.Bimface.Plugins.Annotation.AnnotationManagerConfig;u.viewer=r,u.windowAdaption=e.windowAdaption,u.annotationCallback=e.annotationCallback;var p=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;p.element=d,p.className="bf-toolbar bf-toolbar-annotation";var g=n.annotationToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(p);n.annotationToolbar=g,a&&(u.annotationToolbar=g);var m=n._annotationManager=new Glodon$1.Bimface.Plugins.Annotation.AnnotationManager(u);d.addEventListener("mousedown",(function(e){e.stopPropagation()})),d.addEventListener("touchstart",(function(e){e.stopPropagation()})),d.addEventListener("touchmove",(function(e){e.stopPropagation()}));var f=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;f.element=h,f.className="bf-toolbar bf-annotation-control";var w=n.controlToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(f);n.controlToolbar.hide();var v=new Glodon$1.Bimface.UI.Button.ButtonConfig;v.className="bf-save cancel",v.id="annotationCancel_id",v.title=BimfaceLanguage.bf_general_cancel;var y=new Glodon$1.Bimface.UI.Button.SingleButton(v);y.setHtml(`<span>${BimfaceLanguage.bf_general_cancel}</span>`),y.addEventListener("Click",(function(){m.endDrawing(),o.fireEvent(i.Cancelled),d.addClass("bf-hide"),n.controlToolbar.hide(),x||(x=app.getToolbar("MainToolbar")),x&&x.show(),re&&re.hide(),z&&z.hide(),fe&&fe.hide(),n.restoreDomState(n.domElement.parentElement)})),w.addControl(y);var b=new Glodon$1.Bimface.UI.Button.ButtonConfig;b.className="bf-save",b.id="annotatioSave_id",b.title=BimfaceLanguage.bf_general_save;var E=new Glodon$1.Bimface.UI.Button.SingleButton(b);E.setHtml(`<span>${BimfaceLanguage.bf_general_save}</span>`),E.addEventListener("Click",(function(){a||l?o.fireEvent(i.Saved,{annotationList:m.getAnnotationList()}):o.fireEvent(i.Saved,{annotationList:m.getAnnotationList(),state:m.getCurrentState()}),m.endDrawing(),w.hide(),d.addClass("bf-hide"),re&&re.hide(),z&&z.hide(),fe&&fe.hide(),n.restoreDomState(n.domElement.parentElement)})),w.addControl(E);let x=null;h.appendChild(d);let C="Annotation_"+Glodon$1.Web.Lang.Utility.UUID.createUUID();if(a){var M=new Glodon$1.Bimface.UI.Button.ButtonConfig;M.className="bf-button gld-bf-drag",M.title="平移",M.id="annotationHand_id",M.groupName=C,M.needTitle=!0;var P=new Glodon$1.Bimface.UI.Button.SingleButton(M);P.addEventListener("Click",(function(){m.lockAnnotationAction(),oe.show(),ge.hide()})),g.addControl(P)}var T=new Glodon$1.Bimface.UI.Button.ButtonConfig;T.className="bf-button gld-bf-narrow ",T.title="箭头",T.id="annotationArrow_id",T.groupName=C,T.needTitle=!0;var I=new Glodon$1.Bimface.UI.Button.SingleButton(T);I.addEventListener("Click",(function(){m.setAnnotationType(c.Arrow),oe.show(),ge.setCheckedState(!1),ge.hide()})),I.setChecked(),g.addControl(I);var S=new Glodon$1.Bimface.UI.Button.ButtonConfig;S.className="bf-button gld-bf-n-cloud",S.title="云线框",S.groupName=C,S.id="annotationCloudrect_id",S.needTitle=!0;var D=new Glodon$1.Bimface.UI.Button.SingleButton(S);D.addEventListener("Click",(function(){m.setAnnotationType(c.CloudRect),oe.show(),ge.setCheckedState(!1),ge.hide()})),g.addControl(D);var B=new Glodon$1.Bimface.UI.Button.ButtonConfig;B.className="bf-button gld-bf-nrectangle",B.title="矩形",B.groupName=C,B.id="annotationRectangle_id",B.needTitle=!0;var A=new Glodon$1.Bimface.UI.Button.SingleButton(B);A.addEventListener("Click",(function(){m.setAnnotationType(c.Rectangle),oe.show(),ge.setCheckedState(!1),ge.hide()})),g.addControl(A);var _=new Glodon$1.Bimface.UI.Button.ButtonConfig;_.className="bf-button gld-bf-noval",_.title="椭圆",_.groupName=C,_.id="annotationCircle_id",_.needTitle=!0;var L=new Glodon$1.Bimface.UI.Button.SingleButton(_);L.addEventListener("Click",(function(){m.setAnnotationType(c.Ellips),oe.show(),ge.setCheckedState(!1),ge.hide()})),g.addControl(L);var k=new Glodon$1.Bimface.UI.Button.ButtonConfig;k.className="bf-button gld-bf-mark",k.title="标记",k.groupName=C,k.id="annotationCross_id",k.needTitle=!0;var R=new Glodon$1.Bimface.UI.Button.SingleButton(k);if(R.addEventListener("Click",(function(){m.setAnnotationType(c.Cross),oe.show(),ge.setCheckedState(!1),ge.hide()})),g.addControl(R),r.getIsMobileNew()){var V=new Glodon$1.Bimface.UI.Button.ButtonConfig;V.className="bf-button gld-bf-n-handdrawing",V.title="手绘线",V.groupName=C,V.id="annotationHanddrawing_id";var G=new Glodon$1.Bimface.UI.Button.SingleButton(V);G.addEventListener("Click",(function(){m.setAnnotationType(c.Handdrawing),oe.show(),ge.setCheckedState(!1),ge.hide()})),g.addControl(G)}var U=new Glodon$1.Bimface.UI.Button.ButtonConfig;U.className="bf-button gld-bf-ntext",U.title="文字",U.groupName=C,U.id="annotationText_id",U.needTitle=!0;var O=new Glodon$1.Bimface.UI.Button.SingleButton(U);O.addEventListener("Click",(function(){m.setAnnotationType(c.Text),oe.setCheckedState(!1),oe.hide(),ge.show()})),g.addControl(O);var H=new Glodon$1.Bimface.UI.Button.ButtonConfig;H.className="bf-button bf-color",H.title="颜色",H.id="annotationColor_id",H.needTitle=!0;var N=new Glodon$1.Bimface.UI.Button.ToggleButton(H);N.setHtml('<span class="color-wrapper"><span class="color color-red"></span></span>'),N.addEventListener(s.StateChange,(function(e){e?(oe.setCheckedState(!1),ge.setCheckedState(!1),z.show(),re.hide()):z.hide()})),g.addControl(N);var $=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;$.element=h,$.className="bf-toolbar bf-color-control";var z=n.colorToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar($),F=new Glodon$1.Bimface.UI.Button.ButtonConfig;F.className="bf-button bf-pl-15",F.title="红",F.groupName="GroupColor",F.id="annotationLineThin_id";var W=new Glodon$1.Bimface.UI.Button.SingleButton(F);W.setHtml('<span class="color color-red"></span>');const j=new Glodon$1.Web.Graphics.Color(208,2,27,1);W.addEventListener("Click",(function(){N.setHtml('<span class="color-wrapper"><span class="color color-red"></span></span>'),ie("color-red"),m.setLineColor(j),z.hide(),d.removeClass("bf-hide"),N.setCheckedState(!1)})),z.addControl(W);var Z=new Glodon$1.Bimface.UI.Button.ButtonConfig;Z.className="bf-button",Z.title="黄",Z.groupName="GroupColor",Z.id="annotationLineMiddle_id";var X=new Glodon$1.Bimface.UI.Button.SingleButton(Z);const Y=new Glodon$1.Web.Graphics.Color(245,166,35,1);X.setHtml('<span class="color color-yellow"></span>'),X.addEventListener("Click",(function(){N.setHtml('<span class="color-wrapper"><span class="color color-yellow"></span></span>'),ie("color-yellow"),m.setLineColor(Y),z.hide(),d.removeClass("bf-hide"),N.setCheckedState(!1)})),z.addControl(X);var q=new Glodon$1.Bimface.UI.Button.ButtonConfig;q.className="bf-button",q.title="蓝",q.groupName="GroupColor",q.id="annotationLineThick_id";var K=new Glodon$1.Bimface.UI.Button.SingleButton(q);K.setHtml('<span class="color color-blue"></span>');const J=new Glodon$1.Web.Graphics.Color(74,144,226,1);K.addEventListener("Click",(function(){N.setHtml('<span class="color-wrapper"><span class="color color-blue"></span></span>'),ie("color-blue"),m.setLineColor(J),z.hide(),d.removeClass("bf-hide"),N.setCheckedState(!1)})),z.addControl(K);var Q=new Glodon$1.Bimface.UI.Button.ButtonConfig;Q.className="bf-button",Q.title="绿",Q.groupName="GroupColor",Q.id="annotationLineThick_id";var ee=new Glodon$1.Bimface.UI.Button.SingleButton(Q);ee.setHtml('<span class="color color-green"></span>');const te=new Glodon$1.Web.Graphics.Color(126,211,33,1);function ie(e){oe.element.removeClass("color-red").removeClass("color-yellow").removeClass("color-blue").removeClass("color-green").addClass(e),re.element.removeClass("color-red").removeClass("color-yellow").removeClass("color-blue").removeClass("color-green").addClass(e)}ee.addEventListener("Click",(function(){N.setHtml('<span class="color-wrapper"><span class="color color-green"></span></span>'),ie("color-green"),m.setLineColor(te),z.hide(),d.removeClass("bf-hide"),N.setCheckedState(!1)})),z.addControl(ee),z.hide();var ne=new Glodon$1.Bimface.UI.Button.ButtonConfig;ne.className="bf-button bf-line color-red",ne.title="粗细",ne.id="annotationLine_id",ne.needTitle=!0;var oe=new Glodon$1.Bimface.UI.Button.ToggleButton(ne);oe.setHtml('<span class="line-wrapper"><span class="line" style="height: .05em;"></span></span>'),oe.addEventListener(s.StateChange,(function(e){e?(N.setCheckedState(!1),ge.setCheckedState(!1),ge.hide(),re.show(),z.hide(),fe.hide()):re.hide()})),g.addControl(oe);var se=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;se.element=h,se.className="bf-toolbar bf-line-control color-red";var re=n.lineToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(se),ae=new Glodon$1.Bimface.UI.Button.ButtonConfig;ae.className="bf-button bf-line-button bf-pl-15",ae.title="细",ae.groupName="GroupLine",ae.id="annotationLineThin_id";var le=new Glodon$1.Bimface.UI.Button.SingleButton(ae);le.setHtml('<span class="line" style="height: .05em;">'),le.addEventListener("Click",(function(){oe.setHtml('<span class="line-wrapper"><span class="line" style="height: .05em;"></span></span>'),m.setLineWidth(3),re.hide(),d.removeClass("bf-hide"),oe.setCheckedState(!1)})),re.addControl(le);var he=new Glodon$1.Bimface.UI.Button.ButtonConfig;he.className="bf-button bf-line-button",he.title="中",he.groupName="GroupLine",he.id="annotationLineMiddle_id";var de=new Glodon$1.Bimface.UI.Button.SingleButton(he);de.setHtml('<span class="line" style="height: .1em;">'),de.addEventListener("Click",(function(){oe.setHtml('<span class="line-wrapper"><span class="line" style="height: .1em;"></span></span>'),m.setLineWidth(6),re.hide(),d.removeClass("bf-hide"),oe.setCheckedState(!1)})),re.addControl(de);var ce=new Glodon$1.Bimface.UI.Button.ButtonConfig;ce.className="bf-button bf-line-button",ce.title="粗",ce.groupName="GroupLine",ce.id="annotationLineThick_id";var ue=new Glodon$1.Bimface.UI.Button.SingleButton(ce);ue.setHtml('<span class="line" style="height: .15em;">'),ue.addEventListener("Click",(function(){oe.setHtml('<span class="line-wrapper"><span class="line" style="height: .15em;"></span></span>'),m.setLineWidth(10),re.hide(),d.removeClass("bf-hide"),oe.setCheckedState(!1)})),re.addControl(ue),re.hide();var pe=new Glodon$1.Bimface.UI.Button.ButtonConfig;pe.className="bf-button bf-font",pe.title="字号",pe.id="annotationFont_id",pe.needTitle=!0;var ge=new Glodon$1.Bimface.UI.Button.ToggleButton(pe);ge.setHtml('<span class="font-wrapper"><span class="font">14</span></span>'),ge.addEventListener(s.StateChange,(function(e){e?(N.setCheckedState(!1),oe.setCheckedState(!1),fe.show(),re.hide(),z.hide()):fe.hide()})),g.addControl(ge),ge.hide();var me=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;me.element=h,me.className="bf-toolbar bf-font-control";var fe=n.fontToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(me),we=new Glodon$1.Bimface.UI.Button.ButtonConfig;we.className="bf-button bf-font-button bf-pl-15",we.title="字号",we.groupName="GroupFont",we.id="annotationSizeSmall_id";var ve=new Glodon$1.Bimface.UI.Button.SingleButton(we);ve.setHtml("<span>14</span>"),ve.addEventListener("Click",(function(){ge.setHtml('<span class="font-wrapper"><span class="font">14</span></span>'),m.setFontSize(14),fe.hide(),d.removeClass("bf-hide"),ge.setCheckedState(!1)})),fe.addControl(ve);var ye=new Glodon$1.Bimface.UI.Button.ButtonConfig;ye.className="bf-button bf-font-button",ye.title="字号",ye.groupName="GroupFont",ye.id="annotationSizeSmall_id";var be=new Glodon$1.Bimface.UI.Button.SingleButton(ye);be.setHtml("<span>18</span>"),be.addEventListener("Click",(function(){ge.setHtml('<span class="font-wrapper"><span class="font">18</span></span>'),m.setFontSize(18),fe.hide(),d.removeClass("bf-hide"),ge.setCheckedState(!1)})),fe.addControl(be);var Ee=new Glodon$1.Bimface.UI.Button.ButtonConfig;Ee.className="bf-button bf-font-button",Ee.title="字号",Ee.groupName="GroupFont",Ee.id="annotationSizeSmall_id";var xe=new Glodon$1.Bimface.UI.Button.SingleButton(Ee);xe.setHtml("<span>24</span>"),xe.addEventListener("Click",(function(){ge.setHtml('<span class="font-wrapper"><span class="font">24</span></span>'),m.setFontSize(24),fe.hide(),d.removeClass("bf-hide"),ge.setCheckedState(!1)})),fe.addControl(xe),fe.hide()}(e,this):function(e,n){var o=n._eventManager=new Glodon$1.Web.Lang.EventManager,s=e.viewer,r=Glodon$1.Bimface.Viewer.ViewerDrawing&&s instanceof Glodon$1.Bimface.Viewer.ViewerDrawing;n.isDrawing=r;var a=Glodon$1.Bimface.Viewer.ViewerPDF&&s instanceof Glodon$1.Bimface.Viewer.ViewerPDF;n.isPDF=a;var l=t.create("div","bf-annotation bf-hide");n.domElement=l;var h=Glodon$1.Bimface.Plugins.Annotation.AnnotationTypeOption,d=new Glodon$1.Bimface.Plugins.Annotation.AnnotationManagerConfig,c=d.lineColor;d.viewer=s,d.windowAdaption=e.windowAdaption,d.annotationCallback=e.annotationCallback;var u=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;u.element=l,u.className="bf-toolbar bf-toolbar-annotation";var p=n.annotationToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(u);n.annotationToolbar=p,r&&(d.annotationToolbar=p);var g=n._annotationManager=new Glodon$1.Bimface.Plugins.Annotation.AnnotationManager(d);s.getDomElement().appendChild(l),l.addEventListener("mousedown",(function(e){e.stopPropagation()})),l.addEventListener("touchstart",(function(e){e.stopPropagation()})),l.addEventListener("touchmove",(function(e){e.stopPropagation()}));var m=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;m.element=l,m.className="bf-toolbar bf-toolbar-control";var f=new Glodon$1.Bimface.UI.Toolbar.Toolbar(m);let w="Annotation_"+Glodon$1.Web.Lang.Utility.UUID.createUUID();if(r){var v=new Glodon$1.Bimface.UI.Button.ButtonConfig;v.className="bf-button gld-bf-drag",v.title="视图交互",v.id="annotationHand_id",v.groupName=w;var y=new Glodon$1.Bimface.UI.Button.SingleButton(v);y.addEventListener("Click",(function(){g.lockAnnotationAction(),Q.show(),le.hide()})),p.addControl(y)}var b=new Glodon$1.Bimface.UI.Button.ButtonConfig;b.className="bf-button gld-bf-narrow ",b.title="箭头",b.id="annotationArrow_id",b.groupName=w;var E=new Glodon$1.Bimface.UI.Button.SingleButton(b);E.addEventListener("Click",(function(){g.setAnnotationType(h.Arrow),Q.show(),le.hide()})),E.setChecked(),p.addControl(E);var x=new Glodon$1.Bimface.UI.Button.ButtonConfig;x.className="bf-button gld-bf-n-cloud",x.title="云线框",x.groupName=w,x.id="annotationCloudrect_id";var C=new Glodon$1.Bimface.UI.Button.SingleButton(x);C.addEventListener("Click",(function(){g.setAnnotationType(h.CloudRect),Q.show(),le.hide()})),p.addControl(C);var M=new Glodon$1.Bimface.UI.Button.ButtonConfig;M.className="bf-button gld-bf-ncloud",M.title="云线",M.groupName=w,M.id="annotationCloud_id";var P=new Glodon$1.Bimface.UI.Button.SingleButton(M);P.addEventListener("Click",(function(){g.setAnnotationType(h.Cloud),Q.show(),le.hide()})),p.addControl(P);var T=new Glodon$1.Bimface.UI.Button.ButtonConfig;T.className="bf-button gld-bf-n-ployline",T.title="折线",T.groupName=w,T.id="annotationPolyline_id";var I=new Glodon$1.Bimface.UI.Button.SingleButton(T);I.addEventListener("Click",(function(){g.setAnnotationType(h.Polyline),Q.show(),le.hide()})),p.addControl(I);var S=new Glodon$1.Bimface.UI.Button.ButtonConfig;S.className="bf-button gld-bf-nrectangle",S.title="矩形",S.groupName=w,S.id="annotationRectangle_id";var D=new Glodon$1.Bimface.UI.Button.SingleButton(S);D.addEventListener("Click",(function(){g.setAnnotationType(h.Rectangle),Q.show(),le.hide()})),p.addControl(D);var B=new Glodon$1.Bimface.UI.Button.ButtonConfig;B.className="bf-button gld-bf-noval",B.title="椭圆",B.groupName=w,B.id="annotationCircle_id";var A=new Glodon$1.Bimface.UI.Button.SingleButton(B);A.addEventListener("Click",(function(){g.setAnnotationType(h.Ellips),Q.show(),le.hide()})),p.addControl(A);var _=new Glodon$1.Bimface.UI.Button.ButtonConfig;_.className="bf-button gld-bf-mark",_.title="X",_.groupName=w,_.id="annotationCross_id";var L=new Glodon$1.Bimface.UI.Button.SingleButton(_);if(L.addEventListener("Click",(function(){g.setAnnotationType(h.Cross),Q.show(),le.hide()})),p.addControl(L),e.enableWebHanddrawing){var k=new Glodon$1.Bimface.UI.Button.ButtonConfig;k.className="bf-button gld-bf-n-handdrawing",k.title="手绘线",k.groupName=w,k.id="annotationHanddrawing_id";var R=new Glodon$1.Bimface.UI.Button.SingleButton(k);R.addEventListener("Click",(function(){g.setAnnotationType(h.Handdrawing),Q.show(),le.hide()})),p.addControl(R)}var V=new Glodon$1.Bimface.UI.Button.ButtonConfig;V.className="bf-button gld-bf-ntext",V.title="文字",V.groupName=w,V.id="annotationText_id";var G=new Glodon$1.Bimface.UI.Button.SingleButton(V);G.addEventListener("Click",(function(){g.setAnnotationType(h.Text),Q.hide(),le.show()})),p.addControl(G);var U=new Glodon$1.Bimface.UI.Button.ButtonConfig;U.className="bf-combobox bf-color",U.title="颜色",U.id="annotationColor_id";var O=new Glodon$1.Bimface.UI.Button.ComboBox(U),H=new Glodon$1.Bimface.UI.Button.ButtonConfig;H.className="bf-button bf-color",H.title="红",H.id="annotationColorRed_id";var N=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(H);N.color=new Glodon$1.Web.Graphics.Color(208,2,27,1);var $=t.create("div","bf-color-button");$.setCss({backgroundColor:`#${N.color.getHEX()}`}),N.setHtml($.outerHTML),O.addControl(N);var z=new Glodon$1.Bimface.UI.Button.ButtonConfig;z.className="bf-button bf-color",z.title="黄",z.id="annotationColorYellow_id";var F=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(z);F.color=new Glodon$1.Web.Graphics.Color(245,166,35,1);var W=t.create("div","bf-color-button");W.setCss({backgroundColor:`#${F.color.getHEX()}`}),F.setHtml(W.outerHTML),O.addControl(F);var j=new Glodon$1.Bimface.UI.Button.ButtonConfig;j.className="bf-button bf-color",j.title="蓝",j.id="annotationColorBlue_id";var Z=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(j);Z.color=new Glodon$1.Web.Graphics.Color(74,144,226,1);var X=t.create("div","bf-color-button");X.setCss({backgroundColor:`#${Z.color.getHEX()}`}),Z.setHtml(X.outerHTML),O.addControl(Z);var Y=new Glodon$1.Bimface.UI.Button.ButtonConfig;Y.className="bf-button bf-color",Y.title="绿",Y.id="annotationColorGreen_id";var q=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(Y);q.color=new Glodon$1.Web.Graphics.Color(126,211,33,1);var K=t.create("div","bf-color-button");K.setCss({backgroundColor:`#${q.color.getHEX()}`}),q.setHtml(K.outerHTML),O.addControl(q),p.addControl(O);var J=new Glodon$1.Bimface.UI.Button.ButtonConfig;J.className="bf-combobox",J.title="粗细",J.id="annotationLine_id";var Q=new Glodon$1.Bimface.UI.Button.ComboBox(J),ee=new Glodon$1.Bimface.UI.Button.ButtonConfig;ee.className="bf-button bf-line",ee.title="细",ee.id="annotationLineThin_id";var te=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(ee);te.lineWidth=3;var ie=t.create("div","bf-line-button");ie.setCss({height:`${te.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-te.lineWidth)/2+"px 4px"}),te.element.appendChild(ie),Q.addControl(te),ee.title="中";var ne=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(ee);ne.lineWidth=6,ne.id="annotationLineMiddle_id";var oe=t.create("div","bf-line-button");oe.setCss({height:`${ne.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-ne.lineWidth)/2+"px 4px"}),ne.element.appendChild(oe),Q.addControl(ne),ee.title="粗";var se=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(ee);se.lineWidth=10,se.id="annotationLineThick_id";var re=t.create("div","bf-line-button");re.setCss({height:`${se.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-se.lineWidth)/2+"px 4px"}),se.element.appendChild(re),Q.addControl(se),O.addEventListener("Change",(function(e){g.setLineColor(e.color),(c=e.color).getHEX(),ie.setCss({height:`${te.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-te.lineWidth)/2+"px 4px"}),oe.setCss({height:`${ne.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-ne.lineWidth)/2+"px 4px"}),re.setCss({height:`${se.lineWidth}px`,backgroundColor:`#${c.getHEX()}`,margin:(32-se.lineWidth)/2+"px 4px"});var t=Q.getCurrentControl();Q.setSelectedControlById(t.getId())})),Q.addEventListener("Change",(function(e){g.setLineWidth(e.lineWidth)})),p.addControl(Q);var ae=new Glodon$1.Bimface.UI.Button.ButtonConfig;ae.className="bf-combobox bf-font-button",ae.title="字号",ae.id="annotationFont_id";var le=new Glodon$1.Bimface.UI.Button.ComboBox(ae),he=new Glodon$1.Bimface.UI.Button.ButtonConfig;he.className="bf-button bf-size",he.title="14";var de=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(he);de.fontSize=14,de.id="annotationSizeSmall_id",de.setHtml("14"),le.addControl(de),he.title="18";var ce=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(he);ce.fontSize=18,ce.id="annotationSizeMiddle_id",ce.setHtml("18"),le.addControl(ce),he.title="24";var ue=new Glodon$1.Bimface.UI.Button.ComboBoxOptionButton(he);ue.fontSize=24,ue.id="annotationSizeLarge_id",ue.setHtml("24"),le.addControl(ue),le.addEventListener("Change",(function(e){g.setFontSize(e.fontSize)})),le.hide(),p.addControl(le);var pe=new Glodon$1.Bimface.UI.Button.ButtonConfig;pe.className="bf-save",pe.title=BimfaceLanguage.bf_general_save;var ge=new Glodon$1.Bimface.UI.Button.SingleButton(pe);ge.setHtml(BimfaceLanguage.bf_general_save),ge.addEventListener("Click",(function(){r||a?o.fireEvent(i.Saved,{annotationList:g.getAnnotationList()}):o.fireEvent(i.Saved,{annotationList:g.getAnnotationList(),state:g.getCurrentState()}),g.endDrawing(),l.addClass("bf-hide"),n.restoreDomState(n.domElement.parentElement)})),f.addControl(ge);var me=new Glodon$1.Bimface.UI.Button.ButtonConfig;me.className="bf-cancel",me.title=BimfaceLanguage.bf_general_cancel;var fe=new Glodon$1.Bimface.UI.Button.SingleButton(me);fe.setHtml(BimfaceLanguage.bf_general_cancel),fe.addEventListener("Click",(function(){g.endDrawing(),o.fireEvent(i.Cancelled),l.addClass("bf-hide"),n.restoreDomState(n.domElement.parentElement)})),f.addControl(fe)}(e,this)};n.prototype={getEventManager:function(){return this._eventManager},addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},show:function(e,t){this.isDrawing||this.isPDF||this._annotationManager.clear(),this._annotationManager.startDrawing(),this.controlToolbar&&this.controlToolbar.show(),this.domElement.removeClass("bf-hide"),this.hideDomState(this.domElement.parentElement)},hideDomState(e){let t=e.querySelector(".bf-toolbar.bf-toolbar-search");t&&(t.style.display="none");let i=e.querySelector(".bf-toolbar.bf-layout-btn-wrapper");i&&(i.style.display="none");let n=e.querySelector(".bf-toolbar.bf-tree-toolbar");n&&(n.style.display="none")},restoreDomState(e){let t=e.querySelector(".bf-toolbar.bf-toolbar-search");t&&(t.style.display="block");let i=e.querySelector(".bf-toolbar.bf-layout-btn-wrapper");i&&(i.style.display="block");let n=e.querySelector(".bf-toolbar.bf-tree-toolbar");n&&(n.style.display="block")},getAnnotationManager:function(){return this._annotationManager},exit:function(){this.annotationToolbar.hide(),this.getAnnotationManager().exit()}},e.AnnotationToolbar=n}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").TagConfig=function(){return{viewer:null}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){var t=this,i=this._viewer=e.viewer.getViewer();if(this._opt=e,this._renderCallback=function(){t.resize()},e.minimap){this.mapHelper=e.minimap;var n=new CLOUD$1.View2dAdapter(this.mapHelper,i);this.mapHelper.setMinimapResizeCallback((function(e){t._tagHelper.updateGroupName(),t._tagHelper.updateDomContainer(),t._tagHelper.resize(e),t._tagHelper.updateByGroup()})),this.mapHelper.setPlaneChangedCallback((function(){t._tagHelper.updateGroupName(),t._tagHelper.updateByGroup()}))}else{n=new CLOUD$1.View3dAdapter(i);i.addCallbacks("render",this._renderCallback)}this._tagHelper=new CLOUD$1.Extensions.MarkerEditor(n),this._tagHelper.disableInteractions(!0),this.init()});t.prototype={init:function(){this._tagHelper.isInitialized()||this._tagHelper.init()},addTag:function(e,t){if(!e)return!1;var i=!1,n=this.getTags();e.userId=e.objectId,e.worldBoundingBox=e.boundingBox,e.worldPosition||(e.worldPosition={x:(e.worldBoundingBox.min.x+e.worldBoundingBox.max.x)/2,y:(e.worldBoundingBox.min.y+e.worldBoundingBox.max.y)/2,z:(e.worldBoundingBox.min.z+e.worldBoundingBox.max.z)/2});for(var o=0,s=n.length;o<s;o++){if(n[o].userId==e.userId)return i=!0,!1}e.floorList?this._tagHelper.setMarkerGroups(e.floorList):this._tagHelper.setMarkerGroups([]),this._tagHelper.updateGroupName(),i||this._tagHelper.createMarkerByIntersect(e,t.shape,t.image,t.size)},deleteTag:function(e,t){if(t)return this._tagHelper.removeMarkerInGroup(e,t),!1;for(var i=this.getTags(),n=0,o=i.length;n<o;n++){var s=i[n];if(s.userId==e)return this._tagHelper.deleteMarker(s),!1}},destroy:function(){this._viewer.removeCallbacks("render",this._renderCallback),this._tagHelper.markerClickCallback=null,this.unLoadTags(),this._tagHelper.clearMarkers(),this._tagHelper=null},loadTags:function(e){this._tagHelper.loadMarkers(e)},unLoadTags:function(){this._tagHelper.unloadMarkers()},getTags:function(){return this._tagHelper.getMarkerInfoList()},getTagById:function(e){return this._tagHelper.getMarker(e)},zoomToSelectedTag:function(){this._tagHelper.zoomToSelectedMarkers()},resize:function(){this._tagHelper.onResize()},onSelected:function(e){this._tagHelper.setMarkerClickCallback(e)}},e.Tag=t}();class DimensionEventControl{constructor(e,t,i){this.viewer=e,this.domContainer=t,this.dimensionItems=i,this.selectedItem=null,this.isEnableSelection=!0,this.offset=t.getBoundingClientRect(),Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.hookEvents()}hookEvents(){this.domContainer.addEventListener("mousemove",(e=>{if(!this.isEnableSelection)return;let t=new Vector2(e.clientX,e.clientY);this.viewer.isFullScreen||(t.x-=this.offset.left,t.y-=this.offset.top),this.hitTest(t)?(this.domContainer.style.cursor="pointer",e.preventDefault(),e.stopPropagation()):this.domContainer.style.cursor=""}),!1),this.domContainer.addEventListener("mousedown",(e=>{if(!this.isEnableSelection)return;let t=new Vector2(e.clientX,e.clientY);this.viewer.isFullScreen||(t.x-=this.offset.left,t.y-=this.offset.top);let i=this.hitTest(t);i?(i.getIsSelected()?(this.setSelectedItem(null),i.unselect()):(this.setSelectedItem(i),i.select()),i&&e.altKey&&console.info(Object.assign({},i.content,{id:i.id})),e.preventDefault(),e.stopPropagation()):this.setSelectedItem(null)}),!1),this.domContainer.addEventListener("dblclick",(e=>{if(!this.isEnableSelection)return;let t=new Vector2(e.clientX,e.clientY);this.viewer.isFullScreen||(t.x-=this.offset.left,t.y-=this.offset.top),this.hitTest(t)&&(e.preventDefault(),e.stopPropagation())}),!1)}hitTest(e){for(var t=this.dimensionItems.length-1;t>=0;t--){let i=this.dimensionItems[t];if(i.getNotation().hitTest(e))return i}for(t=this.dimensionItems.length-1;t>=0;t--){let i=this.dimensionItems[t];if(i.hitTest(e))return i}return null}setSelectedItem(e){this.selectedItem&&(this.selectedItem.actionWhenUnselected(),this.selectedItem.unselect()),this.selectedItem=e,e&&e.actionWhenSelected()}getSelectedItem(){return this.selectedItem}hasSelected(){return null!==this.selectedItem}setIsEnableSelection(e){this.isEnableSelection=e}}!function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Dimension");e.DimensionContainerConfig=class{constructor(){this.viewer=null,this.contents=[]}}}();class DimensionUtil{}DimensionUtil.xmlns="http://www.w3.org/2000/svg",DimensionUtil.makeCircle=function(e){var t=document.createElementNS(DimensionUtil.xmlns,"circle");return t.style.fill=e.color,t.setAttribute("r",e.radius+""),t.setAttribute("stroke","#FFFFFF"),t.setAttribute("stroke-width",e.strokeWidth),t.setAttribute("transform","translate("+e.position.x+","+e.position.y+")"),t},DimensionUtil.makeConcentricCircle=function(e){var t=document.createElementNS(DimensionUtil.xmlns,"g"),i=document.createElementNS(DimensionUtil.xmlns,"circle");i.style.fill=e.color,i.setAttribute("r",e.innerRadius+""),i.setAttribute("stroke","#FFFFFF"),i.setAttribute("stroke-width",e.innerStrokeWidth),i.setAttribute("transform","translate("+e.position.x+","+e.position.y+")");var n=i.cloneNode();return n.setAttribute("r",e.outerRadius+""),n.setAttribute("stroke-width",e.outerStrokeWidth||0),t.appendChild(n),t.appendChild(i),t},DimensionUtil.makeLine=function(e){var t=document.createElementNS(DimensionUtil.xmlns,"line");return t.setAttribute("stroke",e.color),t.setAttribute("stroke-width",e.lineWidth),t.setAttribute("x1",e.start.x+""),t.setAttribute("y1",e.start.y+""),t.setAttribute("x2",e.end.x+""),t.setAttribute("y2",e.end.y+""),t},DimensionUtil.makeRectangle=function(e){var t=document.createElementNS(DimensionUtil.xmlns,"rect");return t.setAttribute("stroke-width",2),t.setAttribute("x",e.x),t.setAttribute("y",e.y),t.setAttribute("width",e.width),t.setAttribute("height",e.height),t.setAttribute("rx",e.radius),t.style.fill=e.fillColor||"none",t.setAttribute("fill-opacity",e.fillOpacity||1),t.setAttribute("stroke",e.strokeColor||"none"),t},DimensionUtil.makeText=function(e){var t=document.createElementNS(DimensionUtil.xmlns,"text");t.setAttribute("x",e.x),t.setAttribute("y",e.y),t.setAttribute("fill",e.color||"#000"),t.setAttribute("font-size",e.fontsize);var i=e.content?e.content.split("\n"):[""];if(i.length>1)for(let o=0;o<i.length;o++){var n=document.createElementNS(DimensionUtil.xmlns,"tspan");n.setAttribute("x",e.x),n.setAttribute("y",e.y+30*o),n.textContent=i[o],t.appendChild(n)}else t.textContent=i[0];return t},DimensionUtil.measureText=function(e,t='14px "Microsoft YaHei'){var i=document.createElement("canvas").getContext("2d");return i.font=t,i.measureText(e).width},DimensionUtil.distanceToSegment=function(e,t,i){var n=t.distanceToSquared(i);if(0==n)return e.distanceTo(t);var o=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/n;o=Math.max(0,Math.min(1,o));let s=new Vector2;return s.x=t.x+o*(i.x-t.x),s.y=t.y+o*(i.y-t.y),e.distanceTo(s)};class DimensionNotation{constructor(e){this.type=e}initialize(){this.notationSelected=[],this.notationUnselected=[],this.notationSegmentRects=[]}drawAnnotation(e,t){}calcAnnotationStyle(e,t){}select(){this.isInitialized()&&(this.notationUnselected.forEach((e=>{e.style.display="none"})),this.notationSelected.forEach((e=>{e.style.display="block"})))}unselect(){this.isInitialized()&&(this.notationUnselected.forEach((e=>{e.style.display="block"})),this.notationSelected.forEach((e=>{e.style.display="none"})))}dropShadow(e){this.isInitialized()&&this.notationUnselected.forEach((t=>{t.setAttribute("filter",e),t.setAttribute("filter",e)}))}isInitialized(){return!!this.notationUnselected&&!!this.notationSelected}clear(){this.notationSelected=[],this.notationUnselected=[],this.notationSegmentRects=[]}hitTest(e){if(!this.isInitialized())return!1;let t=this.hitTestEpsilon;return this.notationSegmentRects.some((i=>DimensionUtil.distanceToSegment(e,i.start,i.end)<=t))}}class DimensionViewer3dNotation extends DimensionNotation{constructor(e){super(e),this.defaultColor="#F99D0B",this.defaultOpacity=1,this.initialize()}initialize(){super.initialize(),this.annotationStyle={height:21,radius:4},this.hitTestEpsilon=this.annotationStyle.height/2}drawAnnotation(e,t,i,n,o){var s=this.calcAnnotationStyle(t,e),r=DimensionUtil.makeRectangle({x:s.offsetRect.x,y:s.offsetRect.y,width:s.width,height:this.annotationStyle.height,radius:this.annotationStyle.radius,fillColor:n||this.defaultColor,fillOpacity:o||this.defaultOpacity});this.notationUnselected.push(r);let a=DimensionUtil.makeRectangle({x:s.offsetRect.x-2,y:s.offsetRect.y-2,width:s.width+4,height:this.annotationStyle.height+4,radius:this.annotationStyle.radius,strokeColor:"#FFFFFF",fillColor:n||this.defaultColor,fillOpacity:o||this.defaultOpacity});this.notationSelected.push(a);let l=new Vector2(s.offsetRect.x,s.offsetRect.y+this.annotationStyle.height/2),h=new Vector2(s.offsetRect.x+s.width,l.y);this.notationSegmentRects.push({start:l,end:h});var d=DimensionUtil.makeText({x:s.offsetText.x,y:s.offsetText.y,color:"#FFFFFF",fontsize:14,content:t});return this.svgGroup=[],this.svgGroup.push(r),this.svgGroup.push(a),this.svgGroup.push(d),this.unselect(),this.svgGroup}calcAnnotationStyle(e,t){var i=0,n=new Vector2(t.x,t.y),o=new Vector2(t.x,t.y);return i=DimensionUtil.measureText(e),n.x-=i/2,n.y-=this.annotationStyle.height/2,o.x=n.x+5,o.y=n.y+19-3.5,{offsetRect:n,offsetText:o,width:i+=10}}}!function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Dimension");e.DrawableItem=class{constructor(e){this.viewer=e.viewer,this.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),e.color&&(e.color instanceof Glodon$1.Web.Graphics.Color||(console.log("ERROR::color should be instance of Glodon.Web.Graphics.Color"),e.color=null)),this.defaultColor=e.color?"#"+e.color.getHEX():"#F99D0B",this.defaultOpacity=e.color?e.color.getAlpha():1,this.isShow=!0,this.svgGroup=[],this.lineWidth="3",this.radius=5,this.strokeWidth=2,this.hitTestEpsilon=10,this.hitTestSegments=[],this.selectElements=[],this.unSelectElements=[],this.isSelected=!0,this.notation=new DimensionViewer3dNotation(this.type),this.unitObj={Kilometer:"km",Meter:"m",Centimeter:"cm",Millimeter:"mm"}}getSvgGroup(){return this.svgGroup}getId(){return this.id}getType(){return this.type}clear(){this.detach(),this.notation.clear(),this.svgGroup=[],this.hitTestSegments=[]}detach(){for(const t of this.svgGroup){var e=t.parentNode;e&&e.removeChild(t)}}attach(e){for(const t of this.svgGroup)e.appendChild(t)}calcLine(e,t){let i=[];this.viewer.getViewer();var n=this.viewer.getDomElement().getBoundingClientRect(),o=this.viewer.viewerAdapter.worldPointsToClient(e,t);if(o){e=new Vector2(o.start.x-n.left,o.start.y-n.top),t=new Vector2(o.end.x-n.left,o.end.y-n.top);i.push(e,t)}return i}calcTerminalLines(e,t,i){if(0===e.length)return[];let n=[],o=e[0],s=e[1],r=o.clone().sub(s).normalize(),a=r.clone().multiplyScalar(i).add(o).rotateAround(o.clone(),t),l=r.clone().multiplyScalar(i).add(o).rotateAround(o.clone(),-t);n.push({start:a,end:l}),r=r.multiplyScalar(-1);let h=r.clone().multiplyScalar(i).add(s).rotateAround(s.clone(),t),d=r.clone().multiplyScalar(i).add(s).rotateAround(s.clone(),-t);return n.push({start:h,end:d}),n}select(){for(const e of this.selectElements)e.style.display="none";for(const e of this.unSelectElements)e.style.display="block";this.notation.select(),this.isSelected=!0}unselect(){for(const e of this.selectElements)e.style.display="block";for(const e of this.unSelectElements)e.style.display="none";this.notation.unselect(),this.isSelected=!1}getIsSelected(){return this.isSelected}actionWhenSelected(){}actionWhenUnselected(){}dropShadow(e){this.notation.dropShadow(e)}show(){for(const e of this.svgGroup)e.style.display="block";this.isSelected?this.select():this.unselect(),this.isShow=!0}hide(){for(const e of this.svgGroup)e.style.display="none";this.isShow=!1}getNotation(){return this.notation}hitTest(e){let t=this.hitTestEpsilon;for(let i=0;i<this.hitTestSegments.length-1;i++){if(DimensionUtil.distanceToSegment(e,this.hitTestSegments[i],this.hitTestSegments[i+1])<=t)return!0}return!1}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Dimension");e.LinearConfig=class{constructor(){this.color=null,this.viewer=null}}}(),function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Dimension"),t=Glodon$1.Bimface.Plugins.Dimension.DrawableItem;e.Linear=class extends t{constructor(e){super(e),this.viewer=e.viewer,this.color=e.color,this.type="Linear",this.selectElements=[],this.unSelectElements=[],skipVueObserver(this)}initialize(){if(!this.worldPositions)return;let e=this.calcLine(this.viewer.globalUnitUtil.excute(this.worldPositions[0],this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]),this.viewer.globalUnitUtil.excute(this.worldPositions[1],this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]));this.hitTestSegments=e;let t=this.calAuxLines(),i=this.calcTerminalLines(e,Math.PI/2,6.5);this.attachSingleLine(e),this.attachTerminalLines(i),this.attachTerminalPoints([t[0].start,t[2].end]);let n={x:(this.worldPositions[0].x+this.worldPositions[1].x)/2,y:(this.worldPositions[0].y+this.worldPositions[1].y)/2,z:(this.worldPositions[0].z+this.worldPositions[1].z)/2},o=this.viewer.worldToClient(this.viewer.globalUnitUtil.excute(n,this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]));this.viewer.isInViewFrustum(this.viewer.globalUnitUtil.excute(n,this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]))&&(this.attachNotation([o,o]),this.unselect())}attachTerminalPoints(e){for(const t of e){let e=DimensionUtil.makeCircle({position:t,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(e),this.unSelectElements.push(e)}}attachSingleLine(e){if(0===e.length)return;let t=DimensionUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(t)}attachTerminalLines(e){if(0!==e.length)for(let t=0;t<2;t++){let i=DimensionUtil.makeLine({start:e[t].start,end:e[t].end,color:this.defaultColor,lineWidth:2});this.selectElements.push(i),this.svgGroup.push(i)}}attachAuxLines(e,t){let i=0;for(const n of e){let e=DimensionUtil.makeLine({start:n.start,end:n.end,color:this.defaultColor,lineWidth:this.lineWidth});e.setAttribute("stroke-dasharray","6,4"),e.style.stroke=t[i++],this.unSelectElements.push(e),this.svgGroup.push(e)}}attachNotation(e){if(0===e.length)return;let t=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},this.showText,this.id,this.defaultColor,this.defaultOpacity);for(const e of t)this.svgGroup.push(e)}calAuxLines(){let e=this.worldPositions;for(var t=this.viewer.getDomElement().getBoundingClientRect(),i={x:e[1].x,y:e[0].y,z:e[0].z},n={x:e[1].x,y:e[1].y,z:e[0].z},o=[],s=[this.viewer.globalUnitUtil.excute(e[0],this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]),this.viewer.globalUnitUtil.excute(i,this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]),this.viewer.globalUnitUtil.excute(n,this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"]),this.viewer.globalUnitUtil.excute(e[1],this.pointUnit,this.viewer.getGlobalUnit(),["x","y","z"])],r=0;r<s.length-1;r++){var a=this.viewer.viewerAdapter.worldPointsToClient(s[r],s[r+1]);if(a)a.start.x-=t.left,a.start.y-=t.top,a.end.x-=t.left,a.end.y-=t.top;else{a={start:{x:-1,y:-1},end:{x:-1,y:-1}}}o.push(a)}return o}show(){super.show()}hide(){super.hide()}setContent(e){this.content=e,this.pointUnit=e.dimension.pointUnit,this.unit=e.dimension.unit,this.worldPositions=e.dimension.points,this.showText=e.dimension.text?e.dimension.text+"":e.dimension.distance+""||"",this.initialize()}getItemId(){return this.id}}}(),function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Dimension"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.DimensionContainer=class{constructor(e){var i,n,o=e.viewer;o&&(skipVueObserver(this),this.viewer=o,this._items=[],o.getDomElement().getElementsByClassName("bf-drawable-context").length>0?(i=o.getDomElement().getElementsByClassName("bf-drawable-context")[0]).getElementsByClassName("bf-drawable-svg").length>0?n=i.getElementsByClassName("bf-drawable-svg")[0]:(n=t.createNS("svg","bf-drawable-svg"),i.appendChild(n)):(i=t.create("div","bf-drawable-context"),n=t.createNS("svg","bf-drawable-svg"),o.getDomElement().appendChild(i),i.appendChild(n)),this.eventControl=new DimensionEventControl(o,n,this._items),this.context={rootDomElement:i,dimensionContainer:n},this.dimensionContainer=n,this.id="Dimension",this.viewer.addEventListener("Rendered",(()=>{this.update()})),this.viewer.render(),e.contents&&e.contents.length>0&&this.initDimensions(e.contents))}initDimensions(e){e.map((e=>{if("Distance"==e.dimension.type){let t=new Glodon$1.Bimface.Plugins.Dimension.LinearConfig;t.viewer=this.viewer;let i=new Glodon$1.Bimface.Plugins.Dimension.Linear(t);i.setContent(e),this.addItem(i)}}))}addItem(e){this._items.push(e),e.attach(this.dimensionContainer)}addItems(e){e.map((e=>this.addItem(e)))}getAllItems(){return this._items}getItemById(e){let t=null;return this._items.map((i=>{i.id!=e||(t=i)})),t}hideAllItems(){this._items.map((e=>e.hide()))}showAllItems(){this._items.map((e=>e.show()))}update(){this.remove();for(const e of this._items)e.initialize(),e.attach(this.dimensionContainer),!e.isShow&&e.hide();this.eventControl.hasSelected()&&(this.eventControl.getSelectedItem().select(),!this.eventControl.getSelectedItem().isShow&&this.eventControl.getSelectedItem().hide())}clear(){this.remove(),this._items=[]}remove(){for(const e of this._items)e.clear()}}}();class ExplosionHelper{constructor(){}}ExplosionHelper.ifExploded=function(e,t,i){let n="ViewerDrawing"===e.getViewerType(),o="ViewerDrawingSet"===e.getViewerType();if(n||o||t instanceof Glodon.Bimface.Plugins.Drawable.ClusterTag)return t;const s=e.getViewer();if(!s.modelManager)return t;const r=s.modelManager.explosionManager;let a=t.modelId;if(i&&t.layerId){const i=e.getLayerManager().getLayer(t.layerId);if(!i)return t;if("TileLayer"===i.typeName||"TilesetLayer"===i.typeName)return t;a=i.getModelId().toString()}else{if(i&&!t.layerId)return t;a||(a=e._defaultModel.modelId.toString())}t.modelId=a;const l=e.getModel(a).getFloorExplosionDirection(),h=r.getFloorInfos(a),d=s.modelManager.getModel(a).modelExplosion;let c=()=>{if(h&&r.isExploded(a)){let e=t.worldPosition||t.getOriginalPosition(),i=d.getExplosionTranslationByObjId(t.objectId);const n=r.getExplosionParam(a).explosionExtent;if(!t.objectId&&n>0&&(i=this.getCenterExplosionOffset(s,n,t,!0)),i.length()>0){const n={x:e.x-i.x,y:e.y-i.y,z:e.z-i.z};return t.explosionOffset={x:i.x,y:i.y,z:i.z},t.originalPosition?t.originalPosition=n:t.worldPosition=n,t}if(t.levelName){let i=this.getExplodedOffsetByLevelName(h,t.levelName);if(i){const n={x:e.x-i*l.x,y:e.y-i*l.y,z:e.z-i*l.z};t.explosionOffset={x:i*l.x,y:i*l.y,z:i*l.z},t.originalPosition?t.originalPosition=n:t.worldPosition=n}}else this.setDrawableOffsetByFloorInfos(h,t,l)}return t};if(t._config.objectId){let e=s.getComponentInfoByUserId(t._config.objectId);if(e)return t.levelName=e.userData&&e.userData.levelName,c();{if(i)return t;const e=s.modelManager.getModel("ExtrudeBodyManager");return e&&e.getNode(t._config.objectId)&&(t._isBindRoom=!0),t}}return c()},ExplosionHelper.getExplodedOffsetByLevelName=function(e,t){for(const i of e)if(i.name===t)return i.explodedHeight-i.elevation;return 0},ExplosionHelper.setDrawableOffsetByFloorInfos=function(e,t,i){let n=t.worldPosition||t.getOriginalPosition();for(const o of e){const e=o.explodedHeight-o.elevation,s=o.boundingBox;if(n.z-e<s.min.z&&n.z-e>s.max.z)continue;t.levelName=o.name;const r={x:n.x-e*i.x,y:n.y-e*i.y,z:n.z-e*i.z};t.originalPosition?t.originalPosition=r:t.worldPosition=r,t.explosionOffset={x:i.x*e,y:i.y*e,z:i.z*e}}},ExplosionHelper.attachExplosionOffset=function(e,t,i){let n=e.getViewer();if(!i.worldPosition&&!i.position)return;const o=i._config.objectId;let s=null;if(o){s=n.modelManager.getModel(i.modelId).modelExplosion.getExplosionTranslationByObjId(o),i.explosionOffset.x+=s.x,i.explosionOffset.y+=s.y,i.explosionOffset.z+=s.z}else s=this.getCenterExplosionOffset(n,t,i),i.explosionOffset.x=s.x,i.explosionOffset.y=s.y,i.explosionOffset.z=s.z;i.explosionOffset=t?e.globalUnitUtil.revertTranslate(i.explosionOffset,["x","y","z"]):{x:0,y:0,z:0}},ExplosionHelper.getCenterExplosionOffset=function(e,t,i,n){this.scratchVector=new THREE.Vector3,e.getScene().getOriginalBoundingBoxWorld().getCenter(this.scratchVector);const o=(new THREE.Box3).expandByPoint(i.worldPosition||i.getOriginalPosition());return!0===n?CLOUD.Utils.computeAfterExplodeTranslation(this.scratchVector,o,t):CLOUD.Utils.computeExplodeTranslation(this.scratchVector,o,t)},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable").DrawableContainerConfig=function(){return{viewer:null,maxNum:20,affectedBySection:!0,enableRender:!0}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable").DrawableItemConfig=function(){return{id:null,objectId:null,modelId:null,tooltip:"",tooltipStyle:{},draggable:!1,worldPosition:new Glodon$1.Web.Geometry.Point3d(0,0,0),angle:0,layerId:void 0}},function(){var e="Bimface.Plugins.Drawable.DrawableItem",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Common.MouseButton,function(e){this.id=e.id||Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.layerId=e.layerId,this.modelId=e.modelId,this.objectId=e.objectId,e.worldPosition?this.worldPosition=e.worldPosition:console.log("worldPosition must not be empty."),null!=e.viewerDrawingId&&(this.viewerDrawingId=e.viewerDrawingId),this.config=e,this.angle=e.angle,this.explosionOffset=new Vector3,this.explosionExtent=0,this._enableDepthTest=e.enableDepthTest,this._isCover=!1,this._enableDepthTestCallback=null,skipVueObserver(this)});n.prototype={draw:function(e){},onClick:function(i){t.send(e,"onClick"),this._onclick=i},onDoubleClick:function(i){t.send(e,"onClick"),this._doubleClick=i},onRightClick:function(i){t.send(e,"onRightClick"),this._onrightclick=i},onEndDrag:function(i){t.send(e,"onEndDrag"),this._onenddrag=i},setTooltip:function(i){t.send(e,"setTooltip"),this.tipElement.querySelector("span").innerText=i},setTooltipStyle:function(i){for(var n in t.send(e,"setTooltipStyle"),i)this.tipElement.style[n]=i[n],"backgroundColor"===n&&(this.tipElement.childNodes[0].childNodes[0].style.borderTopColor=i[n])},getTooltip:function(){return this.tipElement.querySelector("span").innerText},getTooltipStyle:function(){return this.tipElement.style},getWorldPosition:function(){return this.worldPosition},setWorldPosition:function(i){t.send(e,"setWorldPosition"),this.worldPosition=i},getSize:function(){return{width:this.config.width,height:this.config.height}},hide:function(){t.send(e,"hide"),this._domElement.style.display="none",this.notControlByCameraPosition=!0,this.forceHide=!0},hideByCameraPosition:function(){this.notControlByCameraPosition||(this._domElement.style.display="none",this.forceHide=!0)},show:function(){t.send(e,"show"),this.notControlByCameraPosition=!1,this.visibleDistance?this.viewer.drawableContainer.showOrHideLabelForCamearPosition():(this._domElement.style.display="",this.forceHide=!1)},showByCameraPosition:function(){this.forceHide&&(this.notControlByCameraPosition||(this._domElement.style.display="",this.forceHide=!1))},updateVisibility:function(){this.isHideByClustering||this.forceHide?this._domElement.style.display="none":this._domElement.style.display="block"},attachExplosionOffset:function(e,t){if(!this.worldPosition)return;let i=this._config.objectId;if(i){let n=e.modelManager.getBoundingBoxByIds([i]),o=this.assoiatedComponentBbox,s=n;if(o){let e=s.getCenter().clone();e.sub(o.getCenter().clone()),this.explosionOffset=e,this.explosionExtent>0&&0===t&&(this.worldPosition.x+=e.x,this.worldPosition.y+=e.y,this.worldPosition.z+=e.z,this.explosionExtent=0,this.explosionOffset=new Vector3,this.assoiatedComponentBbox=s.clone())}}else{let i=e.getScene().getOriginalBoundingBoxWorld().getCenter(),n=(new Box3).expandByPoint(this.worldPosition),o=CLOUD.Utils.computeExplodeTranslation(i,n,t);this.explosionOffset=o}},setInitialExplosionInfo:function(e){if("Viewer3D"!==e.getViewerType()&&"ViewerGIS"!==e.getViewerType())return;let t=null;"Viewer3D"===e.getViewerType()?t=this.modelId?e.getModel(this.modelId):e.getDefaultModel():"ViewerGIS"===e.getViewerType()&&(t=e.getLayerManager().getLayer(this.layerId)||null),this.explosionExtent=null===t?0:t.getExplosionExtent();const i=this._config.objectId;if(!i)return;e.getViewer().modelManager.getBoundingBoxByIds([i]).isEmpty()&&(this._config.objectId=null,console.log("Cannot find component with Id "+i))},clearExplosionOffset:function(){this.explosionOffset=new Vector3},getCurrentPosition:function(){return{x:this.worldPosition.x+this.explosionOffset.x,y:this.worldPosition.y+this.explosionOffset.y,z:this.worldPosition.z+this.explosionOffset.z}},getId:function(){return this.id},handleEnableDepthTest(e){if(!this._enableDepthTest||!this.viewer)return;if("Viewer3D"!==this.viewer.getViewerType()&&"ViewerGIS"!==this.viewer.getViewerType())return;if("LeadLabel"==this.name&&this._modelId&&this._objectId&&"Viewer3D"==this.viewer.getViewerType()){this.update&&this.update();let e=this.viewer.getModel(this._modelId).getComponentStatus(this._objectId);if("hidden"==e||"translucent"==e)return void(this._isCover=!1)}!e&&(e=this.viewer.getCameraStatus().position);let t=new THREE.Vector3(...Object.values(e)),i=new THREE.Vector3(...Object.values(this.worldPosition));const n=i.clone().sub(t).normalize(),o=this.viewer.getComponentsByRaycaster(t,n,[]);let s=o.length>0?o[0].distance:i.clone().sub(t).length(),r=1;switch(this.viewer.getUnit()){case Glodon$1.Bimface.Common.Units.LengthUnits.Kilometer:r=1e-6;break;case Glodon$1.Bimface.Common.Units.LengthUnits.Meter:r=.001;break;case Glodon$1.Bimface.Common.Units.LengthUnits.Centimeter:r=.1;break;case Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter:r=1}let a=i.clone().sub(t).length()>=s+r;this._isCover!=a&&this._enableDepthTestCallback&&this._enableDepthTestCallback(a),this._isCover=a},enableDepthTest:function(e){this._enableDepthTest=e,this.handleEnableDepthTest()},isDepthTestEnabled:function(){return this._enableDepthTest},onObstructionChanged:function(e){this._enableDepthTestCallback=e,this._enableDepthTest&&(this.handleEnableDepthTest(),e(this._isCover))}},i.DrawableItem=n}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=function(){this.rootDomElement=t.create("div","bf-drawable-context"),this.clientPosition=null};i.prototype.destroy=function(){this.rootDomElement.parentNode&&this.rootDomElement.parentNode.removeChild(this.rootDomElement)},e.DrawableContext=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=new Glodon$1.Bimface.Plugins.Drawable.DrawableItemConfig;e.ImageConfig=function(){let e={width:32,height:32,viewer:null,opacity:.75,src:null,offsetX:0,offsetY:0,modelId:void 0,layerId:void 0,objectId:void 0,visibleDistance:null,enableDepthTest:!1};return Object.assign({},t,e)}}(),function(){var e="Bimface.Plugins.Drawable.Image",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=Glodon$1.Bimface.Plugins.Drawable.DrawableItem,o=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),s=function(e){n.call(this,e);let t=this;this._isDragging=!1;let i=o.create("div","bf-drawable-text"),s=o.create("img","bf-drawable-image");i.draggable=!1,s.src=e.src,s.style.width=`${e.width}px`,s.style.height=`${e.height}px`,s.style.opacity=`${e.opacity}`,s.style.transform=`rotate(${e.angle}deg)`,i.appendChild(s),this._config=e,this._domElement=i,this._imgElement=s;let r=o.create("div","bf-tooltip tooltipTop");r.style.display="none",r.innerHTML=`<div class="bf-tooltip-content"><div class="bf-tooltip-arrow"></div><div class="bf-tooltip-inner"><span>${e.tooltip}</span></div></div>`,r.style.left=`${e.tooltipStyle.left}`,r.style.top=`${e.tooltipStyle.top}`;var a,l=e.tooltipStyle;this.tipElement=r,this.setTooltipStyle(l),i.appendChild(r),this.clientPosition={},this.visibleDistance=e.visibleDistance;e.draggable&&o.drag({element:i,cursor:"pointer",end:function(e){t._isDragging=!1;var i,n=t.viewer,o="Viewer3D"===n.getViewerType(),s="ViewerGIS"===n.getViewerType(),r={x:e.x-a.x+t.clientPosition.x,y:e.y-a.y+t.clientPosition.y};if(o){var l=n.pickByPoint(r);if(!l||!l.objectId)return void t.update();if(l.objectId){t._config.objectId=l.objectId;let e=n.getViewer().getComponentInfoByUserId(l.objectId);t.levelName=e&&e.userData&&e.userData.levelName,t.setInitialExplosionInfo(n),t.clearExplosionOffset(),t.needForceUpdate=!0}i=l.worldPosition}else if(s){let e=n.getDomElement().getBoundingClientRect(),o=n.getViewer().pickByPoint({x:r.x+e.left,y:r.y+e.top});if(!o||!o.meshId)return void t.update();o.meshId&&(t._config.objectId=o.meshId),i=o.worldPosition}else i=n.clientToWorld(r);i?(t.worldPosition=i,t.update(),t._onenddrag&&t._onenddrag(t)):t.update()},start:function(e){a=e},move:function(){t._isDragging=!0}}),i.addEventListener("mouseup",(function(e){var i=e||window.event;"0"==i.button&&t._onclick&&(!t._isDragging||a.x==i.clientX&&a.y==i.clientY)&&(t.clickTimerId&&clearTimeout(t.clickTimerId),t.clickTimerId=setTimeout((()=>{t.event=i,t._onclick(t),delete t.event}),500))})),i.addEventListener("mousedown",(function(e){var i=e||window.event;i.stopPropagation(),"2"==i.button&&t._onrightclick?t._onrightclick(t):"1"==i.button&&t._onmiddleclick&&t._onmiddleclick(t)})),i.addEventListener("mouseover",(function(e){r&&r.querySelector("span").innerText.length>0&&(r.style.display="block")})),i.addEventListener("mouseout",(function(e){t.tipElement&&(t.tipElement.style.display="none")})),i.addEventListener("dblclick",(function(e){(e=e||event).stopPropagation(),t._doubleClick&&t._doubleClick(t),t.clickTimerId&&clearTimeout(t.clickTimerId)}))};Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility").Type.inheritPrototype(s,n);!function(e,t){var i=t.prototype;for(var n in e)i[n]=e[n]}({draw:function(e){if(!this._isDragging){var t=this._domElement,i=this._config;this.clientPosition=e.clientPosition,t.style.left=e.clientPosition.x+i.offsetX-i.width/2+"px",t.style.top=e.clientPosition.y+i.offsetY-i.height/2+"px",e.rootDomElement.contains&&e.rootDomElement.contains(t)||e.rootDomElement.appendChild(t)}},getWidth:function(){return this._config.width},setWidth:function(i){t.send(e,"setWidth");var n=this._config.width,o=this._imgElement,s=(n-i)/2,r=parseInt(o.style.left);this._config.width=i,o.style.width=`${i}px`,o.style.left=`${r+s}px`},getHeight:function(){return this._config.height},setHeight:function(i){t.send(e,"setHeight");var n=this._config.height,o=this._imgElement,s=(n-i)/2,r=parseInt(o.style.top);this._config.height=i,o.style.height=`${i}px`,o.style.top=`${r+s}px`},getOpacity:function(){return this._config.opacity},setOpacity:function(i){t.send(e,"setOpacity"),this._config.opacity=i,this._imgElement.style.opacity=i},getSrc:function(){return this._config.src},setSrc:function(i){t.send(e,"setSrc"),this._config.src=i,this._imgElement.src=i},getOffsetX:function(){return this._config.offsetX},setOffsetX:function(i){t.send(e,"setOffsetX");var n=this._config.offsetX,o=this._domElement,s=i-n,r=parseInt(o.style.left);this._config.offsetX=i,o.style.left=`${r+s}px`},getOffsetY:function(){return this._config.offsetY},setOffsetY:function(i){t.send(e,"setOffsetY");var n=this._config.offsetY,o=this._domElement,s=i-n,r=parseInt(o.style.top);this._config.offsetY=i,o.style.top=`${r+s}px`},getAngle:function(){return this.angle},setAngle:function(i){t.send(e,"setAngle"),this.angle=i,this._imgElement.style.transform=`rotate(${i}deg)`},getVisibleDistance:function(){return this.visibleDistance},setVisibleDistance:function(e){this.visibleDistance="number"!=typeof e?Number.POSITIVE_INFINITY:e,this.viewer.drawableContainer.showOrHideLabelForCamearPosition()},enableDepthTest:function(e){n.prototype.enableDepthTest.call(this,e)},isDepthTestEnabled:function(){return n.prototype.isDepthTestEnabled.call(this)},onObstructionChanged:function(e){n.prototype.onObstructionChanged.call(this,e)}},s),i.Image=s}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=new Glodon$1.Bimface.Plugins.Drawable.DrawableItemConfig;e.CustomItemConfig=function(){let e={width:0,height:0,opacity:.75,content:"",offsetX:0,offsetY:0,viewer:null,modelId:void 0,layerId:void 0,objectId:void 0,visibleDistance:null,enableDepthTest:!1};return Object.assign({},t,e)}}(),function(){var e="Bimface.Plugins.Drawable.CustomItem",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),o=Glodon$1.Bimface.Plugins.Drawable.DrawableItem,s=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),r=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility");n.IE11Store={};let a=function(e){o.call(this,e),this._isDragging=!1;let t=this,i=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop(),n=s.create("div","bf-drawable-text");n.style.width=`${e.width}px`,n.style.height=`${e.height}px`;let r=s.create("div","bf-drawable-contentwrap");var a;n.appendChild(r),this._domElement=n,this.name="customItem",this._contentElement=r,this._config=e,this.clientPosition={},this.visibleDistance=e.visibleDistance,this.setContent(e.content);let l=s.create("div","bf-tooltip");l.style.display="none",l.innerHTML=`<div class="bf-tooltip-content"><div class="bf-tooltip-arrow"></div><div class="bf-tooltip-inner"><span>${e.tooltip}</span></div></div>`,l.style.left=`${e.width}px`,l.style.top=`-${e.height}px`;var h=e.tooltipStyle;this.tipElement=l,this.setTooltipStyle(h),n.appendChild(l);e.draggable&&s.drag({element:n,cursor:"pointer",end:function(e){t._isDragging=!1;var i=t.viewer,n=Glodon$1.Bimface.Viewer.Viewer3D&&"Viewer3D"===i.viewerType,o=Glodon$1.Bimface.Viewer.ViewerGIS&&i instanceof Glodon$1.Bimface.Viewer.ViewerGIS;const s=Glodon$1.Bimface.Viewer.ViewerDrawing&&i instanceof Glodon$1.Bimface.Viewer.ViewerDrawing;var r,l={x:e.x-a.x+t.clientPosition.x,y:e.y-a.y+t.clientPosition.y};if(n){let e=i.getDomElement().getBoundingClientRect(),n=i.pickByPoint({x:l.x+e.left,y:l.y+e.top});if(!n||!n.objectId)return void t.update();if(n.objectId){t._config.objectId=n.objectId;let e=i.getViewer().getComponentInfoByUserId(n.objectId);t.levelName=e&&e.userData&&e.userData.levelName,t.setInitialExplosionInfo(i),t.clearExplosionOffset(),t.needForceUpdate=!0}r=n.worldPosition}else if(o){let e=i.getDomElement().getBoundingClientRect(),n=i.getViewer().pickByPoint({x:l.x+e.left,y:l.y+e.top});if(!n||!n.meshId)return void t.update();n.meshId&&(t._config.objectId=n.meshId),r=n.worldPosition}else if(s){var h=i.getViewer().toWorldPoint([l.x,l.y]);r={x:h[0],y:h[1]}}else r=i.clientToWorld(l);r?(t.worldPosition=r,t.update(),t._onenddrag&&t._onenddrag(t)):t.update()},start:function(e){a=e},move:function(){t._isDragging=!0}}),n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,n.style.opacity=`${e.opacity}`,n.addEventListener("mouseover",(function(e){t.tipElement&&t.tipElement.querySelector("span").innerText.length>0&&(t.tipElement.style.display="block")})),n.addEventListener("mouseout",(function(e){t.tipElement&&(t.tipElement.style.display="none")})),n.addEventListener("keydown",(function(e){e.stopPropagation()})),i&&n.addEventListener("mouseup",(function(e){var i=e||window.event;"0"==i.button&&t._onclick&&(!t._isDragging||a.x==i.clientX&&a.y==i.clientY)&&(t.clickTimerId&&clearTimeout(t.clickTimerId),t.clickTimerId=setTimeout((()=>{t.event=i,t._onclick(t),delete t.event}),500))})),n.addEventListener("mousedown",(function(e){var i=e||window.event;i.stopPropagation(),"2"==i.button&&t._onrightclick?t._onrightclick(t):"1"==i.button&&t._onmiddleclick&&t._onmiddleclick(t)})),n.addEventListener("dblclick",(function(e){(e=e||event).stopPropagation(),t._doubleClick&&t._doubleClick(t),t.clickTimerId&&clearTimeout(t.clickTimerId)})),n.addEventListener("touchstart",(function(e){(e||window.event).stopPropagation()})),n.addEventListener("touchmove",(function(e){(e||window.event).stopPropagation()})),!i&&n.addEventListener("touchend",(function(i){var n=i||window.event;n.stopPropagation(),t._onclick&&(!e.draggable||a.x==n.changedTouches[0].clientX&&a.y==n.changedTouches[0].clientY)&&t._onclick(t)}))};r.Type.inheritPrototype(a,o);!function(e,t){var i=t.prototype;for(var n in e)i[n]=e[n]}({draw:function(e){if(!this._isDragging){var t=this._domElement,i=this._config;this.clientPosition=e.clientPosition,t.style.left=e.clientPosition.x+i.offsetX-i.width/2+"px",t.style.top=e.clientPosition.y+i.offsetY-i.height/2+"px",""==t.innerHTML&&(this.dom&&this.domId?t.appendChild(n.IE11Store[this.domId].cloneNode(!0)):this.text&&(t.innerText=this.text)),e.rootDomElement.contains&&e.rootDomElement.contains(t)||e.rootDomElement.appendChild(t)}},getWidth:function(){return this._config.width},setWidth:function(i){t.send(e,"setWidth");var n=this._config.width,o=this._domElement,s=(n-i)/2,r=parseInt(o.style.left);this._config.width=i,o.style.width=`${i}px`,o.style.left=`${r+s}px`},getHeight:function(){return this._config.height},setHeight:function(i){t.send(e,"setHeight");var n=this._config.height,o=this._domElement,s=(n-i)/2,r=parseInt(o.style.top);this._config.height=i,o.style.height=`${i}px`,o.style.top=`${r+s}px`},getOpacity:function(){return this._config.opacity},setOpacity:function(i){t.send(e,"setOpacity"),this._config.opacity=i,this._domElement.style.opacity=i},getContent:function(){return this._config.content||this.text},setContent:function(i){t.send(e,"setContent"),this._contentElement.innerHTML="",i instanceof HTMLElement?(i.draggable=!1,this._config.content=i,this._domElement.content=i,this.dom=i,this.domId||(this.domId=Glodon$1.Web.Lang.Utility.UUID.createUUID()),n.IE11Store[this.domId]=i.cloneNode(!0),this._contentElement.appendChild(i)):(this._contentElement.innerHTML=i,this.text=i,this._config.content="")},getOffsetX:function(){return this._config.offsetX},setOffsetX:function(i){t.send(e,"setOffsetX");var n=this._config.offsetX,o=this._domElement,s=i-n,r=parseInt(o.style.left);this._config.offsetX=i,o.style.left=`${r+s}px`},getOffsetY:function(){return this._config.offsetY},setOffsetY:function(i){t.send(e,"setOffsetY");var n=this._config.offsetY,o=this._domElement,s=i-n,r=parseInt(o.style.top);this._config.offsetY=i,o.style.top=`${r+s}px`},getVisibleDistance:function(){return this.visibleDistance},setVisibleDistance:function(e){this.visibleDistance="number"!=typeof e?Number.POSITIVE_INFINITY:e,this.viewer.drawableContainer.showOrHideLabelForCamearPosition()},enableDepthTest:function(e){o.prototype.enableDepthTest.call(this,e)},isDepthTestEnabled:function(){return o.prototype.isDepthTestEnabled.call(this)},onObstructionChanged:function(e){o.prototype.onObstructionChanged.call(this,e)},resetClientPosition:function(e){const t=this._domElement,i=this._config;"Viewer3D"!==this.viewer.viewerType&&"ViewerGIS"!==this.viewer.viewerType||(e=this.viewer.worldToClient(e)),t.style.left=e.x+i.offsetX-i.width/2+"px",t.style.top=e.y+i.offsetY-i.height/2+"px"},getContainer:function(){return this._domElement},setContainerVisible(e){this._domElement.style.display=!0===e?"block":"none"}},a),i.CustomItem=a}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=new Glodon$1.Bimface.Plugins.Drawable.DrawableItemConfig;e.LeadLabelConfig=function(){let e={text:null,viewer:null,containerCss:{boxSizing:"border-box",fontSize:"12px",lineHeight:1.5,borderWidth:"2px",borderStyle:"solid",padding:"5px",borderColor:"#1f93ff",backgroundColor:"#eeeeee",padding:"2px 8px",opacity:.9},lineCss:{width:"2px",color:"#1f93ff"},pointCss:{radius:4,backgroundColor:"#1f93ff",borderColor:"#ffffff",borderStyle:"solid",borderWidth:"1px"},offset:{x:27,y:-47},height:26,width:140,modelId:void 0,layerId:void 0,objectId:void 0,visibleDistance:null,enableDepthTest:!1,style:{lineColor:new Glodon$1.Web.Graphics.Color(31,147,255,1),lineWidth:2,backgroundColor:new Glodon$1.Web.Graphics.Color(238,238,238,1),fontSize:12}};return Object.assign({},t,e)}}(),function(){var e="Bimface.Plugins.Drawable.LeadLabel",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=Glodon$1.Bimface.Plugins.Drawable.DrawableItem,o=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var s=function(e){n.call(this,e);let t=this,i=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop(),s=o.create("div","bf-drawable-lead-label"),r=o.create("div","bf-drawable-lead-label-textarea");s.appendChild(r);let a=o.createNS("line","bf-drawable-lead-line"),l=o.createNS("line","bf-drawable-lead-line"),h=o.createNS("circle","bf-drawable-lead-point"),d=o.createNS("g","bf-drawable-group");t._text=e.text,this.name="LeadLabel",this.isAssociateComponentHide=!1,this.visibleDistance=e.visibleDistance,s.setCss(e.containerCss),r.innerText=t._text.replace(/\n/g," ");let c=[s,a,l,h];this._labelCombination=c;let u=o.create("div","bf-tooltip");u.style.display="none",u.innerHTML=`<div class="bf-tooltip-content"><div class="bf-tooltip-arrow"></div><div class="bf-tooltip-inner"><span>${e.tooltip}</span></div></div>`,u.style.left="0px",u.style.top="0px",this.tipElement=u,this.setTooltipStyle(e.tooltipStyle),s.appendChild(u),s.style.width=parseFloat(e.width)+"px",s.style.minHeight=parseFloat(e.height)+"px";let p=Math.trunc((e.height-8)/18);var g;r.style.webkitLineClamp=p||1,l.setAttribute("stroke-width",e.lineCss.width),l.style.stroke=e.lineCss.color,a.setAttribute("stroke-width",e.lineCss.width),a.style.stroke=e.lineCss.color,h.setAttribute("r",e.pointCss.radius),h.style.fill=e.pointCss.backgroundColor,h.setAttribute("stroke-width",e.pointCss.borderWidth),h.style.stroke=e.pointCss.borderColor,l.setAttribute("x1",0),l.setAttribute("y1",0-e.offset.y+18),l.setAttribute("x2",e.offset.x),l.setAttribute("y2",18),a.setAttribute("x1",e.offset.x),a.setAttribute("y1",18),a.setAttribute("x2",e.offset.x+23),a.setAttribute("y2",18),h.setAttribute("cx",0),h.setAttribute("cy",18-e.offset.y),this.setStyle(e.style),this._isDragging=!1;e.draggable&&o.drag({element:s,cursor:"pointer",start:function(e){g=e},move:function(i){t._isDragging=!0;var n=i.x-g.x+t.clientPosition.x,o=i.y-g.y+t.clientPosition.y;d.setAttribute("transform",`translate(${n},${o+e.offset.y-18})`)},end:function(i){t._isDragging=!1;const n=e.viewer||t.viewer;var o="Viewer3D"===n.viewerType;this._isViewerGIS=Glodon$1.Bimface.Viewer.ViewerGIS&&n instanceof Glodon$1.Bimface.Viewer.ViewerGIS;var s=n.getDomElement().getBoundingClientRect(),r={x:i.x-g.x+t.clientPosition.x+s.left,y:i.y-g.y+t.clientPosition.y+s.top};if(o){var a=n.pickByPoint(r);if(a){if(t.setWorldPosition(a.worldPosition),t.bindComponentById(a.objectId,a.modelId),a.objectId){t._config.objectId=a.objectId,t._config.modelId=a.modelId;let e=n.getViewer().getComponentInfoByUserId(a.objectId,a.modelId);t.levelName=e&&e.userData&&e.userData.levelName,t.needForceUpdate=!0}t.setInitialExplosionInfo(n),t.clearExplosionOffset()}n.render()}else if(this._isViewerGIS){let e=n.getViewer().pickByPoint({x:r.x,y:r.y});if(!e||!e.meshId)return void t.update();e.meshId&&(t._config.objectId=e.meshId),t.worldPosition=e.worldPosition,t.setWorldPosition(e.worldPosition),t.update()}else{var l=n.clientToWorld(r);l&&t.setWorldPosition(l),n.update()}t._dragEnd&&t._dragEnd(t)}}),s.addEventListener("mousedown",(function(e){(e=e||event).stopPropagation()})),s.addEventListener("mouseover",(function(e){u&&u.querySelector("span").innerText.length>0&&(u.style.display="block")})),s.addEventListener("mouseout",(function(e){t.tipElement&&(t.tipElement.style.display="none")})),i&&s.addEventListener("click",(function(e){(e=e||event).stopPropagation(),t.clickTimerId&&clearTimeout(t.clickTimerId),t.clickTimerId=setTimeout((()=>{t._click&&(t.event=e,t._click(t),delete t.event)}),500)})),s.addEventListener("touchstart",(function(){(event||window.event).stopPropagation(),!i&&t._click&&t._click(t)})),s.addEventListener("contextmenu",(function(e){t._rightClick&&t._rightClick(t)})),s.addEventListener("dblclick",(function(e){(e=e||event).stopPropagation(),t._doubleClick&&t._doubleClick(t),t.clickTimerId&&clearTimeout(t.clickTimerId)})),s.addEventListener("mouseenter",(function(e){r.innerText=t._text;let i=s.offsetHeight;s.addClass("bf-drawable-show"),r.addClass("bf-drawable-show"),i>s.offsetHeight&&(s.removeClass("bf-drawable-show"),r.removeClass("bf-drawable-show"))})),s.addEventListener("mouseleave",(function(e){r.innerText=t._text.replace(/\n/g," "),s.removeClass("bf-drawable-show"),r.removeClass("bf-drawable-show")})),d.appendChild(l),d.appendChild(a),d.appendChild(h),t._objectId=e.objectId,t._modelId=e.modelId,t._container=s,t._domTextArea=r,t._svgGroup=d,t._config=e,t._offset=e.offset};Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility").Type.inheritPrototype(s,n),s.prototype=Object.assign({},n.prototype,{draw:function(e,t){if(!this._isDragging){this._isViewerGIS=Glodon$1.Bimface.Viewer.ViewerGIS&&this.viewer instanceof Glodon$1.Bimface.Viewer.ViewerGIS;var i=this._container,n=this._svgGroup,s=this._offset,r=this._config.viewer||this.viewer,a=this._objectId,l=this._modelId;if(r&&a&&!this._isViewerGIS){var h=r.getModel(l).getComponentStatus(a);if("hidden"==h||"translucent"==h)return this.hide(),void(this.isAssociateComponentHide=!0);this.isAssociateComponentHide&&(this.show(),this.isAssociateComponentHide=!1)}!0!==this.isHideByClustering?(this.clientPosition=e.clientPosition,i.style.left=`${e.clientPosition.x+s.x+23}px`,i.style.top=e.clientPosition.y+s.y-18+"px",n.setAttribute("transform",`translate(${e.clientPosition.x},${e.clientPosition.y+s.y-18})`),e.domContainer||(e.domContainer=o.create("div","bf-drawable-container"),e.rootDomElement.appendChild(e.domContainer)),e.svgContainer||(e.rootDomElement.getElementsByClassName("bf-drawable-svg").length>0?e.svgContainer=e.rootDomElement.getElementsByClassName("bf-drawable-svg")[0]:(e.svgContainer=o.createNS("svg","bf-drawable-svg"),e.rootDomElement.appendChild(e.svgContainer))),this.isShow("default"==t),e.rootDomElement.contains&&e.domContainer.contains(i)||(e.domContainer.appendChild(i),e.svgContainer.appendChild(n))):this.hide()}},setDisplayMode:function(e){this.show(),this.displayMode=e,this.isShow()},hide:function(){t.send(e,"hide"),this.forceHide=!0,this.notControlByCameraPosition=!0,this._container.style.display="none",this._svgGroup.style.display="none"},show:function(){t.send(e,"show"),this.notControlByCameraPosition=!1,this.visibleDistance?this.viewer.drawableContainer.showOrHideLabelForCamearPosition():(this.forceHide=!1,this._container.style.display="",this._svgGroup.style.display="")},hideByCameraPosition:function(){this.notControlByCameraPosition||(this.forceHide=!0,this._container.style.display="none",this._svgGroup.style.display="none")},showByCameraPosition:function(){!this.notControlByCameraPosition&&this.forceHide&&(this.forceHide=!1,this._container.style.display="",this._svgGroup.style.display="")},onClick:function(i){t.send(e,"onClick"),i&&(this._click=i)},onRightClick:function(i){t.send(e,"onRightClick"),i&&(this._rightClick=i)},onDoubleClick:function(e){e&&(this._doubleClick=e)},onEndDrag:function(i){t.send(e,"onEndDrag"),i&&(this._dragEnd=i)},getText:function(){return this._text},setText:function(i){t.send(e,"setText"),this._domTextArea.innerText=i,this._text=i},getOpacity:function(){return this._container.style.opacity},setOpacity:function(i,n){t.send(e,"setOpacity"),this._container.style.opacity=i},getHeight:function(){return parseFloat(this._container.style.height)},setHeight:function(i){t.send(e,"setHeight"),this._container.style.height=parseFloat(i)+"px";let n=Math.trunc((i-8)/18);this._domTextArea.style.webkitLineClamp=n||1},getWidth:function(){return parseFloat(this._container.style.width)},setWidth:function(i){t.send(e,"setWidth"),this._container.style.width=parseFloat(i)+"px"},getObjectId:function(){return this._objectId},associateComponentById:function(e,t){console.log("[BIMFACE WARN]: LeadLabel.associateComponentById() is obsolete, please use LeadLabel.bindComponentById() instead."),this.bindComponentById(e,t)},bindComponentById:function(e,t){let i=(this._config.viewer||this.viewer).getViewer().getComponentInfoByUserId(e);i?(this.levelName=i.userData&&i.userData.levelName,this._objectId=e,this._config.objectId=e,this._modelId=t):console.warn("invalid component id")},clearAssociation:function(){console.log("LeadLabel.clearAssociation() is obsolete, please use LeadLabel.unbind() instead."),this.unbind()},unbind:function(){this._objectId=null,this._modelId=null},isShow:function(e){var t=this._container,i=this._svgGroup;null!=this.displayMode&&(e=1!==this.displayMode),e?(t.removeClass("bf-drawable-mini"),i.removeClass("bf-drawable-mini-svg")):(t.addClass("bf-drawable-mini"),i.addClass("bf-drawable-mini-svg"))},getVisibleDistance:function(){return this.visibleDistance},setVisibleDistance:function(e){this.visibleDistance="number"!=typeof e?Number.POSITIVE_INFINITY:e,this.viewer.drawableContainer.showOrHideLabelForCamearPosition()},enableDepthTest:function(e){n.prototype.enableDepthTest.call(this,e)},isDepthTestEnabled:function(){return n.prototype.isDepthTestEnabled.call(this)},onObstructionChanged:function(e){n.prototype.onObstructionChanged.call(this,e)},resetClientPosition:function(e){const t=this._container,i=this._config,n=i.viewer||this.viewer;"Viewer3D"!==n.viewerType&&"ViewerGIS"!==n.viewerType||(e=n.worldToClient(e)),t.style.left=`${e.x+i.offset.x+23}px`,t.style.top=e.y+i.offset.y-18+"px",this._svgGroup.setAttribute("transform",`translate(${e.x},${e.y+i.offset.y-18})`)},setContainerVisible:function(e){!0!==e?this.hide():this.show()},setStyle:function(i){if(i&&null!==i){const[e,t,n,o]=this._labelCombination,s=i.lineColor&&i.lineColor.getRGBA();i.lineColor&&(this.config.style.lineColor=i.lineColor,t.style.stroke=s,n.style.stroke=s,e.style.borderColor=s,o.style.fill=s),i.lineWidth&&(this.config.style.lineWidth=i.lineWidth,e.style.borderWidth=i.lineWidth+"px",t.style.strokeWidth=i.lineWidth+"px",n.style.strokeWidth=i.lineWidth+"px",o.style.strokeWidth=i.lineWidth+"px"),i.backgroundColor&&(this.config.style.backgroundColor=i.backgroundColor,e.style.backgroundColor=i.backgroundColor.getRGBA()),i.fontSize&&(this.config.style.fontSize=i.fontSize,e.style.fontSize=i.fontSize+"px")}null!==this.config.style&&null!==i||(this.config.style=new Object),t.send(e,"setStyle")},getStyle:function(){return this.config.style}}),i.LeadLabel=s}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=new Glodon$1.Bimface.Plugins.Drawable.DrawableItemConfig;e.MiniTagConfig=function(){return Object.assign({},t,{minimap:null,floorList:[],height:20,width:20,objectId:"",src:"",worldPosition:null,viewer:null})}}();var extendStatics$4=function(e,t){return extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},extendStatics$4(e,t)};function __extends$4(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics$4(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var DomUtil2D=function(){function e(){}return e.create=function(e,t,i){var n=document.createElement(e);return n.id=t||"",n.style.position="absolute",n.style.width="100%",n.style.top=0,n.style.bottom=0,i&&i.appendChild(n),n},e.remove=function(e){var t=e.parentNode;t&&t.removeChild(e)},e.setPosition=function(e,t){e.position=t,e.style.left=t.x+"px",e.style.top=t.y+"px"},e.setOpacity=function(t,i){"opacity"in t.style?t.style.opacity=i:"filter"in t.style&&e._setOpacityIE(t,i)},e._setOpacityIE=function(e,t){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=e.filters.item(n)}catch(e){if(1===t)return}t=Math.round(100*t),i?(i.Enabled=100!==t,i.Opacity=t):e.style.filter+=" progid:"+n+"(opacity="+t+")"},e.splitStr=function(e){return e.trim().split(/\s+/g)},e.getContainerOffsetToClient=function(e){var t,i;if(e!=document){var n=(i=e).getBoundingClientRect?function(e){var t=e.getBoundingClientRect(),i=document.body,n=document.documentElement,o=n.clientTop||i.clientTop,s=n.clientLeft||i.clientLeft,r=t.top-o,a=t.left-s;return{top:Math.round(r),left:Math.round(a)}}(i):function(e){for(var t=0,i=0;e;)t+=e.offsetTop,i+=e.offsetLeft,e=e.offsetParent;var n=document.body,o=document.documentElement;return{top:t-=window.pageYOffset||o.scrollTop||n.scrollTop,left:i-=window.pageXOffset||o.scrollLeft||n.scrollLeft}}(i);t={width:e.offsetWidth,height:e.offsetHeight,left:n.left,top:n.top}}else t={width:window.innerWidth,height:window.innerHeight,left:0,top:0};return t},e.setClassName=function(e,t){var i=document.getElementById(e);i&&(i.className=t)},e.addClassName=function(e,t){var i,n,o,s,r,a=document.getElementById(e);if(a&&(n=a,t&&"string"==typeof t&&(i=t.split(/\s+/),1===n.nodeType)))if(n.className||1!==i.length){for(o=" "+n.className+" ",s=0,r=i.length;s<r;++s)o.indexOf(" "+i[s]+" ")<0&&(o+=i[0]+" ");n.className=o.trim()}else n.className=t},e.removeClassName=function(e,t){var i,n,o,s,r,a=document.getElementById(e);if(a&&(o=a,t&&"string"==typeof t&&(i=(t||"").split(/\s+/),1===o.nodeType&&o.className))){for(n=(" "+o.className+" ").replace("O"," "),s=0,r=i.length;s<r;s++)for(;n.indexOf(" "+i[s]+" ")>=0;)n=n.replace(" "+i[s]+" "," ");o.className=t?n.trim():""}},e.showOrHideElement=function(e,t){var i=document.getElementById(e);i&&(i.style.display=t?"":"none")},e.prototype.getStyleString=function(e){var t=[];for(var i in e){var n=e[i];t.push(i),t.push(":"),t.push(n),t.push("; ")}return t.join("")},e.cloneStyle=function(e){var t={};for(var i in e)t[i]=e[i];return t},e.removeStyleAttribute=function(e,t){Array.isArray(t)||(t=[t]),t.forEach((function(t){t in e&&delete e[t]}))},e.trimRight=function(e){if(0===e.length)return"";for(var t=e.length-1,i=t;i>=0;--i)if(" "!==e.charAt(i)){t=i;break}return e.substr(0,t+1)},e.trimLeft=function(e){if(0===e.length)return"";for(var t=0,i=0;i<e.length;++i)if(" "!==e.charAt(i)){t=i;break}return e.substr(t)},e.matchesSelector=function(e,t){if(e.matches)return e.matches(t);if(e.matchesSelector)return e.matchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.mozMatchesSelector)return e.mozMatchesSelector(t);if(e.oMatchesSelector)return e.oMatchesSelector(t);if(e.querySelectorAll){for(var i=(e.document||e.ownerDocument).querySelectorAll(t),n=0;i[n]&&i[n]!==e;)n++;return!!i[n]}return!1},e.toTranslate3d=function(e,t){return"translate3d("+e+"px,"+t+"px,0)"},e.setCursorStyle=function(e,t){var i;switch(t){case"n":case"s":i="ns-resize";break;case"w":case"e":i="ew-resize";break;case"ne":case"sw":i="nesw-resize";break;case"nw":case"se":i="nwse-resize"}e.style.cursor=i},e.debounce=function(e,t){var i,n=this;return void 0===t&&(t=500),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];i&&clearTimeout(i),i=setTimeout((function(){e.apply(n,o),i=void 0}),t)}},e}(),ViewAdapter=function(){function e(){this.domContainer=null,this.cameraControl=null,this.scene=null,this.name=""}return e.prototype.getName=function(){return this.name},e.prototype.setDomContainer=function(e){this.domContainer=e},e.prototype.getDomContainer=function(){return this.domContainer},e.prototype.worldToClient=function(e){},e.prototype.clientToWorld=function(e){var t=this.getDomContainerBounds(),i=this.cameraControl.camera,n=new window.THREE.Vector3;n.x=e.x/t.width*2-1,n.y=-e.y/t.height*2+1,n.z=0,n.unproject(i);var o=this.getInverseSceneMatrix();return n.applyMatrix4(o),n},e.prototype.getSceneMatrix=function(){return this.scene.getMatrixGlobal()},e.prototype.getInverseSceneMatrix=function(){var e=this.getSceneMatrix(),t=new window.THREE.Matrix4;return t.copy(e).invert(),t},e.prototype.clientToViewport=function(e){var t=this.getDomContainerBounds(),i=new window.THREE.Vector3;return i.x=e.x/t.width*2-1,i.y=-e.y/t.height*2+1,i.z=0,i},e.prototype.getDomContainerBounds=function(e){return DomUtil2D.getContainerOffsetToClient(e||this.domContainer)},e}();window.Glodon.Bimface.Marker={};var View3dAdapter=function(e){function t(t){var i=e.call(this)||this;return i.name="VIEW3D",i.domContainer=t.domElement,i.cameraControl=t.cameraControl,i.scene=t.getScene(),i}return __extends$4(t,e),t.prototype.worldToClient=function(e){var t=this.getDomContainerBounds(),i=this.cameraControl.camera,n=this.getSceneMatrix(),o=new window.THREE.Vector3(e.x,e.y,e.z);return o.applyMatrix4(n),o.project(i),Math.abs(o.z)>1?null:(o.x=Math.round(.5*(o.x+1)*t.width),o.y=Math.round(-.5*(o.y-1)*t.height),o.z=0,o)},t}(ViewAdapter);window.Glodon.Bimface.Marker.View3dAdapter=View3dAdapter;var View2dAdapter=function(e){function t(t,i){var n=e.call(this)||this;n.name="VIEW2D",n.minimap=t,n.domContainer=t.getMapContainer(),n.cameraControl=i.cameraControl,n.scene=i.getScene();var o=t.viewerFloor?t.viewerFloor.vfData:t.nmEditor.navigationMapData,s=o.width||298,r=o.height||198;return n.initialDomSize={width:s,height:r},n.currentDomSize={width:s,height:r},n._boxSize=new THREE.Vector2,n}return __extends$4(t,e),t.prototype.getInitialDomSize=function(){return this.initialDomSize},t.prototype.resize=function(e){this.currentDomSize=e},t.prototype.getDomContainerBounds=function(){return this.currentDomSize},t.prototype.getMinimap=function(){return this.minimap},t.prototype.calculateBoundary=function(e,t,i,n){var o=(e[1].x-e[0].x)/(t[1].x-t[0].x),s=e[1].x-o*t[1].x;n.x=o*i.x+s;var r=(e[1].y-e[0].y)/(t[1].y-t[0].y),a=e[1].y-r*t[1].y;n.y=r*i.y+a},t.prototype.worldToClient=function(e){var t=this.minimap.nmView?this.minimap.nmView.viewer.globalUnitUtil.translateVector(e):new window.THREE.Vector3(e.x,e.y,e.z);if(this.minimap.nmView&&!this.minimap.nmData.isProfile&&this.minimap.nmData.modelAnchor&&this.minimap.nmData.mapAnchor)return this.calculateBoundary(this.minimap.nmData.mapAnchor,this.minimap.nmData.modelAnchor,t,t),t;var i=this.minimap.nmView?this.scene.boundingBoxWorldWithoutDEM.clone():this.minimap.getAxisGridBox2D();this.worldToNormalizedPoint(t,i);var n=this.getDomContainerBounds(),o={width:n.width/2,height:n.height/2};if(this.normalizedPointToScreen(t,o),t.x+=o.width,t.y+=o.height,this.minimap.nmView){var s=this.domContainer.getElementsByTagName("image")[0].width.baseVal.value,r=this.domContainer.getElementsByTagName("image")[0].height.baseVal.value,a=n.width-s,l=n.height-r;s<n.width&&(t.x=(o.width-a/2)/o.width*t.x+a/2),r<n.height&&(t.y=(o.height-l/2)/o.height*t.y+l/2)}return t},t.prototype.normalizedPointToScreen=function(e,t){e.x=e.x*t.width,e.y=-e.y*t.height},t.prototype.worldToNormalizedPoint=function(e,t){t.getSize(this._boxSize),e.x=(e.x-t.min.x)/this._boxSize.x*2-1,e.y=(e.y-t.min.y)/this._boxSize.y*2-1},t}(ViewAdapter);window.Glodon.Bimface.Marker.View2dAdapter=View2dAdapter;var DrawingdAdapter=function(e){function t(t,i){var n=e.call(this)||this;n.name="DRAWING",n.minimap=t,n.domContainer=t.getMapContainer(),n.viewer=i;return n.initialDomSize={width:300,height:240},n.currentDomSize={width:300,height:240},n}return __extends$4(t,e),t.prototype.getInitialDomSize=function(){return this.initialDomSize},t.prototype.resize=function(e){this.currentDomSize=e},t.prototype.getDomContainerBounds=function(){return this.currentDomSize},t.prototype.getMinimap=function(){return this.minimap},t.prototype.worldToClient=function(e){var t=this.viewer.getViewer().butterfly.minimapMargin,i=this.viewer.getSceneBoundingBox(),n=this.getDomContainerBounds(),o=Math.abs(i.max.x-i.min.x)*(1+2*t[0].x),s=Math.abs(i.max.y-i.min.y)*(1+2*t[0].y),r=o,a=s,l=i.min.x,h=i.max.x,d=i.min.y,c=i.max.y;o/n.width>=s/n.height?(l=i.min.x-t[0].x*Math.abs(i.max.x-i.min.x),c+=((a=o/n.width*n.height)-(c-d))/2):(c=i.max.y+t[0].y*Math.abs(i.max.y-i.min.y),l-=((r=s/n.height*n.width)-(h-l))/2);var u=(e.x-l)/r,p=(c-e.y)/a,g=this.viewer.drawableContainer._items.find((function(e){return e instanceof window.Glodon.Bimface.Plugins.Drawable.MiniTag}));g&&g.config.width;var m=g&&g.config.height||20;return{x:n.width*u,y:n.height*p-m/2}},t}(ViewAdapter);window.Glodon.Bimface.Marker.DrawingdAdapter=DrawingdAdapter;var Marker=function(){function e(t,i){this.canUseThree=!!window.THREE,this.id=t,this.editor=i,this.position=this.canUseThree&&new window.THREE.Vector3||{x:0,y:0},this.boundingBox=this.canUseThree&&new window.THREE.Box3||{min:{x:1/0,y:1/0,z:1/0},max:{x:-1/0,y:-1/0,z:-1/0}},this.shape=null,this.style=e.getDefaultStyle(),this.selected=!1,this.highlighted=!1,this.highlightColor="#000088",this.isDisableInteractions=!1,this.ratioW=1,this.ratioH=1,this.keys={BACKSPACE:8,ALT:18,ESC:27,LEFT:37,UP:38,RIGHT:39,BOTTOM:40,DELETE:46,ZERO:48,A:65,D:68,E:69,Q:81,S:83,W:87,PLUS:187,SUB:189},this.onMouseDownBinded=this.onMouseDown.bind(this),this.onClickBinded=this.onClick.bind(this),this.onDoubleClickBinded=this.onDoubleClick.bind(this),this.onKeyUpBinded=this.onKeyUp.bind(this)}return e.prototype.addDomEventListeners=function(){this.shape.addEventListener("mousedown",this.onMouseDownBinded,!0),this.shape.addEventListener("click",this.onClickBinded,!0),this.shape.addEventListener("dblclick",this.onDoubleClickBinded,!0),this.shape.addEventListener("touchstart",this.onClickBinded,!0),window.addEventListener("keyup",this.onKeyUpBinded)},e.prototype.removeDomEventListeners=function(){this.shape.removeEventListener("mousedown",this.onMouseDownBinded,!0),this.shape.removeEventListener("click",this.onClickBinded,!0),this.shape.removeEventListener("dblclick",this.onDoubleClickBinded,!0),this.shape.removeEventListener("touchstart",this.onClickBinded,!0),window.removeEventListener("keyup",this.onKeyUpBinded)},e.prototype.onMouseDown=function(e){e.preventDefault(),e.stopPropagation(),2==e.button&&this.select(e.button)},e.prototype.onClick=function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.clickTimerId&&clearTimeout(this.clickTimerId),this.clickTimerId=setTimeout((function(){t.select(e.button)}),500)},e.prototype.onDoubleClick=function(e){e.preventDefault(),e.stopPropagation(),this.editor.doubleClickMarker(this),this.clickTimerId&&clearTimeout(this.clickTimerId)},e.prototype.onKeyUp=function(e){if(e.keyCode===this.keys.DELETE)this.editor.deselectMarker(),this.delete()},e.prototype.createShape=function(){},e.prototype.destroy=function(){this.removeDomEventListeners(),this.deselect(),this.setParent(null)},e.prototype.set=function(e,t,i,n){this.userId=e,this.canUseThree&&this.position.set(t.x,t.y,t.z)||(this.position=t),i&&(this.boundingBox=this.canUseThree?i.clone():i),n&&(this.style=DomUtil2D.cloneStyle(n)),this.update()},e.prototype.setRatio=function(e,t){this.ratioW=e,this.ratioH=t},e.prototype.setParent=function(e){var t=this.shape;t&&(t.parentNode&&t.parentNode.removeChild(t),e&&e.appendChild(t))},e.prototype.setStyle=function(e){this.style=DomUtil2D.cloneStyle(e),this.update()},e.prototype.select=function(e){this.selected||(this.selected=!0,this.highlight(!0)),this.editor.selectMarker(this,e)},e.prototype.deselect=function(){this.highlight(!1),this.selected=!1},e.prototype.highlight=function(e){this.isDisableInteractions||(this.highlighted=e,this.update())},e.prototype.disableInteractions=function(e){this.isDisableInteractions=e},e.prototype.delete=function(){this.editor.deleteMarker(this)},e.prototype.getClientPosition=function(){return this.editor.getAdapter().worldToClient(this.position)},e.prototype.getBoundingBox=function(){return this.boundingBox},e.prototype.toNewObject=function(){return{id:this.id,userId:this.userId,shapeType:this.shapeType,cx:this.cx,cy:this.cy,position:this.position?Object.assign({},this.position):null,boundingBox:this.boundingBox?Object.assign({},this.boundingBox):null}},e.prototype.show=function(){this.shape.style.display="block"},e.prototype.hide=function(){this.shape.style.display="none"},e.prototype.update=function(){var e=this.style["stroke-width"],t=this.highlighted?this.highlightColor:this.style["stroke-color"],i=this.style["stroke-opacity"],n=this.style["fill-color"],o=this.style["fill-opacity"],s=this.getClientPosition();if(s){var r=s.x,a=s.y;if(2==this.shapeType)var l=["translate(",r-this.pictureSize.width*this.ratioW*.5,",",a-this.pictureSize.height*this.ratioH*.5,") "].join("");else l=["translate(",r,",",a,") "].join("");this.cx=r,this.cy=a,this.shape.setAttribute("transform",l),this.shape.setAttribute("stroke-width",e),this.shape.setAttribute("stroke",t),this.shape.setAttribute("stroke-opacity",i),this.shape.setAttribute("fill",n),this.shape.setAttribute("fill-opacity",o)}else this.shape.style.display="none"},e.shapeTypes={BUBBLE:0,FLAG:1,COMMON:2},e.getDefaultStyle=function(){var e={"stroke-width":2,"stroke-color":"#fffaff","stroke-opacity":1,"fill-color":"#ff2129","fill-opacity":1};return e},e}(),MarkerBubble=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.shapeType=Marker.shapeTypes.BUBBLE,n.createShape(),n.addDomEventListeners(),n}return __extends$4(t,e),t}(Marker),Shape2D=function(){function e(){}return e.createSvgElement=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg",e);return t.setAttribute("pointer-events","inherit"),t},e.getRGBAString=function(e,t){return t<=0?"none":["rgba("+parseInt("0x"+e.substr(1,2)),",",parseInt("0x"+e.substr(3,2)),",",parseInt("0x"+e.substr(5,2)),",",t,")"].join("")},e.makeFlag=function(){var e=this.createSvgElement("path");return e.setAttribute("d","M0 0 L0 -20 L15 -13 L4 -6.87 L4 0Z"),e},e.makeBubble=function(){var e=this.createSvgElement("path");return e.setAttribute("d","m0.0035,-19.88544c-3.838253,0 -6.95,2.581968 -6.95,5.766754c0,3.185555 6.95,13.933247 6.95,13.933247s6.95,-10.747692 6.95,-13.933247c0,-3.184786 -3.11082,-5.766754 -6.95,-5.766754z"),e},e.makeCommon=function(e,t){var i=this.createSvgElement("image");return i.href.baseVal=e,i.setAttribute("height",t.height.toString()+"px"),i.setAttribute("width",t.width.toString()+"px"),i},e}(),MarkerCommon=function(e){function t(t,i,n,o){var s=e.call(this,t,i)||this;return s.shapeType=Marker.shapeTypes.COMMON,s.pictureSize=o||{width:20,height:20},s.createShape(n),s.addDomEventListeners(),s}return __extends$4(t,e),t.prototype.createShape=function(e){this.shape=Shape2D.makeCommon(e,this.pictureSize)},t.prototype.reset=function(){var e=this.pictureSize.width*this.ratioW,t=this.pictureSize.height*this.ratioH;this.shape.setAttribute("width",e.toString()+"px"),this.shape.setAttribute("height",t.toString()+"px")},t}(Marker),MarkerFlag=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.shapeType=Marker.shapeTypes.COMMON,n.createShape(),n.addDomEventListeners(),n}return __extends$4(t,e),t.prototype.createShape=function(){this.shape=Shape2D.makeFlag()},t}(Marker),MarkerEditor=function(){function e(e){this.disableInteractions=function(e){this.isDisableInteractions=e},this.adapter=e,this.markers=[],this.mapGroupMarkers={},this.groups=null,this.selectedMarker=null,this.flagColors={red:"#ff2129",green:"#85af03",yellow:"#fe9829"},this.bubbleColors={red:"#f92a24",green:"#86b507",gray:"#ff9326"},this.nextMarkerId=0,this.initialized=!1,this.markerClickCallback=null,this.markerDoubleClickCallback=null,this.markerRightClickCallback=null,this.markersRatioH=1,this.markersRatioW=1}return e.prototype.getAdapter=function(){return this.adapter},e.prototype.updateDomContainer=function(){var e=this.adapter.getDomContainer();this.adapter.setDomContainer(e)},e.prototype.getMarkers=function(){return this.markers},e.prototype.getMarkersByGroupName=function(e){return this.mapGroupMarkers.hasOwnProperty(e)?this.mapGroupMarkers[e]:[]},e.prototype.addMarkerToGroup=function(e,t){this.mapGroupMarkers.hasOwnProperty(t)||(this.mapGroupMarkers[t]=[]),this.mapGroupMarkers[t].push(e)},e.prototype.setMarkerGroups=function(e){this.groups=e},e.prototype.removeMarkerInGroup=function(e,t){for(var i=this.mapGroupMarkers[t],n=0,o=i.length;n<o;n++)if(i[n].userId==e)return i.splice(n,1),void this.updateByGroup()},e.prototype.removeMarker=function(e){for(var t=this.markers,i=0,n=t.length;i<n;i++)if(t[i].userId==e)return t[i].destroy(),void t.splice(i,1)},e.prototype.clearMarkers=function(){this.unloadMarkers(!0),this.markers=[],this.mapGroupMarkers={}},e.prototype.setVisible=function(e,t){var i=this.mapGroupMarkers;for(var n in i){var o=i[n];if(o instanceof Array){var s=o.getObjectByAttribute("id",e);s&&(!0===t?s.show():s.hide())}}},e.prototype.updateByGroup=function(e){var t=e||this.groupName;this.unloadMarkers();var i=this.mapGroupMarkers[t];if(i instanceof Array)for(var n=0,o=i.length;n<o;n++)i[n]&&i[n].setParent(this.svgGroup)},e.prototype.resize=function(e){var t=this.adapter.getInitialDomSize(),i=e.width/t.width,n=e.height/t.height;this.markersRatioH=n,this.markersRatioW=i;var o=this.mapGroupMarkers[this.groupName];if(o instanceof Array){for(var s=0,r=o.length;s<r;s++){var a=o[s];a.setRatio(i,n),a.reset(),a.update()}e.width==t.width&&e.height==t.height||(t=e),this.svg.setAttribute("width",e.width+""),this.svg.setAttribute("height",e.height+"")}},e.prototype.setGroupName=function(e){this.groupName=e},e.prototype.updateGroupName=function(){var e=this.adapter.getMinimap();e&&e.getFloorPlaneName&&(this.groupName=e.getFloorPlaneName())},e.prototype.onResize=function(){if(this.svg){var e=this.adapter.getDomContainerBounds();this.svg.setAttribute("width",e.width+""),this.svg.setAttribute("height",e.height+""),this.updateMarkers()}},e.prototype.init=function(){if(!this.svg){var e=this.adapter.getDomContainerBounds(),t=e.width,i=e.height;this.svg=Shape2D.createSvgElement("svg"),this.svg.style.position="absolute",this.svg.style.display="block",this.svg.style.position="absolute",this.svg.style.display="block",this.svg.style.left="0",this.svg.style.top="0",this.svg.setAttribute("width",t+""),this.svg.setAttribute("height",i+""),this.adapter.getDomContainer().appendChild(this.svg),this.svgGroup=Shape2D.createSvgElement("g"),this.svg.insertBefore(this.svgGroup,this.svg.firstChild)}this.initialized=!0},e.prototype.uninit=function(){this.initialized=!1,this.svg&&(this.unloadMarkers(),this.svgGroup&&this.svgGroup.parentNode&&this.svgGroup.parentNode.removeChild(this.svgGroup),this.svg.parentNode&&this.svg.parentNode.removeChild(this.svg),this.svgGroup=null,this.svg=null,this.markerClickCallback=null,this.markerDoubleClickCallback=null,this.markerRightClickCallback=null)},e.prototype.isInitialized=function(){return this.initialized},e.prototype.generateMarkerId=function(){return++this.nextMarkerId,this.nextMarkerId.toString(10)},e.prototype.clear=function(e){var t=this.markers;if(1==e)for(;t.length;){var i=t[0];this.deleteMarker(i)}var n=this.svgGroup;if(n&&n.childNodes.length>0)for(;n.childNodes.length;)n.removeChild(n.childNodes[0])},e.prototype.addMarker=function(e){var t=this.adapter.getName();if("VIEW3D"!=t&&"DRAWING"!=t&&"VIEW2D"!=t||e.setParent(this.svgGroup),this.markers.push(e),this.groups)for(var i=0,n=this.groups.length;i<n;i++)this.addMarkerToGroup(e,this.groups[i]);this.groupName&&this.updateByGroup(this.groupName)},e.prototype.deleteMarker=function(e){if(e){this.removeMarker(e.userId);var t=this.mapGroupMarkers;for(var i in t)this.removeMarkerInGroup(e.userId,i);t&&this.updateByGroup()}},e.prototype.selectMarker=function(e,t){if(!0===this.isDisableInteractions)return this.markerClickCallback&&0==t&&this.markerClickCallback(e.toNewObject()),void(this.markerRightClickCallback&&2==t&&this.markerRightClickCallback(e.toNewObject()));this.selectedMarker!==e?(this.deselectMarker(),this.selectedMarker=e):this.deselectMarker(),this.markerClickCallback&&(this.selectedMarker?this.markerClickCallback(this.selectedMarker.toNewObject()):this.markerClickCallback(null))},e.prototype.doubleClickMarker=function(e){this.markerDoubleClickCallback&&this.markerDoubleClickCallback(e.toNewObject())},e.prototype.deselectMarker=function(){this.selectedMarker&&(this.selectedMarker.deselect(),this.selectedMarker=null)},e.prototype.enableSVGPaint=function(e){e?this.svg&&this.svg.setAttribute("pointer-events","painted"):this.svg&&this.svg.setAttribute("pointer-events","none")},e.prototype.getMarkerColor=function(e,t){var i=this.bubbleColors.red;switch(e<0&&e>1&&(e=0),t>2&&(t-=3),t<0&&t>2&&(t=0),t){case 0:i=0===e?this.bubbleColors.red:this.flagColors.red;break;case 1:i=0===e?this.bubbleColors.green:this.flagColors.green;break;case 2:i=0===e?this.bubbleColors.gray:this.flagColors.yellow}return i},e.prototype.createMarkerByIntersect=function(e,t,i,n){var o={size:n,id:e.id||this.generateMarkerId(),userId:e.userId,position:e.worldPosition||e.object.point,boundingBox:e.worldBoundingBox||e.object&&e.object.boundingBox,shapeType:t,state:i};this.createMarker(o)},e.prototype.createMarker=function(e){if(e){var t=Marker.getDefaultStyle();t["fill-color"]=this.getMarkerColor(e.shapeType,e.state);var i,n=e.id||this.generateMarkerId(),o=Marker.shapeTypes;switch(e.shapeType){case o.BUBBLE:i=new MarkerBubble(n,this);break;case o.COMMON:(i=new MarkerCommon(n,this,e.state,e.size)).setRatio(this.markersRatioW,this.markersRatioH),i.reset();break;case o.FLAG:default:i=new MarkerFlag(n,this)}this.isDisableInteractions&&i.disableInteractions(!0),i.set(e.userId,e.position,e.boundingBox,t),this.addMarker(i)}},e.prototype.getMarkersBoundingBox=function(){if(this.markers.length<1)return null;for(var e=new window.THREE.Box3,t=0,i=this.markers.length;t<i;t++){var n=this.markers[t];n.getBoundingBox()&&e.union(n.getBoundingBox())}return e},e.prototype.getMarkerInfoList=function(){for(var e=[],t=0,i=this.markers.length;t<i;t++){var n=this.markers[t],o=n.userId+"_"+t,s={id:n.id||o,userId:n.userId,shapeType:n.shapeType,position:n.position,boundingBox:n.boundingBox,state:n.state};e.push(s)}return e},e.prototype.loadMarkers=function(e){this.clear();for(var t=0,i=e.length;t<i;t++){var n=e[t],o=n.userId+"_"+t,s=n.id||o,r=n.userId,a=n.shapeType,l=n.state,h=n.position,d=window.THREE?new window.THREE.Box3:{min:{x:1/0,y:1/0,z:1/0},max:{x:-1/0,y:-1/0,z:-1/0}};d.max.x=n.boundingBox.max.x,d.max.y=n.boundingBox.max.y,d.max.z=n.boundingBox.max.z,d.min.x=n.boundingBox.min.x,d.min.y=n.boundingBox.min.y,d.min.z=n.boundingBox.min.z;var c={id:s,userId:r,position:h,boundingBox:d,shapeType:a,state:l};this.createMarker(c)}},e.prototype.loadMarkersFromIntersect=function(e,t,i){this.clear(),this.createMarkerByIntersect(e,t,i)},e.prototype.unloadMarkers=function(e){this.clear(e)},e.prototype.updateMarkers=function(){for(var e=0,t=this.markers.length;e<t;e++){this.markers[e].update()}},e.prototype.getMarker=function(e){for(var t=this.markers,i=t.length,n=0;n<i;++n)if(t[n].userId==e)return t[n];return null},e.prototype.getMarkerByUserId=function(e){for(var t=this.markers,i=t.length,n=0;n<i;++n)if(t[n].userId==e)return t[n];return null},e.prototype.setMarkerClickCallback=function(e){this.markerClickCallback=e},e.prototype.setMarkerDoubleClickCallback=function(e){this.markerDoubleClickCallback=e},e.prototype.setMarkerRightClickCallback=function(e){this.markerRightClickCallback=e},e.prototype.zoomAndPanMarkerById=function(e,t,i,n){var o,s=this.mapGroupMarkers,r=this.svg.getAttribute("width"),a=this.svg.getAttribute("height"),l=new THREE.Vector2(.5*r,.5*a),h=function(e,o){var s=e.getObjectByAttribute("id",o);if(s){var r=s.getClientPosition(),a=s.pictureSize.width*s.ratioW,h=s.pictureSize.height*s.ratioH,d=new THREE.Vector2(r.x,r.y).clone().sub(l);d.multiplyScalar(n);var c=l.x+d.x-.5*a,u=l.y+d.y-.5*h,p="translate("+(c+t)+","+(u+i)+")";s.shape.setAttribute("transform",p)}};for(var d in this.adapter.minimap.nmData&&h(o=this.markers,e),s){(o=s[d])instanceof Array&&h(o,e)}},e}();!function(){var e="Bimface.Plugins.Drawable.MiniTag",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=Glodon$1.Bimface.Plugins.Drawable.DrawableItem;Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");let o=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility");var s=function(e){n.call(this,e);var t=this;this.miniTagConfig=e,this._config=e,this.notExecutedFns=[],t.worldPosition=e.worldPosition,this._renderCallback=function(){t.resize()}},r=function(e){for(var t=s._tagHelper.getMarkerInfoList(),i=0,n=t.length;i<n;i++){var o=t[i];o.id==e&&s._tagHelper.deleteMarker(o)}};s.clear=function(){s._tagHelper&&s._tagHelper.clearMarkers()},o.Type.inheritPrototype(s,n),s.prototype=Object.assign({},n.prototype,{init:function(){self.viewer=this.viewer;const e=this;if("ViewerDrawing"==this.viewer.viewerType){self.mapHelper=this.miniTagConfig.minimap;var t=new Glodon$1.Bimface.Marker.DrawingdAdapter(self.mapHelper,this.viewer)}else if(this.miniTagConfig.minimap){self.mapHelper=this.miniTagConfig.minimap.navigationMap?this.miniTagConfig.minimap.navigationMap:this.miniTagConfig.minimap;t=new Glodon$1.Bimface.Marker.View2dAdapter(self.mapHelper,this.viewer.getViewer());self.mapHelper.setMinimapResizeCallback&&self.mapHelper.setMinimapResizeCallback((function(e){t.resize(e),s._tagHelper.updateGroupName(),s._tagHelper.updateDomContainer(),s._tagHelper.resize(e),s._tagHelper.updateByGroup()})),self.mapHelper.setPlaneChangedCallback&&self.mapHelper.setPlaneChangedCallback((function(){s._tagHelper.updateGroupName(),s._tagHelper.updateByGroup()}));const i={Floor_Plane_Changed_For_Panel:3001,ZOOM_MOUSE_WHEEL:6e3,PAN_MOUSE_MOVE:7e3};self.mapHelper.viewerFloor?(self.mapHelper.viewerFloor.addEventListener(i.ZOOM_MOUSE_WHEEL,(function(t){var i=t.data;e.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)})),self.mapHelper.viewerFloor.addEventListener(i.PAN_MOUSE_MOVE,(function(t){var i=t.data;e.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)})),self.mapHelper.viewerFloor.addEventListener(i.Floor_Plane_Changed_For_Panel,(function(t){var i=self.mapHelper.viewerFloor,n=i.getPanOffset();e.zoomAndPan(n.x,n.y,i.vfData.zoomFactor)}))):(self.mapHelper.nmEditor.eventManager.addEventListener(i.ZOOM_MOUSE_WHEEL,(function(t){var i=t.data;e.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)})),self.mapHelper.nmEditor.eventManager.addEventListener(i.PAN_MOUSE_MOVE,(function(t){var i=t.data;e.zoomAndPan(i.offsetX,i.offsetY,i.zoomFactor)})))}else{t=new Glodon$1.Bimface.Marker.View3dAdapter(this.viewer.getViewer());this.viewer.getViewer().addCallbacks("render",e._renderCallback)}this.mapHelper=self.mapHelper,null==s._tagHelper&&(s._tagHelper=new MarkerEditor(t)).disableInteractions(!0),s._tagHelper.isInitialized()||s._tagHelper.init(),this.executeUnfinishedFns()},draw:function(){var e=this,t=this.miniTagConfig;t.viewer=e.viewer,function(e,t){if(!e)return!1;var i=!1,n=s._tagHelper.getMarkerInfoList();e.userId=e.objectId;for(var o=0,r=n.length;o<r;o++)if(n[o].id==e.id)return i=!0,!1;e.floorList?s._tagHelper.setMarkerGroups(e.floorList):s._tagHelper.setMarkerGroups([]),"ViewerDrawing"!=e.config.viewer.viewerType&&s._tagHelper.updateGroupName(),i||s._tagHelper.createMarkerByIntersect(e,t.shape,t.image,t.size)}({id:this.id,config:this._config,objectId:t.objectId,worldPosition:t.worldPosition,floorList:t.floorList},{shape:2,image:t.src,size:{width:t.width,height:t.height}});var i=e.mapHelper.viewerFloor;if(i){var n=i.getPanOffset();e.zoomAndPan(n.x,n.y,i.vfData.zoomFactor)}const o=e.mapHelper.nmData;o&&o.imgPosition&&e.zoomAndPan(o.imgPosition.x,o.imgPosition.y,o.zoomFactor)},show:function(){t.send(e,"show"),s._tagHelper&&s._tagHelper.setVisible(this.id,!0)},hide:function(){t.send(e,"hide"),s._tagHelper&&s._tagHelper.setVisible(this.id,!1)},getFloorList:function(){return this.miniTagConfig.floorList},setFloorList:function(i){t.send(e,"setFloorList"),this.miniTagConfig.floorList=i,r(this.id),this.draw()},getHeight:function(){return this.miniTagConfig.height},setHeight:function(i){t.send(e,"setHeight"),this.miniTagConfig.height=i,r(this.id),this.draw()},getId:function(){return this.id},getObjectId:function(){return this.miniTagConfig.objectId},setObjectId:function(i){t.send(e,"setObjectId");var n=this.miniTagConfig;r(this.id),n.objectId=i,this.draw()},getSrc:function(){return this.miniTagConfig.src},setSrc:function(i){t.send(e,"setSrc"),this.miniTagConfig.src=i,r(this.id),this.draw()},getWidth:function(){return this.miniTagConfig.width},setWidth:function(i){t.send(e,"setWidth"),this.miniTagConfig.width=i,r(this.id),this.draw()},getWorldPosition:function(){return this.miniTagConfig.worldPosition},setWorldPosition:function(i){t.send(e,"setWorldPosition"),this.miniTagConfig.worldPosition=i,r(this.id),this.draw()},executeUnfinishedFns:function(){this.notExecutedFns&&this.notExecutedFns.map((e=>{switch(e[0]){case"setMarkerClickCallback":s._tagHelper.setMarkerClickCallback(e[1]);break;case"setMarkerDoubleClickCallback":s._tagHelper.setMarkerDoubleClickCallback(e[1]);break;case"setMarkerRightClickCallback":s._tagHelper.setMarkerRightClickCallback(e[1])}})),delete this.notExecutedFns},onClick:function(i){t.send(e,"onClick"),s._tagHelper?s._tagHelper.setMarkerClickCallback(i):this.notExecutedFns.push(["setMarkerClickCallback",i])},onDoubleClick:function(i){t.send(e,"onDoubleClick"),s._tagHelper?s._tagHelper.setMarkerDoubleClickCallback(i):this.notExecutedFns.push(["setMarkerDoubleClickCallback",i])},onRightClick:function(i){t.send(e,"onRightClick"),s._tagHelper?s._tagHelper.setMarkerRightClickCallback(i):this.notExecutedFns.push(["setMarkerRightClickCallback",i])},onEndDrag:function(i){t.send(e,"onEndDrag")},zoomAndPan:function(e,t,i){s._tagHelper&&s._tagHelper.zoomAndPanMarkerById(this.id,e,t,i)}}),i.MiniTag=s}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=new Glodon$1.Bimface.Plugins.Drawable.DrawableItemConfig;e.ClusterTagConfig=function(){return Object.assign({},t,{width:52,height:57,content:"",src:null,offsetX:0,offsetY:0})}}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),t=Glodon$1.Bimface.Plugins.Drawable.DrawableItem,i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=function(e){t.call(this,e),this.includedTags=[],this.clusterBbox=null,this.attachFilter=e.attachFilter;let n=i.create("div","bf-drawable-cluster");n.style.position="absolute",n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,n.innerHTML=this.getClusterTagHtml();let o=i.create("div","bf-drawable-cluster-textarea");o.innerText=e.content,n.appendChild(o),this.clusterStyle=Glodon$1.Bimface.Plugins.Cluster.ClusterStyle.Success,this.forceHide=!1,this._config=e,this._domTextArea=o,this._container=n,this.hookEvents()};Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility").Type.inheritPrototype(n,t);!function(e,t){var i=t.prototype;for(var n in e)i[n]=e[n]}({hookEvents:function(){let e=this._container,t=this;this.isMouseDown=!1,e.addEventListener("mouseup",(function(e){t.isMouseDown=!1})),e.addEventListener("mousemove",(function(e){t.isMouseDown||t.onHoverCallback&&t.onHoverCallback({id:t.id,position:t.worldPosition,includedTags:t.getIncluded(),boundingBox:t.clusterBbox})})),e.addEventListener("mousedown",(function(e){(e||window.event).stopPropagation(),t.isMouseDown=!0})),e.addEventListener("click",(function(e){(e||window.event).stopPropagation(),t.clickTimerId&&clearTimeout(t.clickTimerId),t.clickTimerId=setTimeout((()=>{t.onClickCallback&&t.onClickCallback({id:t.id,position:t.worldPosition,includedTags:t.getIncluded(),boundingBox:t.clusterBbox})}),500)})),e.addEventListener("dblclick",(function(e){(e||window.event).stopPropagation(),t._doubleClick&&t._doubleClick({id:t.id,position:t.worldPosition,includedTags:t.getIncluded(),boundingBox:t.clusterBbox}),t.clickTimerId&&clearTimeout(t.clickTimerId)}))},draw:function(e){var t=this._container,i=this._config;t.style.left=e.clientPosition.x+i.offsetX-i.width/2+"px",t.style.top=e.clientPosition.y+i.offsetY-i.height/2+"px",e.rootDomElement.appendChild(t)},getClusterTagHtml(){let e='<defs><filter x="-23.9%" y="-21.4%" width="147.7%" height="142.9%" filterUnits="objectBoundingBox" id="filter-clustertag"><feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur> <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix> <feMerge><feMergeNode in="shadowMatrixOuter1"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter> </defs>';this.attachFilter||(e="");let t='<svg width="52px" height="57px" version="1.1" transform="translate(0,0)">'+e;return t+=`<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="编组" filter="#filter-clustertag" transform="translate(4.000000, 3.000000)"> <path id="${this.id}" d="M43.7259252,22.0045824 C43.7259252,9.85175882 33.9373645,0.000288235294 21.8628598,0.000288235294 C9.78835514,0.000288235294 0.000205607477,9.85175882 0.000205607477,22.0045824 C0.000205607477,29.7679941 3.99803738,36.5872294 10.0313832,40.5039353 L10.0202804,40.5039353 L21.8628598,48.6045824 L33.7058505,40.5039353 L33.6947477,40.5039353 C39.7276822,36.5872294 43.7259252,29.7679941 43.7259252,22.0045824" id="Fill-1" fill="#32D3A6"></path><circle fill="#FFFFFF" cx="22" cy="22" r="16"></circle></g></g></svg>`,t},setScale:function(e){this._container.style.transform=`scale(${e})`},getText:function(){return this._domTextArea.innerText},setText:function(e){this._domTextArea.innerText=e},updateText:function(){let e=this.getIncluded().length;this.showDetails||e<=99?(e>999&&(this._container.children[0].style.scale=1.5),e>99999?this.setText("99999"):this.setText(e.toString())):this.setText("99+")},show:function(){this._container.style.display="block",this.forceHide=!1},hide:function(){this._container.style.display="none",this.forceHide=!0},onClick:function(e){this.onClickCallback=e},onHover:function(e){this.onHoverCallback=e},include:function(e){this.includedTags.push(e)},isInclude:function(e){for(const t of this.includedTags)if(t.getId()===e)return!0;return!1},setBoundingBox:function(e){this.clusterBbox=e},getIncluded:function(){return this.includedTags},getContainer:function(){return this._container},hideIncludedTags:function(){for(const e of this.includedTags)e.isHideByClustering=!0},showIncludedTags:function(){for(const e of this.includedTags)e.isHideByClustering=!1},getCurrentPosition:function(){return{x:this.worldPosition.x,y:this.worldPosition.y,z:this.worldPosition.z}},setStyle:function(e){this.clusterStyle=e;let t=document.getElementById(this.getId());t&&(t.style.fill=e),this._domTextArea.style.color=e},getStyle:function(){return this.clusterStyle},getOpacity:function(){return""===this._container.style.opacity?1:this._container.style.opacity},setOpacity:function(e){this._container.style.opacity=e},resetClientPosition:function(e){const t=this._container,i=this._config;"Viewer3D"!==this.viewer.viewerType&&"ViewerGIS"!==this.viewer.viewerType||(e=this.viewer.worldToClient(e)),t.style.left=e.x+i.offsetX-i.width/2+"px",t.style.top=e.y+i.offsetY-i.height/2+"px"},setContainerVisible(e){this._container.style.display=!0===e?"block":"none"},play:function(e){if(!(this.clusterBbox&&this.clusterBbox.center&&this.includedTags.length>0))return void console.log("clusterBbox");const t=this.clusterBbox.center,i=this.includedTags,n=i.length;for(let e=0;e<n;e++){const t=i[e];t.originClientPosition=t.clientPosition}this.time=500;let o=(new Date).valueOf(),s=o-16;this.progress=0;let r=()=>{this.animationId=requestAnimationFrame(r),this.progress>=1&&(this.curvePos=1,e&&e(),cancelAnimationFrame(this.animationId),this.progress=0),(e=>{for(let o=0;o<n;o++){const n=i[o];let s=n.originClientPosition;s.x=s.x+(t.x-s.x)*e,s.y=s.y+(t.y-s.y)*e,n.resetClientPosition(s)}})(this.progress),o=(new Date).valueOf();const a=o-s;s=o,this.progress+=a/this.time};r()}},n),e.ClusterTag=n}(),function(){var e="Bimface.Plugins.Drawable.DrawableContainer",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Drawable"),n=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Bimface.Plugins.Drawable.ClusterTag);i.DrawableContainer=class{constructor(e){let t=this,i=e.viewer;if(i.drawableContainer)return i.drawableContainer;i.drawableContainer=this,skipVueObserver(this);let n=Glodon$1.Bimface.Viewer.ViewerDrawing&&i instanceof Glodon$1.Bimface.Viewer.ViewerDrawing,o=Glodon$1.Bimface.Viewer.Viewer3D&&"Viewer3D"===i.viewerType,s=Glodon$1.Bimface.Viewer.ViewerDrawingSet&&i instanceof Glodon$1.Bimface.Viewer.ViewerDrawingSet,r=Glodon$1.Bimface.Viewer.ViewerGIS&&i instanceof Glodon$1.Bimface.Viewer.ViewerGIS,a=new Glodon$1.Web.Lang.EventManager,l=new Glodon$1.Bimface.Plugins.Drawable.DrawableContext;if(this.bIsEnableMinitagUpdate=!0,this.boxMap={},t._enableRender=e.enableRender,i.addEventListener("Rendered",(function(e){t.bIsEnableMinitagUpdate=!1,t.update(e),t.bIsEnableMinitagUpdate=!0})),o||r){let e=null,n=null;i.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.CameraPositionChanged,(function(i){n||(n=setTimeout((()=>{t.showOrHideLabelForCamearPosition(i.position),t.handleEnableDepthTest(i.position),n=null}),500)),e&&(clearTimeout(e),e=null),e=setTimeout((()=>{clearTimeout(n),n=null,t.showOrHideLabelForCamearPosition(i.position),t.handleEnableDepthTest(i.position)}),200)}))}r&&(i.addEventListener(Glodon$1.Bimface.Viewer.ViewerGISEvent.ViewChanged,(function(){t.handleEnableDepthTest()})),i.addEventListener(Glodon$1.Bimface.Viewer.ViewerGISEvent.LayerVisibleChanged,(function(){t.handleEnableDepthTest()}))),o&&(i.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.ViewChanged,(function(){t.handleEnableDepthTest()})),i.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.ViewLoaded,(function(){t.handleEnableDepthTest()})),i.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.ModelVisibleChanged,(function(){t.handleEnableDepthTest()})));let h=()=>{i.getViewer().registerEventListener(CLOUD.EVENTS.ON_EXPLOSION,(e=>{let t=this.getAllItems();for(let n=0,o=t.length;n<o;n++)t[n]instanceof Glodon$1.Bimface.Plugins.Drawable.MiniTag||ExplosionHelper.attachExplosionOffset(i,e.extent,t[n])}))};if(n)i.getRootElement().appendChild(l.rootDomElement);else if(s){i.getActiveDrawing().viewerDrawing.getRootElement().appendChild(l.rootDomElement)}else r?(i.getDomElement().appendChild(l.rootDomElement),this.calculateViewerGISExplosionOffset=e=>{const n=i.getViewer(),o=e.modelId,s=e.floorInfos.length,r=n.getFloorExplosionExtent(o),a=n.getFloorExplosionDirection(o);if(0===r)for(const e of t.getAllItems())e.setInitialExplosionInfo(i);const l=e.floorInfos;let h=[];for(var d=0;d<s;d++){let e=l[d],t=l[d+1],i=l[d-1];if(h.push({box:{min:i?e.boundingBox.min.z:-1/0,max:t?t.boundingBox.min.z:1/0},floorName:e.name,explodedOffset:e.explodedHeight-e.elevation}),h.length==s){this.boxMap[o]=h;break}}const c=i.getLayerManager();let u=this._items;for(let e=0,t=u.length;e<t;e++){if(!u[e].getWorldPosition())continue;const t=c.getLayer(u[e].layerId);if(!t||!t.modelId)continue;if(t.modelId.toString()!==o||!u[e].levelName)continue;let i=h.getObjectByAttribute("floorName",u[e].levelName);i&&(u[e].explosionOffset={x:a.x*i.explodedOffset,y:a.y*i.explodedOffset,z:a.z*i.explodedOffset})}},i.addEventListener(Glodon$1.Bimface.Viewer.ViewerGISEvent.FloorExplosion,(e=>{this.calculateViewerGISExplosionOffset(e)})),h()):(i.getDomElement().getElementsByClassName("bf-drawable-context").length>0?l.rootDomElement=i.getDomElement().getElementsByClassName("bf-drawable-context")[0]:i.getDomElement().appendChild(l.rootDomElement),e.affectedBySection&&(i.addEventListener(Glodon$1.Bimface.Plugins.Section.SectionBoxEvent.SectionBoxUpdate,(function(e){t.section=e,t.update()})),i.addEventListener(Glodon$1.Bimface.Plugins.Section.SectionPlaneEvent.SectionPlaneUpdate,(function(e){t.section=e,t.update()}))),this.calculateViewer3dExplosionOffset=e=>{const n=e.modelId,o=e.floorInfos.length,s=i.getDefaultModel().modelId.toString(),r=i.getModel(n).getFloorExplosionExtent(),a=i.getModel(n).getFloorExplosionDirection();if(0===r)for(const e of t.getAllItems())e.setInitialExplosionInfo(i);let l=[];t.floorInfos=e;var h=function(){let e=t._items;for(let i=0,o=e.length;i<o;i++){let o=e[i].getWorldPosition();if(o)if(!0!==e[i]._isBindRoom)if(e[i].levelName){let t=l.getObjectByAttribute("floorName",e[i].levelName);t&&(e[i].explosionOffset={x:a.x*t.explodedOffset,y:a.y*t.explodedOffset,z:a.z*t.explodedOffset})}else if(n!==s)e[i].explosionOffset={x:e[i].explosionOffset.x,y:e[i].explosionOffset.y,z:e[i].explosionOffset.z};else{let t=!0;for(let n=0;n<l.length;n++){const s=l[n];if(s.box.min<o.z&&s.box.max>o.z){e[i].explosionOffset={x:a.x*s.explodedOffset,y:a.y*s.explodedOffset,z:a.z*s.explodedOffset},e[i].levelName=s.floorName,t=!1;break}}t&&(e[i].explosionOffset={x:0,y:0,z:0})}else{const n=t._viewer.getViewer().modelManager.modelCollection.getById("ExtrudeBodyManager").getNode(e[i]._config.objectId),o=n.explodedHeight,s=n.explodedDirection;e[i].explosionOffset={x:s.x*o,y:s.y*o,z:s.z*o}}}};if(o)for(var d=0;d<o;d++){let i=e.floorInfos[d],n=e.floorInfos[d+1],s=e.floorInfos[d-1];l.push({box:{min:s?i.boundingBox.min.z:-1/0,max:n?n.boundingBox.min.z:1/0},floorName:i.name,explodedOffset:i.explodedHeight-i.elevation}),l.length==o&&(h(),t.boxs=l)}},i.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.FloorExplosion,(e=>{this.calculateViewer3dExplosionOffset(e)})),h());t._items=[],t._viewer=i,t._context=l,t._isDrawingView=n,t._isDrawingViewSet=s,t._isViewer3D=o,t._isViewerGIS=r,t._areaData={},t.loadAreas=void 0,t.addItemCallback=[],t._maxNum=e.maxNum,t.getEventManager=function(){return a}}showOrHideLabelForCamearPosition(e,t){if(this._isViewer3D||this._isViewerGIS){!e&&(e=this._viewer.getCameraStatus().position),t=t||this._items;for(let i=0;i<t.length;i++)if("number"==typeof t[i].visibleDistance){let n=t[i].worldPosition;Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2)+Math.pow(n.z-e.z,2))>t[i].visibleDistance?t[i].hideByCameraPosition():t[i].showByCameraPosition()}this.bIsEnableMinitagUpdate=!1,this.update(),this.bIsEnableMinitagUpdate=!0}}handleEnableDepthTest(e){(this._isViewer3D||this._isViewerGIS)&&this._items&&this._items.length>0&&this._items.map((t=>{this._viewer.getViewer().camera.frustum.containsPoint(this._viewer.worldToScene(t.worldPosition))&&t.handleEnableDepthTest(e)}))}addItem(i){t.send(e,"addItem");const n=this._items,o=this._viewer;if(i.viewer=o,i.update=this.update.bind(this),!i.worldPosition)return;if(i instanceof Glodon$1.Bimface.Plugins.Drawable.MiniTag)i.init(),n.push(i),this.update();else{let e=ExplosionHelper.ifExploded(o,i,this._isViewerGIS);e&&("Viewer3D"===this._viewer.getViewerType()&&e.setInitialExplosionInfo(this._viewer),n.push(e),this._enableRender&&this.update())}this.showOrHideLabelForCamearPosition(),i.handleEnableDepthTest&&i.handleEnableDepthTest()}getLevelNameById(e,t){if(!this._spatialRelation){let e=new Glodon$1.Bimface.Plugins.SpatialRelation.RoomConfig;e.viewer=this._viewer;let t=new Glodon$1.Bimface.Plugins.SpatialRelation.Room(e);this._spatialRelation=t}let i=this._spatialRelation.getBoundaryByRoomId(e);if(i){if(this._levelsInfo)return levelName=function(e,t){let i=e[0][2];for(let e=0;e<t.length;e++)if(Math.abs(i-t[e].elevation)<5)return t[e].name;return!1}(i,this._levelsInfo),levelName;(this._isViewer3D?this._viewer.getDefaultModel():this._viewer).getMapInfo((e=>{this._levelsInfo=e.axisGrid.Levels,this.addItem(t)}))}}removeItemById(i){t.send(e,"removeItemById");let n=this._items.removeObjectByAttribute("id",i);n=n&&n[0];let o=n._domElement||n._container;n&&this._context.rootDomElement.contains(o)&&o.remove(),n._svgGroup&&this._context.svgContainer.contains(n._svgGroup)&&this._context.svgContainer.removeChild(n._svgGroup),this.update()}getItemById(e){return this._items.getObjectByAttribute("id",e)}getAllItems(){return this._items}addItems(i){if(t.send(e,"addItems"),i.length)for(var n=0;n<i.length;n++)i[n].update=this.update.bind(this),i[n].viewer=this._viewer;if("Viewer3D"===this._viewer.getViewerType()||this._isViewerGIS)for(const e of i){e.viewer=this._viewer,e.init&&e.init();let t=ExplosionHelper.ifExploded(this._viewer,e,this._isViewerGIS);t&&this._items.push(t),e.setInitialExplosionInfo(this._viewer)}else for(const e of i)e.viewer=this._viewer,e.init&&e.init(),this._items.push(e);this._enableRender&&this.update()}clear(){t.send(e,"clear"),this._items.map((e=>{let t=e._domElement||e._container;e&&this._context.rootDomElement.contains(t)&&t.remove(),e._svgGroup&&this._context.svgContainer.contains(e._svgGroup)&&this._context.svgContainer.removeChild(e._svgGroup)})),this._items=[],this.update()}update(){let e=this._items,t=this._viewer,i=this._context,n=this._maxNum;var o=document.body.getBoundingClientRect(),s=Glodon$1.Bimface.Plugins.Drawable.MiniTag;if(this.bIsEnableMinitagUpdate&&s.clear(),this._isDrawingView&&(t=t.getViewer()),this._isDrawingView)for(let n=0,s=e.length;n<s;n++){let s=e[n].getWorldPosition();if(s)if(e[n]instanceof Glodon$1.Bimface.Plugins.Drawable.ClusterTag){let o=t.toScreenPoint([s.x,s.y]);i.clientPosition={x:o[0],y:o[1]},e[n].draw(i)}else{var r=t.toScreenPoint([s.x,s.y]);if(e[n]._domElement){var a=e[n]._domElement.offsetWidth/2,l=e[n]._domElement.offsetHeight/2;if(e[n].isHideByClustering){e[n]._domElement.style.display="none";continue}if(r[0]<-a||r[0]>o.width+a||r[1]<-l||r[1]>o.height+l){e[n]._domElement.style.display="none";continue}e[n]._domElement.style.display="block",e[n].updateVisibility()}i.clientPosition={x:r[0],y:r[1]},e[n].draw(i)}}else if(this._isDrawingViewSet)for(let n=0,o=e.length;n<o;n++){let o=e[n].getWorldPosition();r=t.getDrawingById(e[n].viewerDrawingId).viewerDrawing.worldToClient(o);if(i.clientPosition=r,e[n]instanceof Glodon$1.Bimface.Plugins.Drawable.ClusterTag){let s=t.toScreenPoint([o.x,o.y]);i.clientPosition={x:s[0],y:s[1]},e[n].draw(i)}else e[n].updateVisibility(),e[n].draw(i)}else{for(let i=0,n=e.length;i<n;i++){let n=e[i];n.needForceUpdate&&(n=ExplosionHelper.ifExploded(t,n,this._isViewerGIS),n.needForceUpdate=!1);let o=n.getCurrentPosition();n.clientPosition=t.worldToClient(o);let s=n._container||n._domElement,r=n._svgGroup;if(n instanceof Glodon$1.Bimface.Plugins.Drawable.MiniTag||t.isInViewFrustum(o)){if(this.isHideFromSection(o)||n.forceHide||n.isHideByClustering&&!0!==n.isInAnimation){s&&(s.style.display="none"),r&&(r.style.display="none");continue}s&&(s.style.display=""),r&&(r.style.display="")}else s&&(s.style.display="none"),r&&(r.style.display="none")}e.sort((function(e,t){return e.clientPosition.z>=t.clientPosition.z?1:-1}));for(let t=0;t<e.length;t++){var h="default";t>=n&&(h="mini"),i.clientPosition=e[t].clientPosition,e[t]instanceof Glodon$1.Bimface.Plugins.Drawable.MiniTag&&0==this.bIsEnableMinitagUpdate||e[t].draw(i,h)}}}isHideFromSection(e){if(!this.section)return!1;if("SectionBox"===this.section.id){let t=this._viewer.getViewer().editorManager.getToolByName("clipByBox").isReverse,i=this.section.isIncluded(e);return t?i:!i}return!this.section.isIncluded(e)}exit(){t.send(e,"exit"),this.clear(),this._context.destroy()}hideItemsById(i){t.send(e,"hideItemsById");let n=this;if(i&&i.length>0)for(let e=0;e<i.length;e++){var o=n.getItemById(i[e]);o&&o.hide()}}hideAllItems(){t.send(e,"hideAllItems");let i=this._items;if(i&&i.length>0)for(let e=0;e<i.length;e++)i[e].hide()}showItemsById(i){t.send(e,"showItemsById");let n=this;if(i&&i.length>0)for(let e=0;e<i.length;e++){var o=n.getItemById(i[e]);o&&o.show()}}showAllItems(){t.send(e,"showAllItems");let i=this._items;if(i&&i.length>0)for(let e=0;e<i.length;e++)i[e].show()}removeClusterTags(e){let t=this.getAllItems();for(let i=t.length-1;i>=0;){let o=t[i];if(o instanceof n&&o.clusterItemId===e){t.splice(i--,1);let e=o.getContainer();this._context.rootDomElement.contains(e)&&e.remove()}else i--}}showItemsByLayerId(i){t.send(e,"showItemsByLayerId");let n=this.getAllItems();for(let e=n.length-1;e>=0;e--){let t=n[e];t.layerId==i&&t.show()}}hideItemsByLayerId(i){t.send(e,"hideItemsByLayerId");let n=this.getAllItems();for(let e=n.length-1;e>=0;e--){let t=n[e];t.layerId==i&&t.hide()}}removeItemsByLayerId(i){t.send(e,"removeItemsByLayerId");let n=this.getAllItems();for(let e=n.length-1;e>=0;){let t=n[e];if(t.layerId==i){let i=t._domElement||t._container;t&&this._context.rootDomElement.contains(i)&&i.remove(),t._svgGroup&&t._svgGroup.parentElement.removeChild(t._svgGroup),n.splice(e--,1)}else e--}}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Cluster").ClusterContainerConfig=function(){return{viewer:null,enableAnimation:!0}},function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Cluster")),i=Glodon$1.Web.Lang.Utility.performance;t.ClusterContainer=class{constructor(t){e.send("Bimface.Plugins.Cluster","ClusterContainer"),this.viewer=t.viewer,this.isViewer3D="Viewer3D"===t.viewer.getViewerType()||"ViewerGIS"===t.viewer.getViewerType(),this.clusterItems=[],this._lastZoomFactorData=null,this.hookEvents(t.viewer),this.enableAnimation=!1!==t.enableAnimation,skipVueObserver(this)}hookEvents(e){let t=e.getViewerType();this.isViewer3D?this.hookViewer3DEvents():"ViewerDrawing"===t?this.hookViewerDrawingEvents():this.hookViewerDrawingSetEvents()}hookViewer3DEvents(){var e=this.viewer.getViewer();let t=[];t.push(CLOUD.EVENTS.ON_EDITOR_ZOOM),t.push(CLOUD.EVENTS.ON_EDITOR_PANING),t.push(CLOUD.EVENTS.ON_EDITOR_ROTATING),t.push(CLOUD.EVENTS.ON_EDITOR_WALKING),t.push(CLOUD.EVENTS.ON_CAMERA_ANIMATION_UPDATE);for(const i of t)e.registerEventListener(i,(()=>{this.update()}));e.registerEventListener(CLOUD.EVENTS.ON_EXPLOSION,(()=>{this.update(!0)})),this.viewer.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.FloorExplosion,(()=>{for(const e of this.clusterItems)e.meanShift=null;this.update(!0)}))}hookViewerDrawingEvents(){let e=Glodon$1.Bimface.Viewer.ViewerDrawingEvent;this.viewer.addEventListener(e.ZoomFactorChanged,(e=>{let t=!1;(null===this._lastZoomFactorData||e>=this._lastZoomFactorData)&&(t=!0),this.update(!1,t),this._lastZoomFactorData=e}))}hookViewerDrawingSetEvents(){let e=Glodon$1.Bimface.Viewer.ViewerDrawingSetEvent;this.viewer.addEventListener(e.ZoomFactorChanged,(e=>{let t=!1;(null===this._lastZoomFactorData||e>=this._lastZoomFactorData)&&(t=!0),this.update(!1,t),this._lastZoomFactorData=e}))}addCluster(e){e.viewer=this.viewer,e.init(),this.clusterItems.push(e),e.setIsNeedMakingClusterTag(!0)}addClusters(e){for(const t of e)this.addCluster(t)}getClusterById(e){for(const t of this.clusterItems)if(t.getId()===e)return t;return null}getClusters(){return this.clusterItems}removeClustersById(e){let t=this.clusterItems;for(let i=t.length-1;i>=0;){let n=t[i];e.indexOf(n.id)>=0?(n.clearClusterTags(),t.splice(i--,1)):i--}}clear(){for(const e of this.clusterItems)e.clearClusterTags();this.clusterItems=[]}update(e,t){let n=(e,t)=>{for(const i of this.clusterItems){if(this.isViewer3D){if(0===i.calcClusterLevel()){i.clearClusterTags();continue}}(e||i.isNeedClustering())&&i.clustering(t),i.updateClusterTags(this.enableAnimation)}};this.throttleAndDebounceFun||(this.throttleAndDebounceFun=i.throttleAndDebounce(n)),this.isViewer3D?this.throttleAndDebounceFun(e,t):n(e,t)}enableClusterAnimation(e){this.enableAnimation=e}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Cluster").ClusterItemConfig=function(){return{scale:1,tags:[],distance:50,maxLevel:4,style:Glodon$1.Bimface.Plugins.Cluster.ClusterStyle.Success,minClusterSize:2,viewer:null,showDetails:!1}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Cluster");let t=Object.freeze({Danger:"#FF001F",Information:"#1A82FC",Success:"#32D3A6",Warning:"#FF9D0B"});e.ClusterStyle=t}();class ClusterItem3DImpl{constructor(e){this.viewer3d=e.viewer,this.currentLevel=0,this._maxLevel=e.maxLevel,this._minClusterSize=e.minClusterSize,this._sceneSize=new THREE.Vector3}prepareTagPositions(e){let t=[];for(let i=0;i<e.length;i++){let n=e[i].getCurrentPosition(),o=new Vector3(n.x,n.y,n.z);o.index=i,t.push(o)}return t}calcSearchRange(e){return this.currentLevel=this.calcClusterLevel(e),this.getSearchRangeScalar(this.currentLevel,this.getMaxLevel())*this.getLength(e)[1]}getSearchRangeScalar(e,t){return.5**(t-e)}calcClusterLevel(e){if(!e)return 0;let t=this.getLength(e),i=this.getMaxLevel(),n=20*t[1]/t[2],o=t[0]*n/t[1],s=Math.exp(Math.log(40)/(i-1)),r=-1;for(let e=i;e>=1;e--)if(o>=.5*s**(e-1)){r=e;break}return-1===r&&(r=0),0===t[1]&&(r=1),r}getLength(e){let t=this.prepareTagPositions(e),i=this.viewer3d.getCameraStatus().position;i=new Vector3(i.x,i.y,i.z);let n=(new Box3).setFromPoints(t).getSize().length(),o=i.distanceTo(t[0]);t.forEach((e=>{const t=i.distanceTo(e);o=Math.min(o,t)}));let s=.995*this.getCameraMaxRange(),r=[];return r.push(o),r.push(n),r.push(s),r}getCameraMaxRange(){var e=this.viewer3d.getViewer(),t=e.camera;e.getBoundingBoxWorld().getSize(this._sceneSize);const i=.5*this.viewer3d.globalUnitUtil.revertTranslate(this._sceneSize.length())/Math.tan(THREE.Math.degToRad(.5*t.fov));return e.cameraControl.getMaximalRangeofCamera()*i}setMaxLevel(e){this._maxLevel=e}getMaxLevel(){return this._maxLevel}getMinClusterSize(){return this._minClusterSize}setMinClusterSize(e){this._minClusterSize=e}isLevelChanged(e){return this.calcClusterLevel(e)!==this.currentLevel}cullingByFrustum(e){for(const t of e){this.viewer3d.isInViewFrustum(t.worldPosition)?t.show():t.hide()}}getBoundingbox(e){return e.min=e.bbox.min,e.max=e.bbox.max,e}getCenter(e){return e.center}setDistance(){console.log("ClusterItem3D doesn't support setDistance.")}getDistance(){console.log("ClusterItem3D doesn't support getDistance.")}clustering(e,t){e.clustering(t,!0)}}class ClusterItemDrawingImpl{constructor(e){this.viewerDrawing=e.viewer,this.searchRange=e.distance,this._minClusterSize=e.minClusterSize}prepareTagPositions(e){let t=[];for(let i=0;i<e.length;i++){let n=e[i].getWorldPosition();n=this.viewerDrawing.worldToClient(n);let o=new Vector3(n.x,n.y,n.z);o.index=i,t.push(o)}return t}calcSearchRange(e){return this.searchRange}isLevelChanged(){return!0}setDistance(e){this.searchRange=e}getDistance(){return this.searchRange}setMaxLevel(e){console.log("Drawing clustering has no maxlevel.")}getMaxLevel(){console.log("Drawing clustering has no maxLevel.")}getMinClusterSize(){return this._minClusterSize}setMinClusterSize(e){this._minClusterSize=e}cullingByFrustum(){}getBoundingbox(e){return e}getCenter(e){let t=e.center;return this.viewerDrawing.clientToWorld(t)}clustering(e,t){e.clustering(t,!1,(e=>{const t=this.viewerDrawing.getViewer(),i=t.width,n=t.height;return!(e.x<0||e.x>i||e.y<0||e.y>n)}))}}class ClusterAnimation{constructor(){}}ClusterAnimation.time=300,ClusterAnimation.Play=function(e){const{clusterTags:t,lastClusterTags:i,clusters:n,lastClusters:o,enableAnimation:s,isZoomIn:r,tags:a,container:l}=e;(()=>{for(const e of t)e.updateText()})();!1===s||null===o||(()=>{const e=n.length;if(e!==o.length)return!1;for(let t=0;t<e;t++)if(n[t].id!==o[t].id)return!1;return!0})()||(!0===r?ClusterAnimation.ZoomInPlay(t,i,n,o,a):ClusterAnimation.ZoomOutPlay(t,i,n,o,a,l))},ClusterAnimation.getCluster=function(e,t){for(const i of e)if(i.id===t)return i},ClusterAnimation.getClusterTag=function(e,t){for(const i of e)if(i.clusterBbox.id===t)return i},ClusterAnimation.getIndices=function(e){let t=[];for(const i of e.points)t.push(i.index);return t},ClusterAnimation.getEndClientPosition=function(e){return e instanceof Glodon.Bimface.Plugins.Marker3D.Marker3D?e.position:"Viewer3D"===e.viewer.viewerType||"ViewerGIS"===e.viewer.viewerType?{x:e.worldPosition.x+e.explosionOffset.x,y:e.worldPosition.y+e.explosionOffset.y,z:e.worldPosition.z+e.explosionOffset.z}:e.viewer.worldToClient(e.worldPosition)},ClusterAnimation.ZoomInPlay=function(e,t,i,n,o,s){for(const n of i){if(n.id===n.parent)continue;const i=n.parent,s=ClusterAnimation.getClusterTag(t,i);for(const r of t)if(r.clusterBbox.id===i){const t=ClusterAnimation.getClusterTag(e,n.id),i=r.clusterBbox.center;let a=null;if(t){a=t.clusterBbox.center,ClusterAnimation.CreateZoomAnimation(t,s,i,a,!0);continue}const l=ClusterAnimation.getIndices(n);for(const e of l){let t=o[e];t&&(a=ClusterAnimation.getEndClientPosition(t),a&&(t.setContainerVisible(!0),ClusterAnimation.CreateZoomAnimation(t,s,i,a,!0)))}}}},ClusterAnimation.CreateZoomAnimation=function(e,t,i,n,o,s){let r=0,a=e.getOpacity(),l=a;t.show(),!0===o&&(r=1,a=0),t.setOpacity(r),e.setOpacity(a);let h=(new Date).valueOf(),d=h-16,c=0,u=()=>{const o=requestAnimationFrame(u);if(c>=1)return c=1,e.resetClientPosition(n),e.setOpacity(l),s&&s(),void cancelAnimationFrame(o);(o=>{const s={x:i.x+(n.x-i.x)*o,y:i.y+(n.y-i.y)*o,z:i.z+(n.z-i.z)*o};t.setOpacity(Math.abs(r-o)),e.setOpacity(l*Math.abs(1-r-o)),e.resetClientPosition(s)})(c),h=(new Date).valueOf();const a=h-d;d=h,c+=a/this.time};u()},ClusterAnimation.ZoomOutPlay=function(e,t,i,n,o,s){for(const r of i){const i=r.children;if(0===i.length)continue;const a=ClusterAnimation.getClusterTag(e,r.id);if(a)for(const e of i){const i=ClusterAnimation.getClusterTag(t,e),l=r.center;let h=null;if(i){h=i.clusterBbox.center,ClusterAnimation.CreateZoomOutAnimation(i,a,h,l,s);continue}const d=ClusterAnimation.getCluster(n,e),c=ClusterAnimation.getIndices(d);for(const e of c){let t=o[e];t&&(h=ClusterAnimation.getEndClientPosition(t),h&&ClusterAnimation.CreateItemZoomOutAnimation(t,a,h,l,s))}}}},ClusterAnimation.CreateZoomOutAnimation=function(e,t,i,n,o){const s=e.getContainer();o._context.rootDomElement.appendChild(s),ClusterAnimation.CreateZoomAnimation(e,t,i,n,!1,(()=>{t.show(),s.remove()}))},ClusterAnimation.CreateItemZoomOutAnimation=function(e,t,i,n,o){e.setContainerVisible(!0),e.isInAnimation=!0,ClusterAnimation.CreateZoomAnimation(e,t,i,n,!1,(()=>{t.show(),e.isInAnimation=null,e.setContainerVisible(!1)}))},function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Cluster"));class i{constructor(t){e.send("Bimface.Plugins.Cluster","ClusterItem"),this.config=t,this.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.setTags(t.tags),this._isVisible=!0,this.clusterTags=[],this._mapTagIsExist={},this._mapClusterTags={},this.mapDrawableStyle={},this.mapClusterException={},this.onClusterChanged=null,this.clusterStyle=t.style,this.scale=t.scale,this._isNeedClustering=!0,this._isNeedMakingClusterTag=!0,this.meanShift=null,this._lastSearchRange=null,this._lastClusters=null,this._lastClusterTags=null,skipVueObserver(this)}init(){this.isViewer3D="Viewer3D"===this.viewer.getViewerType()||"ViewerGIS"===this.viewer.getViewerType(),this.config.viewer=this.viewer,this.impl=this.isViewer3D?new ClusterItem3DImpl(this.config):new ClusterItemDrawingImpl(this.config)}setScale(e){this.scale=e,this.makeClusterTags()}getScale(){return this.scale}getId(){return this.id}getTags(){return this._tags}addTags(e){for(let t=0;t<e.length;t++){let i=e[t];i instanceof Glodon$1.Bimface.Plugins.Drawable.MiniTag||!0!==this._mapTagIsExist[i.id]&&(this._tags.push(i),this._mapTagIsExist[i.id]=!0)}this._isNeedClustering=!0,this.meanShift=null}getMinClusterSize(){return this.impl.getMinClusterSize()}setMinClusterSize(e){"number"==typeof e&&e>0?(this.impl.setMinClusterSize(e),this._isNeedClustering=!0):console.log("Invalid param, please input valid param.")}setTags(e){if(0!==e.length){if(this._tags)for(const e of this._tags)e.isHideByClustering=!1;this._tags=[],this._mapTagIsExist={},this.addTags(e)}}removeTagsByIds(e){for(let t=this._tags.length-1;t>=0;){let i=this._tags[t];e.indexOf(i.id)>=0?(this._tags.splice(t--,1),delete this._mapTagIsExist[i.id],i.isHideByClustering=!1):t--}this._isNeedClustering=!0,this.meanShift=null}setDistance(e){this.impl.setDistance(e)}getDistance(){return this.impl.getDistance()}getMaxLevel(){return this.impl.getMaxLevel()}setMaxLevel(e){this.impl.setMaxLevel(e),this._isNeedClustering=!0}onClick(e){this.onClickCallback=e;for(const e of this.clusterTags)e.onClick(this.onClickCallback)}onDoubleClick(e){this.onDoubleClickCallback=e;for(const e of this.clusterTags)e.onClick(this.onDoubleClickCallback)}onHover(e){this.onHoverCallback=e;for(const e of this.clusterTags)e.onClick(this.onHoverCallback)}hide(){for(const e of this.clusterTags)e.hide();for(let e=0;e<this._tags.length;e++)this._tags[e].isHideByClustering=!0;this._getContainer().update(),this._isVisible=!1}show(){for(const e of this.clusterTags)e.show();this._isVisible=!0,this.clustering(),this.updateClusterTags()}getClusterTagById(e){for(const t of this.clusterTags)if(t.isInclude(e))return t;return null}getClusterTag(e){let t=this._mapClusterTags[e];return t||(console.log("Can't find a cluster tag whose id is "+e),null)}onClusterChange(e){this.onClusterChanged=e}getStyle(){return this.clusterStyle}setStyle(e){this.clusterStyle=e;for(const t of this.clusterTags)t.setStyle(e)}getStyleById(e){let t=this.getClusterTag(e);return t&&t.getStyle()}setStyleById(e,t){let i=this.getClusterTag(e);return i&&i.setStyle(t)}setException(e,t){[].concat(e).forEach((e=>{this.mapDrawableStyle[e]=t}))}removeException(e){[].concat(e).forEach((e=>{delete this.mapDrawableStyle[e]}))}clearException(){let e=Object.keys(this.mapDrawableStyle),t=Glodon$1.Bimface.Plugins.Cluster.ClusterStyle.Success;e.forEach((e=>{this.mapDrawableStyle[e]=t}))}_updateMapException(){let e=Object.keys(this.mapDrawableStyle);this.mapClusterException={};let t=this.mapClusterException;for(const i of e){let e=this.getClusterTagById(i);if(!e)continue;let n=e.getId(),o=this.mapDrawableStyle[i];t[n]||(t[n]={}),t[n][o]=!0}}_updateCurrentStyle(){this._updateMapException();for(const e of this.clusterTags){let t=e.getId(),i=this.mapClusterException;if(!i[t]){this.setStyleById(t,this.clusterStyle);continue}let n=this._getStyleInOrder(i[t]);n&&this.setStyleById(t,n)}}_getStyleInOrder(e){let t=Glodon$1.Bimface.Plugins.Cluster.ClusterStyle,i=[t.Danger,t.Warning,t.Information,t.Success];for(const t of i)if(e[t])return t;return t.Success}clustering(e){if(!1===this._isVisible)return;let t=this.getTags();for(const e of t)e.isHideByClustering=!1;let i=this.impl.calcSearchRange(this.getTags()),n=this.impl.prepareTagPositions(this.getTags());null===this.meanShift&&(this.meanShift=new Glodon$1.Web.Algorithm.MeanShift(n,i)),this.meanShift.setSearchRange(i),this.meanShift.setPoints(n);let o=!0;null!=this._lastSearchRange&&this._lastSearchRange<i&&(o=!1),this.isZoomIn=void 0!==e?e:o,this.impl.clustering(this.meanShift,this.isZoomIn),this._lastSearchRange=i,this._isNeedClustering=!1,this._isNeedMakingClusterTag=!0}updateClusterTags(e){if(!1!==this._isVisible)if(this.isNeedMakingClusterTag())this.makeClusterTags(e),!1===this._isVisible&&this.hide(),this._isNeedMakingClusterTag=!1,this.onClusterChanged&&this.onClusterChanged();else if(this._isVisible)return this.impl.cullingByFrustum(this.clusterTags),this._getClusterContainer().update(),void this._updateCurrentStyle()}makeClusterTags(e){for(let e=0;e<this._tags.length;e++)this._tags[e].isHideByClustering=!1,!0===this._tags[e].forceHide&&(this._tags[e].forceHide=!1);this.clusterTags=[],this._mapClusterTags={};let t=!1;for(const e of this.meanShift.clusters){let n=this._getIndices(e);if(n.length<this.impl.getMinClusterSize())continue;let o=i.makeClusterTag(this.impl.getCenter(e),t,this.scale);t=!0;for(const t of n){let i=this._tags[t];i&&(i.isHideByClustering=!0,o.include(i),o.setBoundingBox(this.impl.getBoundingbox(e)))}o.clusterItemId=this.id,o.showDetails=this.config.showDetails,this.onClickCallback&&o.onClick(this.onClickCallback),this.onDoubleClickCallback&&o.onDoubleClick(this.onDoubleClickCallback),this.onHoverCallback&&o.onHover(this.onHoverCallback),this.clusterTags.push(o),this._mapClusterTags[o.getId()]=o}this.impl.cullingByFrustum(this.clusterTags),this._getClusterContainer().removeClusterTags(this.id),this._getClusterContainer().addItems(this.clusterTags),this._updateCurrentStyle();let n=this._getContainer();n.update(),!0===n.isMarker3DContainer&&(e=!1);const o={clusterTags:this.clusterTags,lastClusterTags:this._lastClusterTags,clusters:this.meanShift.clusters,lastClusters:this._lastClusters,enableAnimation:e,isZoomIn:this.isZoomIn,tags:this._tags,container:this.viewer.drawableContainer};ClusterAnimation.Play(o),this._lastClusterTags=this.clusterTags,this._lastClusters=this.meanShift.clusters}clearClusterTags(){if(!this._tags)return;for(let e=0;e<this._tags.length;e++)this._tags[e].isHideByClustering=!1,!0===this._tags[e].forceHide&&(this._tags[e].forceHide=!1);this._getClusterContainer().removeClusterTags(this.id),this._getContainer().update()}calcClusterLevel(){return this.impl.calcClusterLevel(this.getTags())}_getClusterContainer(){let e=this.viewer.drawableContainer;if(!e){var t=new Glodon$1.Bimface.Plugins.Drawable.DrawableContainerConfig;t.viewer=this.viewer,e=new Glodon$1.Bimface.Plugins.Drawable.DrawableContainer(t)}return e}isNeedClustering(){return this._isNeedClustering||this.impl.isLevelChanged(this.getTags())}isNeedMakingClusterTag(){return this._isNeedMakingClusterTag}setIsNeedMakingClusterTag(e){this._isNeedMakingClusterTag=e}_getContainer(){return this._tags[0]instanceof Glodon$1.Bimface.Plugins.Marker3D.Marker3D?this.viewer.marker3DContainer:this.viewer.drawableContainer}_getIndices(e){let t=[];for(const i of e.points)t.push(i.index);return t}}i.makeClusterTag=function(e,t,i){let n=new Glodon$1.Bimface.Plugins.Drawable.ClusterTagConfig;n.worldPosition=e,n.attachFilter=!t;let o=new Glodon$1.Bimface.Plugins.Drawable.ClusterTag(n);return o.setScale(i),o},t.ClusterItem=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").MeasureConfig=function(){return{viewer:null,measureType:Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Distance,color:new Glodon$1.Web.Graphics.Color(249,157,11,1),hoverColor:new Glodon$1.Web.Graphics.Color(17,218,183,.2),width:3,radius:25,snapDistance:5,precision:{distance:3,elevation:3,area:3,angle:2,latLon:9},scale:1,units:null,layerType:"TerrainLayer",enableAuxiliaryValue:!1,initialElevation:0,laserXYZ:["X","Y","Z"],minimumDistanceZoom:!1}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure");let t=Object.freeze({Measuring:"Measuring",Measured:"Measured",Reset:"Reset",MeasureSelected:"MeasureSelected",MeasureUnselected:"MeasureUnselected",MeasureResultUpdating:"MeasureResultUpdating",MeasureResultUpdated:"MeasureResultUpdated"});e.MeasureEvent=t}(),function(){let e=Object.freeze({Distance:"Distance",Area:"Area",Angle:"Angle",MinimumDistance:"MinimumDistance",Elevation:"Elevation",Position:"Position",PolylineDistance:"PolylineDistance",TriangleDistance:"TriangleDistance",SpatialArea:"SpatialArea",ProjectedArea:"ProjectedArea",SurfaceArea:"SurfaceArea",GroundlineDistance:"GroundlineDistance",Volume:"Volume",LaserClearDistance:"LaserClearDistance",Slope:"Slope"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").MeasureTypeOption=e}(),function(){let e=Object.freeze({None:"None",Kilometer:"Kilometer",Meter:"Meter",Centimeter:"Centimeter",Millimeter:"Millimeter"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").LengthUnits=e}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").MeasureItemConfig=function(){return{id:null,color:new Glodon$1.Web.Graphics.Color(255,157,11,1),hoverColor:new Glodon$1.Web.Graphics.Color(17,218,183,.2),fillColor:new Glodon$1.Web.Graphics.Color(255,157,11,.2),objectColor:new Glodon$1.Web.Graphics.Color(17,218,183,.9),width:3,radius:25,viewer:null}};class MeasureUtil{}MeasureUtil.xmlns="http://www.w3.org/2000/svg",MeasureUtil.makeCircle=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"circle");return t.style.fill=e.color,t.setAttribute("r",e.radius+""),t.setAttribute("stroke","#FFFFFF"),t.setAttribute("stroke-width",e.strokeWidth),t.setAttribute("transform","translate("+e.position.x+","+e.position.y+")"),t},MeasureUtil.makeConcentricCircle=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"g"),i=document.createElementNS(MeasureUtil.xmlns,"circle");i.style.fill=e.color,i.setAttribute("r",e.innerRadius+""),i.setAttribute("stroke","#FFFFFF"),i.setAttribute("stroke-width",e.innerStrokeWidth),i.setAttribute("transform","translate("+e.position.x+","+e.position.y+")");var n=i.cloneNode();return n.setAttribute("r",e.outerRadius+""),n.setAttribute("stroke-width",e.outerStrokeWidth||0),t.appendChild(n),t.appendChild(i),t},MeasureUtil.makeLine=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"line");return t.setAttribute("stroke",e.color),t.setAttribute("stroke-width",e.lineWidth),t.setAttribute("x1",e.start.x+""),t.setAttribute("y1",e.start.y+""),t.setAttribute("x2",e.end.x+""),t.setAttribute("y2",e.end.y+""),t},MeasureUtil.makeDashLine=function(e){let t=MeasureUtil.makeLine(e);return t.setAttribute("stroke-dasharray",e.dashArray||"10 8"),t},MeasureUtil.makePath=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"path");let i=e.info;return t.setAttribute("d",`M ${i.pointA.x} ${i.pointA.y} A ${e.arcRadius} ${e.arcRadius} 0 0 ${i.direction} ${i.pointB.x} ${i.pointB.y}`),t.setAttribute("fill","rgba(0,0,0,0)"),t.setAttribute("stroke",e.color),t.setAttribute("stroke-width",e.lineWidth),t},MeasureUtil.makePolyline=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"polyline");return t.setAttribute("stroke",e.color),t.setAttribute("stroke-width",e.width),t.style.fill=e.fillColor||"none",t.style.opacity=e.opacity||1,t.setAttribute("points",e.points),t},MeasureUtil.makePolygon=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"polygon");return t.setAttribute("stroke",e.color),t.setAttribute("stroke-width",e.width),t.style.fill=e.fillColor||"none",t.setAttribute("points",e.points),t},MeasureUtil.calcPolylinePoints=function(e){for(var t="",i=0;i<e.length;i++)t+=e[i].x+","+e[i].y+" ";return t},MeasureUtil.makeRectangle=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"rect");return t.setAttribute("stroke-width",2),t.setAttribute("x",e.x),t.setAttribute("y",e.y),t.setAttribute("width",e.width),t.setAttribute("height",e.height),t.setAttribute("rx",e.radius),t.style.fill=e.fillColor||"none",t.setAttribute("fill-opacity",e.fillOpacity||1),t.setAttribute("stroke",e.strokeColor||"none"),t},MeasureUtil.makeMarker=function(e){var t=document.createElementNS(this.xmlns,"marker");t.setAttribute("id",e.id),t.setAttribute("viewBox","0 0 10 10"),t.setAttribute("refX","5"),t.setAttribute("refY","5"),t.setAttribute("markerWidth",e.markerWidth||"6"),t.setAttribute("markerHeight",e.markerHeight||"6"),t.setAttribute("orient","auto-start-reverse");var i=document.createElementNS(this.xmlns,"path");i.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),i.style.fill=e.color,t.appendChild(i);let n=MeasureUtil.makeDefs();return n.appendChild(t),n},MeasureUtil.makeText=function(e){var t=document.createElementNS(MeasureUtil.xmlns,"text");t.setAttribute("x",e.x),t.setAttribute("y",e.y),t.setAttribute("fill",e.color||"#000"),t.setAttribute("font-size",e.fontsize);var i=e.content?e.content.split("\n"):[""];if(i.length>1)for(let o=0;o<i.length;o++){var n=document.createElementNS(MeasureUtil.xmlns,"tspan");n.setAttribute("x",e.x),n.setAttribute("y",e.y+30*o),n.textContent=i[o],t.appendChild(n)}else t.textContent=i[0];return t},MeasureUtil.makeDefs=function(){return document.createElementNS(this.xmlns,"defs")},MeasureUtil.measureText=function(e,t='14px "Microsoft YaHei'){var i=document.createElement("canvas").getContext("2d");return i.font=t,i.measureText(e).width},MeasureUtil.distanceToSegment=function(e,t,i){var n=t.distanceToSquared(i);if(0==n)return e.distanceTo(t);var o=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/n;o=Math.max(0,Math.min(1,o));let s=new Vector2;return s.x=t.x+o*(i.x-t.x),s.y=t.y+o*(i.y-t.y),e.distanceTo(s)},MeasureUtil.isPointInPolygon=function(e,t){let i=0,n=t.length;for(let o=0;o<n;o++){let s=t[o],r=t[(o+1)%n];s.y!=r.y&&(e.y<Math.min(s.y,r.y)||e.y>=Math.max(s.y,r.y)||(e.y-s.y)*(r.x-s.x)/(r.y-s.y)+s.x>e.x&&i++)}return i%2==1},MeasureUtil.isPointInTriangle=function(e,t){const{a:i,b:n,c:o}=t;let s=n.clone().sub(i),r=o.clone().sub(i),a=e.clone().sub(i),l=s.clone().cross(r),h=s.clone().cross(a);return l.dot(h)>=0},MeasureUtil.calcSpatialArea=function(e){if(e.length<3)return 0;let t=0,i=MeasureUtil.getAllTriangle(e);for(let e=0;e<i.length;e++){t+=(new THREE.Triangle).set(i[e][0],i[e][1],i[e][2]).getArea()}return t},MeasureUtil.getAllTriangle=function(e){let t,i,n,o,s,r,a,l,h=[];return t=function(e){if(e.length<3)return;if(3==e.length)return void l(e[0],e[1],e[2]);let o=[e[0],e[1],e[2]],r=[e[0],e[1],e[2]],a=(new THREE.Plane).setFromCoplanarPoints(new THREE.Vector3(e[0].x,e[0].y,e[0].z),new THREE.Vector3(e[1].x,e[1].y,e[1].z),new THREE.Vector3(e[2].x,e[2].y,e[2].z));for(let t=3;t<e.length;t++){if(!i([e[0],e[1],e[2]],e[t]))break;{let i=new THREE.Vector3;if(a.projectPoint(new THREE.Vector3(e[t].x,e[t].y,e[t].z),i),!n([...r,i,r[0]]))break;o.push(e[t]),r.push(i)}}if(o.length>3){s(o);let i=JSON.parse(JSON.stringify(e));if(i.splice(1,o.length-2),2===i.length)return;t(i)}else{l(e[0],e[1],e[2]);let i=JSON.parse(JSON.stringify(e));i.splice(1,1),t(i)}},i=function(e,t){let i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Triangle;o.set(e[0],e[1],e[2]);let s=new THREE.Triangle;s.set(e[0],e[2],t);let r=o.getNormal(i),a=s.getNormal(n),l=r.angleTo(a);return Math.abs(l-3.1415)<2e-4||Math.abs(l)<2e-4},n=function(e){for(let t=0;t<e.length-1;t++)for(let i=t+2;i<e.length-1;i++)if((0!=t||i!=e.length-2)&&o(new THREE.Vector3(e[t].x,e[t].y,e[t].z),new THREE.Vector3(e[t+1].x,e[t+1].y,e[t+1].z),new THREE.Vector3(e[i].x,e[i].y,e[i].z),new THREE.Vector3(e[i+1].x,e[i+1].y,e[i+1].z)))return!1;return!0},o=function(e,t,i,n){const o=1e-5;function s(e,t,i){return!!(CLOUD.Math.lessThanOrEquals(i.x,Math.max(e.x,t.x),o)&&CLOUD.Math.lessThanOrEquals(Math.min(e.x,t.x),i.x,o)&&CLOUD.Math.lessThanOrEquals(i.y,Math.max(e.y,t.y),o)&&CLOUD.Math.lessThanOrEquals(Math.min(e.y,t.y),i.y,o)&&CLOUD.Math.lessThanOrEquals(i.z,Math.max(e.z,t.z),o)&&CLOUD.Math.lessThanOrEquals(Math.min(e.z,t.z),i.z,o))}var r=(new THREE.Vector3).subVectors(t,e),a=(new THREE.Vector3).subVectors(n,i);if(CLOUD.Math.equalsEpsilon(r.dot(a),o))return!1;var l=(new THREE.Vector3).subVectors(i,e),h=(new THREE.Vector3).crossVectors(r,a),d=(new THREE.Vector3).crossVectors(l,a),c=l.dot(h);if(!CLOUD.Math.equalsEpsilon(h.lengthSq(),o)){var u=d.dot(h)/h.lengthSq();if(!CLOUD.Math.lessThan(1,u,o)&&!CLOUD.Math.lessThan(c,0,o)){var p=e.clone().add(new THREE.Vector3(r.x*u,r.y*u,r.z*u));return s(e,t,p)&&s(i,n,p)?p:void 0}}},s=function(e){if(3!==e.length)for(let t=2;t<e.length;t++){let i=[e[t-2],e[t-1],e[t]],n=!1;for(let o=t+1;o<e.length;o++){if(r(i,e[o])){n=!0;break}}let o=new THREE.Vector3;new THREE.Triangle(e[t-2],e[t-1],e[t]).getMidpoint(o);let h=a(e,o);if(!n&&h){l(i[0],i[1],i[2]);let n=JSON.parse(JSON.stringify(e));return n.splice(t-1,1),s(n)}}else l(e[0],e[1],e[2])},r=function(e,t){let i=new THREE.Vector3(e[0].x,e[0].y,e[0].z).sub(new THREE.Vector3(t.x,t.y,t.z)),n=new THREE.Vector3(e[1].x,e[1].y,e[1].z).sub(new THREE.Vector3(t.x,t.y,t.z)),o=new THREE.Vector3(e[2].x,e[2].y,e[2].z).sub(new THREE.Vector3(t.x,t.y,t.z)),s=i.angleTo(n),r=i.angleTo(o),a=n.angleTo(o);return Math.abs(s+r+a-2*Math.PI)<1e-5},a=function(e,t){let i=0,n=(new THREE.Plane).setFromCoplanarPoints(new THREE.Vector3(e[0].x,e[0].y,e[0].z),new THREE.Vector3(e[1].x,e[1].y,e[1].z),new THREE.Vector3(e[2].x,e[2].y,e[2].z));for(let o=0;o<e.length;o++){let s,r=new THREE.Vector3(e[o].x,e[o].y,e[o].z).sub(new THREE.Vector3(t.x,t.y,t.z));s=o===e.length-1?new THREE.Vector3(e[0].x,e[0].y,e[0].z).sub(new THREE.Vector3(t.x,t.y,t.z)):new THREE.Vector3(e[o+1].x,e[o+1].y,e[o+1].z).sub(new THREE.Vector3(t.x,t.y,t.z));let a=r.angleTo(s);!(r.clone().cross(s.clone()).angleTo(n.normal)<Math.PI/2)&&(a*=-1),i+=a}return Math.abs(Math.abs(i)-2*Math.PI)<1e-5},l=function(e,t,i){h.push([e,t,i])},t(e),h},MeasureUtil.calcProjectedArea=function(e){let t=[];return e.forEach((e=>{let i=e.clone();i.z=0,t.push(i)})),this.calcSpatialArea(t)},MeasureUtil.cutFillAnalysis=null,MeasureUtil.calcSurfaceArea=function(e,t,i){let n=0;if(e.length<3||!t)return this.console.warn("Parameter points or viewer is invalid."),n;let o=t.getViewer(),s=e.map((e=>o.worldToDrawing(e))),r=null;if("TilesetLayer"===i){let e=t.getLayerManager().getLayerByType("TilesetLayer");r=[],e.map((e=>r.push(e.id)))}return MeasureUtil.cutFillAnalysis?MeasureUtil.cutFillAnalysis.effectOpt({boundary:s,layerIds:r}):MeasureUtil.cutFillAnalysis=new CLOUD.CutFillMeasure({boundary:s,viewer:t,layerIds:r}),n=MeasureUtil.cutFillAnalysis.getTotalSuperficialArea(),n},MeasureUtil.cutFillAnalysisEarth=null,MeasureUtil.calcSurfaceAreaEarth=function(e,t,i){let n=0;if(e.length<3||!t)return this.console.warn("Parameter points or viewer is invalid."),n;let o=t.getViewer(),s=e.map((e=>o.worldToDrawing(e))),r=null;if("TilesetLayer"===i){let e=t.getLayerManager().getLayerByType("TilesetLayer");r=[],e.map((e=>r.push(e.id)))}return MeasureUtil.cutFillAnalysisEarth?MeasureUtil.cutFillAnalysisEarth.effectOpt({boundary:s,layerIds:r}):MeasureUtil.cutFillAnalysisEarth=new CLOUD.SphereCutFillMeasure({boundary:s,viewer:t,layerIds:r}),n=MeasureUtil.cutFillAnalysisEarth.getTotalSuperficialArea(),n};class MeasureNotation{constructor(e){this.type=e,this.observer=null}initialize(){this.notationSelected=[],this.notationUnselected=[],this.notationSegmentRects=[]}drawAnnotation(e,t){}calcAnnotationStyle(e,t){}select(){this.isInitialized()&&(this.notationUnselected.forEach((e=>{e.style.display="none"})),this.notationSelected.forEach((e=>{e.style.display="block"})))}unselect(){this.isInitialized()&&(this.notationUnselected.forEach((e=>{e.style.display="block"})),this.notationSelected.forEach((e=>{e.style.display="none"})))}dropShadow(e){this.isInitialized()&&this.notationUnselected.forEach((t=>{t.setAttribute("filter",e),t.setAttribute("filter",e)}))}isInitialized(){return!!this.notationUnselected&&!!this.notationSelected}clear(){this.notationSelected=[],this.notationUnselected=[],this.notationSegmentRects=[]}hitTest(e){if(!this.isInitialized())return!1;let t=this.hitTestEpsilon;return this.notationSegmentRects.some((i=>MeasureUtil.distanceToSegment(e,i.start,i.end)<=t))}}class MeasureViewer3dNotation extends MeasureNotation{constructor(e){super(e),this.defaultColor="#F99D0B",this.initialize()}initialize(){super.initialize(),this.annotationStyle={height:21,radius:4},this.hitTestEpsilon=this.annotationStyle.height/2}drawAnnotation(e,t,i,n){var o=this.calcAnnotationStyle(t,e),s=MeasureUtil.makeRectangle({x:o.offsetRect.x,y:o.offsetRect.y,width:o.width,height:this.annotationStyle.height,radius:this.annotationStyle.radius,fillColor:n||this.defaultColor});this.notationUnselected.push(s);let r=MeasureUtil.makeRectangle({x:o.offsetRect.x-2,y:o.offsetRect.y-2,width:o.width+4,height:this.annotationStyle.height+4,radius:this.annotationStyle.radius,strokeColor:"#FFFFFF",fillColor:n||this.defaultColor});this.notationSelected.push(r);let a=new Vector2(o.offsetRect.x,o.offsetRect.y+this.annotationStyle.height/2),l=new Vector2(o.offsetRect.x+o.width,a.y);this.notationSegmentRects.push({start:a,end:l});var h=MeasureUtil.makeText({x:o.offsetText.x,y:o.offsetText.y,color:"#FFFFFF",fontsize:14,content:t});return this.svgGroup=[],this.svgGroup.push(s),this.svgGroup.push(r),this.svgGroup.push(h),this.unselect(),this.svgGroup}calcAnnotationStyle(e,t){var i=0,n=new Vector2(t.x,t.y),o=new Vector2(t.x,t.y);return"Elevation"!==this.type&&(i=MeasureUtil.measureText(e),n.x-=i/2,n.y-=this.annotationStyle.height/2,o.x=n.x+5,o.y=n.y+19-3.5),"Elevation"==this.type&&(n.x-=12,n.y-=39,o.x=n.x+5,o.y=n.y+19-3.5,i=MeasureUtil.measureText(e)),"SpatialArea"==this.type&&(n.x+=i/2+20,o.x+=i/2+20,n.y-=3,o.y-=3),{offsetRect:n,offsetText:o,width:i+=10}}}class MeasureViewerGISNotation extends MeasureNotation{constructor(e,t){super(e),this.defaultColor=t||"#20262F",this.initialize()}initialize(){super.initialize(),this.annotationStyle={height:this.calcAnnotationHeight(),radius:this.calcAnnotationRadius(),fillOpacity:.85},this.hitTestEpsilon=this.annotationStyle.height/2}drawAnnotation(e,t,i,n){var o=this.calcAnnotationStyle(t,e,n),s=MeasureUtil.makeRectangle({x:o.offsetRect.x,y:o.offsetRect.y,width:o.width,height:this.annotationStyle.height,radius:this.annotationStyle.radius,fillColor:this.defaultColor,fillOpacity:this.annotationStyle.fillOpacity});let r=new Vector2(o.offsetRect.x,o.offsetRect.y+this.annotationStyle.height/2),a=new Vector2(o.offsetRect.x+o.width,r.y);this.notationSegmentRects.push({start:r,end:a});let l=MeasureUtil.makeText({x:o.offsetText.x,y:o.offsetText.y,color:"#FFFFFF",fontsize:14,content:t});this.notationSelected.push(l);let h=MeasureUtil.makeText({x:o.offsetText.x,y:o.offsetText.y,color:"#A4A8AE",fontsize:14,content:t});if(this.notationUnselected.push(h),this.svgGroup=[],this.type==Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Position){var d=MeasureUtil.makeRectangle({x:o.offsetArrow.x,y:o.offsetArrow.y,width:7,height:7,radius:0,fillColor:this.defaultColor,fillOpacity:this.annotationStyle.fillOpacity});d.setAttribute("transform",`rotate(45 ${o.offsetArrow.x} ${o.offsetArrow.y})`),this.svgGroup.push(d)}return this.svgGroup.push(s),this.svgGroup.push(h),this.svgGroup.push(l),this.unselect(),this.svgGroup}calcAnnotationStyle(e,t,i){var n=0,o=this.annotationStyle.height,s=new Vector2(t.x,t.y),r=new Vector2(t.x,t.y),a=new Vector2(t.x,t.y);if(this.type==Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Position){e.split("\n").forEach((e=>{let t=MeasureUtil.measureText(e);n=t>n?t:n})),n+=10,s.x-=n/2+5,s.y-=o+8+10,r.x=s.x+10,r.y=s.y+30-3.5}else n=MeasureUtil.measureText(e),!0===i?s.x+=15:s.x-=n/2,s.y-=this.annotationStyle.height/2,r.x=s.x+5,r.y=s.y+19-3.5;return a.y-=22.5,{offsetRect:s,offsetText:r,offsetArrow:a,width:n+=10}}calcAnnotationHeight(){let e=21;return"Position"==this.type&&(e=100),e}calcAnnotationRadius(){let e=4;return"Position"==this.type&&(e=0),e}}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=new Glodon$1.Web.Graphics.Color(17,218,183,.2),n=new Glodon$1.Web.Graphics.Color(17,218,183,1),o=function(e){this.id=e.id||Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.nextMeasurePoint=null,this.measurePoints=[],this.maxPointsNum=2,this.measureResult=null,this.measureParams={precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit},this.measureItemConfig=e,this.viewer=e.viewer;e.color.getRGBA();let o=t.createNS("circle","bf-measure-handle");o.setAttribute("stroke-width",0),o.setAttribute("r",6),o.setAttribute("fill",i.getRGB()),o.style.fill=i.getRGB();let s=t.createNS("line","bf-measure-line");s.style.strokeWidth=2,s.style.stroke=i.getRGB();let r=t.createNS("polygon","bf-measure-rect");r.setAttribute("fill",i.getRGBA()),r.setAttribute("stroke",i.getRGB()),r.setAttribute("stroke-width",1);var a=t.createNS("path","bf-measure-foot");a.setAttribute("fill","none"),a.setAttribute("stroke",i.getRGB()),a.setAttribute("stroke-width",2);const l=t.createNS("rect","bf-snap-handle");l.setAttribute("width",14),l.setAttribute("height",14),l.setAttribute("fill","none"),l.setAttribute("stroke",n.getRGB()),l.setAttribute("stroke-width",2);const h=t.createNS("path","bf-snap-handle");h.setAttribute("d","M 7 0 L 16 16 L 0 16 L 7 0"),h.setAttribute("fill","none"),h.setAttribute("stroke",n.getRGB()),h.setAttribute("stroke-width",2);const d=t.createNS("line","bf-snap-handle");d.setAttribute("x1",0),d.setAttribute("y1",0),d.setAttribute("x2",14),d.setAttribute("y2",14),d.setAttribute("stroke",i.getRGB()),d.setAttribute("stroke-width",2);const c=t.createNS("line","bf-snap-handle");c.setAttribute("x1",14),c.setAttribute("y1",0),c.setAttribute("x2",0),c.setAttribute("y2",14),c.setAttribute("stroke",i.getRGB()),c.setAttribute("stroke-width",2),this.hoverFoot=a,this.hoverPoint=o,this.hoverLine=s,this.hoverPanel=r,this.hoverEndPoint=l,this.hoverMidPoint=h,this.hoverIntersectionPointA=d,this.hoverIntersectionPointB=c,this.hoverPanelSize={width:20,height:20},this.defaultColor=`#${e.color.getHEX()}`||"#F99D0B",this.lineWidth="3",this.radius=5,this.strokeWidth=2,this.measureType=e.measureType,this.notation="ViewerGIS"===this.viewer.getViewerType()?new MeasureViewerGISNotation(this.measureType):new MeasureViewer3dNotation(this.measureType),this.isReserverd=!1,this.hoverPositionUpdated=!1};o.prototype={stretchOnDirection:function(e,t,i){let n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]},draw:function(e){},drawLine(e){if(0===e.length)return;let t=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this._svg.appendChild(t)},drawTerminalPoint(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});t.setAttribute("filter",this.filterUrl),this._svg.appendChild(t)},drawNotation(e,t,i){if(0===e.length)return;let n=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id,i);for(const e of n)this._svg.appendChild(e)},drawCaptureItem:function(e){let t=this.hoverPoint,i=this.hoverLine,n=this.hoverPanel,o=this.hoverEndPoint,s=this.hoverMidPoint,r=this.hoverIntersectionPointA,a=this.hoverIntersectionPointB,l=e.hoverPosition&&e.hoverPosition.x,h=e.hoverPosition&&e.hoverPosition.y,d=this.hoverPanelSize;switch(e.hoverObjectType){case"Point":t.setAttribute("cx",l),t.setAttribute("cy",h),e.svg.appendChild(t);break;case"EndPoint":o.setAttribute("x",l-7),o.setAttribute("y",h-7),e.svg.appendChild(o);break;case"MidPoint":s.setAttribute("d",`M ${l} ${h-7} L ${l+8} ${h+8} L ${l-8} ${h+8} L ${l} ${h-7}`),e.svg.appendChild(s);break;case"IntersectionPoint":r.setAttribute("x1",l-7),r.setAttribute("y1",h-7),r.setAttribute("x2",l+7),r.setAttribute("y2",h+7),e.svg.appendChild(r),a.setAttribute("x1",l+7),a.setAttribute("y1",h-7),a.setAttribute("x2",l-7),a.setAttribute("y2",h+7),e.svg.appendChild(a);break;case"Line":if(e.footPoint){let t=e.footPoint.x,i=e.footPoint.y;this.hoverFoot.setAttribute("d",`M ${t},${i-14} v 14 h 14 M ${t},${i-9} h 9 v 9`),e.svg.appendChild(this.hoverFoot)}else i.setAttribute("x1",e.lineStartPoint.x),i.setAttribute("y1",e.lineStartPoint.y),i.setAttribute("x2",e.lineEndPoint.x),i.setAttribute("y2",e.lineEndPoint.y),e.svg.appendChild(i);break;case"Panel":let c=e.clientPts,u=c[0].distanceTo(c[1]),p=c[0].distanceTo(c[3]),g=u/d.width,m=p/d.height;if(1!=g){let e=this.stretchOnDirection(c[0],c[1],d.width),t=this.stretchOnDirection(c[2],c[3],d.width);c=e.concat(t)}if(1!=m){let e=this.stretchOnDirection(c[0],c[3],d.height),t=this.stretchOnDirection(c[1],c[2],d.height);c=[e[0],t[0],t[1],e[1]]}let f="";for(let e=0;e<c.length;e++)f+=c[e].x+",",f+=c[e].y+" ";n.setAttribute("points",f),e.svg.appendChild(n)}},reset:function(){if(this.measurePoints=[],this.nextMeasurePoint=null,this.measureResult=null,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}},addPoint:function(e){if(this.measurePoints.length==this.maxPointsNum)this.reset();else if(this.measurePoints.length>0){let t=this.measurePoints.length,i=this.measurePoints[t-1];if(e.x===i.x&&e.y===i.y&&e.z===i.z)return}this.measurePoints.push(e),this.setIsReserverd(!1)},redo:function(){this.measurePoints.length>0&&this.measurePoints.length<this.maxPointsNum?this.measurePoints.pop():this.measurePoints=[]},getPoints:function(){return this.measurePoints},calcLine:function(e,t){let i=[];var n=this.viewer.getViewer(),o=this.viewer.getDomElement().getBoundingClientRect(),s=n.worldPointsToClient(e,t);if(s){e=new THREE.Vector2(s.start.x-o.left,s.start.y-o.top),t=new THREE.Vector2(s.end.x-o.left,s.end.y-o.top);i.push(e,t)}return i},setMeasureParams:function(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit},setIsReserverd:function(e){this.isReserverd=e},getIsReserverd:function(){return this.isReserverd}},e.MeasureItem=o}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=(new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e),this.maxPointsNum=2,this.measurePoints=[];var n=e.color.getRGBA(),o=i.createNS("circle","bf-measure-handle");o.setAttribute("stroke-width",0),o.setAttribute("r",5),o.setAttribute("stroke","#FFFFFF"),o.setAttribute("stroke-width",2),o.setAttribute("fill",n),o.style.fill=n;var s=o.cloneNode(),r=i.createNS("line","bf-measure-line"),a=r.cloneNode();a.style.strokeWidth=2,a.setAttribute("stroke-dasharray","6,4");var l=a.cloneNode(),h=a.cloneNode();r.style.strokeWidth=e.width,r.style.stroke=e.color.getRGBA(),a.style.stroke="#CC021B",l.style.stroke="#7CCF21",h.style.stroke="#4A90E2",r.setAttribute("stroke-width",e.width),this.line=r,this.lineX=a,this.lineY=l,this.lineZ=h,this.startPoint=o,this.endPoint=s});e.Type.inheritPrototype(n,t.MeasureItem);n.prototype=Object.assign(n.prototype,{stretchOnDirection:function(e,t,i){var n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]},draw:function(e){var t=this.line,i=this.lineX,n=this.lineY,o=this.lineZ,s=this.startPoint,r=this.endPoint;if(this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(e.clientPoints.length){case 2:var a=e.auxLines[0],l=e.auxLines[1],h=e.auxLines[2];a&&(i.setAttribute("x1",a.start.x),i.setAttribute("y1",a.start.y),i.setAttribute("x2",a.end.x),i.setAttribute("y2",a.end.y),e.svg.appendChild(i)),l&&(n.setAttribute("x1",l.start.x),n.setAttribute("y1",l.start.y),n.setAttribute("x2",l.end.x),n.setAttribute("y2",l.end.y),e.svg.appendChild(n)),h&&(o.setAttribute("x1",h.start.x),o.setAttribute("y1",h.start.y),o.setAttribute("x2",h.end.x),o.setAttribute("y2",h.end.y),e.svg.appendChild(o)),s.setAttribute("cx",e.clientPoints[1].x),s.setAttribute("cy",e.clientPoints[1].y),r.setAttribute("cx",e.clientPoints[0].x),r.setAttribute("cy",e.clientPoints[0].y),t.setAttribute("x1",e.clientPoints[0].x),t.setAttribute("y1",e.clientPoints[0].y),t.setAttribute("x2",e.clientPoints[1].x),t.setAttribute("y2",e.clientPoints[1].y),e.svg.appendChild(s),e.svg.appendChild(r),e.svg.appendChild(t);break;case 1:s.setAttribute("cx",e.clientPoints[0].x),s.setAttribute("cy",e.clientPoints[0].y),this.getPoints().length!=this.maxPointsNum&&e.hoverPosition&&(t.setAttribute("x1",e.clientPoints[0].x),t.setAttribute("y1",e.clientPoints[0].y),t.setAttribute("x2",e.hoverPosition.x),t.setAttribute("y2",e.hoverPosition.y),e.svg.appendChild(t)),e.svg.appendChild(s)}}}),t.MeasureDistanceItem=n}();class MeasureResultFormat{constructor(){}static formatDistance(e,t){if(null==e)return null;let i=t.precision,n=t.scale||1,o=t.unit,s=1;return"Centimeter"===o?s=10:"Meter"===o?s=1e3:"Kilometer"===o&&(s=1e6),"m"===t.defaultUnit&&(n*=1e3),e*=n,e/=s,this.formatPrecision(e,i)}static formatArea(e,t){let i=t.precision,n=t.scale,o=t.unit,s=1;return"Centimeter"===o?s=100:"Meter"===o?s=1e6:"Kilometer"===o&&(s=1e13),"m"===t.defaultUnit&&(n*=1e3),e*=Math.pow(n,2),e/=s,this.formatPrecision(e,i)}static formatCubic(e,t){let i=t.precision,n=t.scale,o=t.unit,s=1;return"Centimeter"===o?s=1e3:"Meter"===o?s=1e9:"Kilometer"===o&&(s=1e19),"m"===t.defaultUnit&&(n*=1e3),e*=Math.pow(n,3),e/=s,i?this.toLocaleString(this.formatPrecision(e,i)):this.formatPrecision(e,i)}static getPostFix(e,t){if("None"===e)return"";let i={None:"",Kilometer:"km",Meter:"m",Centimeter:"cm",Millimeter:"mm"}[e];return t?i+="²":i=" "+i,i}static toLocaleString(e){let t=e.toString();return t=t.replace(/\d{1,3}(?=((\d{3})+(\.\d+)?)$)/g,"$&,"),t}static formatPrecision(e,t){if(e=parseInt(Math.round(e*Math.pow(10,t)))/Math.pow(10,t),0!=t){let i=e.toFixed(t).split(".");e=i[0]+"."+i[1]}else e=this.toLocaleString(e);return e}}!function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=(new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e),this.maxPointsNum=3,this.radius=e.radius,this.measurePoints=[];var n=e.color.getRGBA(),o=i.createNS("circle","bf-measure-handle");o.setAttribute("stroke-width",0),o.setAttribute("r",5),o.setAttribute("stroke","#FFFFFF"),o.setAttribute("stroke-width",2),o.setAttribute("fill",n),o.style.fill=n;var s=o.cloneNode(),r=o.cloneNode(),a=i.createNS("path","bf-measure-angle");a.setAttribute("fill","rgba(0,0,0,0)"),a.setAttribute("stroke",n),a.setAttribute("stroke-width",e.width);var l=i.createNS("line","bf-measure-line");l.style.strokeWidth=e.width,l.style.stroke=n,l.setAttribute("stroke-width",e.width);var h=l.cloneNode(),d=i.create("span","bf-measure-number");d.style.backgroundColor=e.color.getRGBA(),this.points=[o,s,r],this.lines=[l,h],this.angleLine=a,this.text=d});e.Type.inheritPrototype(n,t.MeasureItem);var o={_getPoint:function(e,t,i,n){e=new THREE.Vector2(e.x,e.y),t=new THREE.Vector2(t.x,t.y),i=new THREE.Vector2(i.x,i.y);var o=1,s=e.sub(t),r=i.sub(t);if(s.length()<n||r.length()<n)return!1;s.setLength(n),r.setLength(n);var a=s.angle(),l=180*(r.angle()-a)/Math.PI;return l<0&&(l+=360),o=l<180?1:0,{pointA:t.clone().add(s),pointB:t.clone().add(r),flag:1,direction:o}},draw:function(e,t){var i=this.points;if(this._svg=e.svg,this.drawCaptureItem(e),this.getIsReserverd())return;for(var n=0,o=e.clientPoints.length;n<o;n++)e.clientPoints[n]&&(i[n].setAttribute("cx",e.clientPoints[n].x),i[n].setAttribute("cy",e.clientPoints[n].y),e.svg.appendChild(i[n]));"ViewerGIS"===this.viewer.viewerType?this.drawAngleWithResult(e,t):this.drawAngle(e)},drawAngle:function(e){var t=this.lines,i=this.angleLine;switch(e.clientPoints.length){case 3:t[0].setAttribute("x1",e.clientPoints[0].x),t[0].setAttribute("y1",e.clientPoints[0].y),t[0].setAttribute("x2",e.clientPoints[1].x),t[0].setAttribute("y2",e.clientPoints[1].y),t[1].setAttribute("x1",e.clientPoints[1].x),t[1].setAttribute("y1",e.clientPoints[1].y),t[1].setAttribute("x2",e.clientPoints[2].x),t[1].setAttribute("y2",e.clientPoints[2].y);var n=this.radius,o=this._getPoint(e.clientPoints[0],e.clientPoints[1],e.clientPoints[2],n);o&&(i.setAttribute("d",`M ${o.pointA.x} ${o.pointA.y} A ${n} ${n} 0 0 ${o.direction} ${o.pointB.x} ${o.pointB.y}`),e.svg.appendChild(i)),e.svg.appendChild(t[1]),e.svg.appendChild(t[0]);break;case 2:t[0].setAttribute("x1",e.clientPoints[0].x),t[0].setAttribute("y1",e.clientPoints[0].y),t[0].setAttribute("x2",e.clientPoints[1].x),t[0].setAttribute("y2",e.clientPoints[1].y),e.svg.appendChild(t[0]),this.getPoints().length!=this.maxPointsNum&&e.hoverPosition&&(t[1].setAttribute("x1",e.clientPoints[1].x),t[1].setAttribute("y1",e.clientPoints[1].y),t[1].setAttribute("x2",e.hoverPosition.x),t[1].setAttribute("y2",e.hoverPosition.y),e.svg.appendChild(t[1]));break;case 1:this.getPoints().length!=this.maxPointsNum&&e.hoverPosition&&(t[0].setAttribute("x1",e.clientPoints[0].x),t[0].setAttribute("y1",e.clientPoints[0].y),t[0].setAttribute("x2",e.hoverPosition.x),t[0].setAttribute("y2",e.hoverPosition.y),e.svg.appendChild(t[0]))}},drawAngleWithResult:function(e,t){var i=this.lines,n=this.angleLine;switch(this.measureResult=t.angle,e.clientPoints.length){case 2:i[0].setAttribute("x1",e.clientPoints[0].x),i[0].setAttribute("y1",e.clientPoints[0].y),i[0].setAttribute("x2",e.clientPoints[1].x),i[0].setAttribute("y2",e.clientPoints[1].y),i[1].setAttribute("x1",e.clientPoints[1].x),i[1].setAttribute("y1",e.clientPoints[1].y),i[1].setAttribute("x2",e.hoverPosition.x),i[1].setAttribute("y2",e.hoverPosition.y);var o=this.radius,s=this._getPoint(e.clientPoints[0],e.clientPoints[1],e.hoverPosition,o);s&&(n.setAttribute("d",`M ${s.pointA.x} ${s.pointA.y} A ${o} ${o} 0 0 ${s.direction} ${s.pointB.x} ${s.pointB.y}`),e.svg.appendChild(n)),e.svg.appendChild(i[1]),e.svg.appendChild(i[0]),this.drawNotation(e,s);break;case 1:this.getPoints().length!=this.maxPointsNum&&e.hoverPosition&&(i[0].setAttribute("x1",e.clientPoints[0].x),i[0].setAttribute("y1",e.clientPoints[0].y),i[0].setAttribute("x2",e.hoverPosition.x),i[0].setAttribute("y2",e.hoverPosition.y),e.svg.appendChild(i[0]))}},drawNotation(e,t){if(t){var i=new THREE.Vector2((t.pointA.x+t.pointB.x)/2,(t.pointA.y+t.pointB.y)/2),n=new THREE.Vector2(e.clientPoints[1].x,e.clientPoints[1].y),o=i.clone().sub(n).normalize().multiplyScalar(35);i=n.clone().add(o);let s=this.notation.drawAnnotation(i,this.getMeasureResult(),this.id);for(const t of s)e.svg.appendChild(t)}},getMeasureResult(){this.measureParams.unit;let e=this.measureResult.toString();return MeasureResultFormat.formatPrecision(e,this.measureParams.precision).split(",").join("")+"°"}};n.prototype=Object.assign(n.prototype,o),t.MeasureAngleItem=n}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=function(e){t.MeasureItem.call(this,e),this.maxPointsNum=2,this.measurePoints=[],this.opt=e,this.minDistanceLine=null,this.svgContainer=i.createNS("svg","bf-minDistanceMeasure-svg"),this.startPoint=i.createNS("circle","bf-minDistanceMeasure-handle"),this.endPoint=i.createNS("circle","bf-minDistanceMeasure-handle"),this.line=i.createNS("line","bf-minDistanceMeasure-line")};e.Type.inheritPrototype(n,t.MeasureItem);n.prototype=Object.assign(n.prototype,{draw:function(e){},setMinDistanceLine:function(e){this.minDistanceLine=e},clearMinDistanceLine:function(){var e=this.startPoint;e.parentNode&&this.svgContainer.removeChild(e);var t=this.endPoint;t.parentNode&&this.svgContainer.removeChild(t);var i=this.line;i.parentNode&&this.svgContainer.removeChild(i)},addPoint:function(e){var t=this.opt.viewer;this.opt.objectColor;this.measurePoints.length==this.maxPointsNum&&this.reset();var i=!1;this.measurePoints.some((t=>(t.modelId===e.modelId&&t.userId===e.userId&&(i=!0),i))),i||(this.measurePoints.push(e),(e.modelId?t.getModel(e.modelId):t).addSelectedComponentsById([e.userId]),t.render())},reset:function(e){var t=this.opt.viewer;!1!==e&&this.measurePoints.forEach((e=>{(e.modelId?t.getModel(e.modelId):t).removeSelectedId([e.userId])})),this.measurePoints=[],this.clearMinDistanceLine(),this.minDistanceLine=null,t.render()},redo:function(){var e=this.opt.viewer;if(this.measurePoints.length>0&&this.measurePoints.length<this.maxPointsNum){var t=this.measurePoints.pop();(t.modelId?e.getModel(t.modelId):e).removeSelectedId([t.userId]),e.render()}else this.reset()}}),t.MeasureMinimumDistanceItem=n}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=function(e){t.MeasureItem.call(this,e),this.viewer=e.viewer,this.maxPointsNum=1;var n=new Glodon$1.Web.Graphics.Color(17,218,183,.2),o=i.createNS("circle","bf-measure-handle");o.setAttribute("r",e.width),o.setAttribute("fill",n.getRGB()),o.style.fill=n.getRGB();var s=i.createNS("line","bf-measure-line");s.style.strokeWidth=2,s.style.stroke=n.getRGB();var r=i.createNS("polygon","bf-measure-rect");r.setAttribute("fill",n.getRGBA()),r.setAttribute("stroke",n.getRGB()),r.setAttribute("stroke-width",1),this.hoverLine=s,this.hoverPoint=o,this.hoverPanel=r,this.hoverPanelSize={width:20,height:20}};e.Type.inheritPrototype(n,t.MeasureItem);n.prototype=Object.assign(n.prototype,{stretchOnDirection:function(e,t,i){var n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]},draw:function(e){var t=this.hoverLine,i=this.hoverPoint,n=this.hoverPanel,o=this.hoverPanelSize;switch(e.hoverObjectType){case"Point":i.setAttribute("cx",e.hoverPosition.x),i.setAttribute("cy",e.hoverPosition.y),e.svg.appendChild(i);break;case"Line":t.setAttribute("x1",e.lineStartPoint.x),t.setAttribute("y1",e.lineStartPoint.y),t.setAttribute("x2",e.lineEndPoint.x),t.setAttribute("y2",e.lineEndPoint.y),e.svg.appendChild(t);break;case"Panel":var s=e.clientPts,r=s[0].distanceTo(s[1]),a=s[0].distanceTo(s[3]),l=r/o.width,h=a/o.height;if(1!=l){var d=this.stretchOnDirection(s[0],s[1],o.width),c=this.stretchOnDirection(s[2],s[3],o.width);s=d.concat(c)}if(1!=h){d=this.stretchOnDirection(s[0],s[3],o.height),c=this.stretchOnDirection(s[1],s[2],o.height);s=[d[0],c[0],c[1],d[1]]}for(var u="",p=0;p<s.length;p++)u+=s[p].x+",",u+=s[p].y+" ";n.setAttribute("points",u),e.svg.appendChild(n)}}}),t.MeasureElevationItem=n}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(e){t.MeasureItem.call(this,e),this.maxPointsNum=1,this.measurePoints=[],this.measureAllPoints=[],this.opt=e});e.Type.inheritPrototype(i,t.MeasureItem);var n={draw:function(e){},addPoint:function(e){var t=this.opt.viewer;this.opt.objectColor;this.measurePoints.length==this.maxPointsNum&&this.reset();var i=!1;this.measurePoints.some((t=>(t.modelId===e.modelId&&t.userId===e.userId&&(i=!0),i))),i||(this.measurePoints.push(e),(e.modelId?t.getModel(e.modelId):t).addSelectedComponentsById([e.userId]),t.render())},reset:function(e){var t=this.opt.viewer;!1!==e&&(console.info(JSON.parse(JSON.stringify(this.measurePoints))),this.measurePoints.forEach((e=>{(e.modelId?t.getModel(e.modelId):t).removeSelectedId([e.userId])}))),this.measurePoints=[],t.render()}};i.prototype=Object.assign(i.prototype,n),t.MeasureVolumeItem=i}();const measureNS=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),DomNS=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");class MeasureLaserClearDistanceItem extends measureNS.MeasureItem{constructor(e){super(e),this.opt=e,this.maxPointsNum=1;const t=new Glodon$1.Web.Graphics.Color(17,218,183,.2),i=DomNS.createNS("circle","bf-measure-handle");i.setAttribute("r",e.width),i.setAttribute("fill",t.getRGB()),i.style.fill=t.getRGB();const n=DomNS.createNS("line","bf-measure-line");n.style.strokeWidth=2,n.style.stroke=t.getRGB();const o=DomNS.createNS("polygon","bf-measure-rect");o.setAttribute("fill",t.getRGBA()),o.setAttribute("stroke",t.getRGB()),o.setAttribute("stroke-width",1),this.hoverLine=n,this.hoverPoint=i,this.hoverPanel=o,this.hoverPanelSize={width:20,height:20};const s=this.viewer.getDomElement();let r=document.getElementsByClassName("bf-measure-dragbutton")[0];if(!r){r=document.createElement("div"),r.innerHTML='\n <svg width="160px" height="160px" viewBox="0 0 160 160" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g>\n <g fill="#FFFFFF" fill-opacity="0.3" stroke="#999999" stroke-width="2">\n <path d="M80,1 C82.7908696,1 85.5479441,1.14468216 88.264129,1.4269862 C89.0464893,1.50830005 89.8254567,1.60103155 90.6008619,1.70501165 C95.2372276,2.32673796 99.7462267,3.35063053 104.091601,4.74047874 C109.461201,6.4579211 114.580945,8.73415789 119.382458,11.5007405 C131.430077,18.4424547 141.474355,28.4710659 148.435065,40.506339 C155.154653,52.1247049 159,65.6133154 159,80 C159,101.815248 150.157624,121.565248 135.861436,135.861436 C121.565248,150.157624 101.815248,159 80,159 C58.1847524,159 38.4347524,150.157624 24.1385643,135.861436 C9.84237619,121.565248 1,101.815248 1,80 C1,58.1847524 9.84237619,38.4347524 24.1385643,24.1385643 C38.4347524,9.84237619 58.1847524,1 80,1 Z" id="Oval-2"></path>\n </g>\n <circle fill-opacity="0.8" fill="#FFFFFF" cx="80" cy="80" r="40"></circle>\n <g transform="translate(58.000000, 58.000000)" fill="#32D3A6" fill-rule="nonzero">\n <path d="M23.2727273,27.1515152 L23.2727273,36.8484848 L29.0909091,36.8484848 L22.3030303,44.6060606 L15.5151515,36.8484848 L21.3333333,36.8484848 L21.3333333,27.1515152 L23.2727273,27.1515152 Z M36.8484848,15.5151515 L44.6060606,22.3030303 L36.8484848,29.0909091 L36.8484848,23.2707879 L27.1515152,23.2727273 L27.1515152,21.3333333 L36.8484848,21.3313939 L36.8484848,15.5151515 Z M7.75757576,15.5151515 L7.75757576,21.3333333 L17.4545455,21.3333333 L17.4545455,23.2727273 L7.75757576,23.2727273 L7.75757576,29.0909091 L0,22.3030303 L7.75757576,15.5151515 Z M22.3030303,0 L29.0909091,7.75757576 L23.2727273,7.75757576 L23.2727273,17.4545455 L21.3333333,17.4545455 L21.3333333,7.75757576 L15.5151515,7.75757576 L22.3030303,0 Z" id="形状"></path>\n </g>\n </g>\n </g>\n </svg>\n ',r.className="bf-measure-dragbutton",r.style.display="none";let e=this.dragEvents={touchmove:e=>{let{top:t,left:i}=s.getBoundingClientRect(),{clientX:n,clientY:o}=e.touches[0];this.setButtonPosition(r,n-i,o-t);const a=new Touch({identifier:Date.now(),target:s,clientX:n,clientY:o,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5}),l=new TouchEvent("touchstart",{touches:[a]});s.dispatchEvent(l);const h=new TouchEvent("touchend");s.dispatchEvent(h),e.stopPropagation(),e.preventDefault()}};for(let t in e)r.addEventListener(t,e[t]);s.appendChild(r)}this.dragButton=r,this.dragButtonPoint=null,this.dragButtonVisible=!1,this._result={};const a=this.nextButtons={},l=document.createElement("div");this.nextButtonContainer=l,s.appendChild(l),["positive_X","negative_X","positive_Y","negative_Y","positive_Z"].forEach((e=>{const t=document.createElement("div");t.addEventListener("touchstart",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("touchmove",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("touchend",(t=>{this.getNextResult(e),t.stopPropagation(),t.preventDefault()})),t.addEventListener("mousedown",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("mousemove",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("mouseup",(t=>{this.getNextResult(e),t.stopPropagation(),t.preventDefault()})),t.className=`bf-measure-nextbutton ${e}`;const i={button:t};let n;Object.defineProperty(i,"position",{set:e=>{if(e){t.style.display="block";let{x:i,y:n}=this.viewer.worldToClient(e);i&&n&&this.setButtonPosition(t,i,n)}else t.style.display="none";n=e},get:()=>n}),l.appendChild(t),a[e]=i})),this.viewer.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.CameraPositionChanged,(()=>{if(this.dragButtonVisible&&this.dragButtonPoint){this.dragButton.style.display=this.viewer.isInViewFrustum(this.dragButtonPoint)?"block":"none";let{x:e,y:t}=this.viewer.worldToClient(this.dragButtonPoint);e&&t&&this.setButtonPosition(this.dragButton,e,t)}Object.values(a).forEach((e=>{e.position=e.position?e.position.clone():void 0,e.position&&!this.viewer.isInViewFrustum(e.position)&&(e.button.style.display="none")}))}))}computeMeasureResult(e){let t=this.getPoints();if(0===t.length)return;t[0].point=new THREE.Vector3(...Object.values(this.viewer.globalUnitUtil.revertTranslate(t[0].point,["x","y","z"])));let{point:i}=t[0];this._result.pointInfo=t[0];const n=i.clone().add(e.clone().multiplyScalar(1)),o=(e,t)=>{const i=this.viewer.getComponentsByRaycaster(n,t),s=this.viewer.getComponentsByRaycaster(n,t.clone().negate());return this._result[e]=i.length>0&&s.length>0?{enable:!0,direction:t,positiveIntersects:i,negativeIntersects:s,positiveIndex:0,negativeIndex:0}:{enable:!1},this.nextButtons[`positive_${e}`].position=i.length>1&&s.length>0?i[0].position:void 0,"Z"!==e&&(this.nextButtons[`negative_${e}`].position=s.length>1&&i.length>0?s[0].position:void 0),o};let s,r,a;return Math.abs(1-Math.abs(e.z))<.001?(s=new THREE.Vector3(1,0,0),r=new THREE.Vector3(0,1,0),a=new THREE.Vector3(0,0,1)):(s=e.clone().cross(new THREE.Vector3(0,0,1)),s.x<0&&s.negate(),r=e.clone().cross(s),r.y<0&&r.negate(),a=e),o("X",s)("Y",r)("Z",a),!Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.showDragButton(i),this.getMeasureResult()}getMeasureResult(){let e={},{componentId:t,modelId:i,point:n}=this._result.pointInfo;e.pointSelected={x:n.x,y:n.y,z:n.z},e.componentSelected={componentId:t,modelId:i},e.type=this.measureType;const o=t=>{if(this._result[t].enable){let{direction:i,positiveIntersects:n,negativeIntersects:o,positiveIndex:s,negativeIndex:r}=this._result[t],a=n[s],l=o[r];e[`Laser${t}`]={vector:{x:i.x,y:i.y,z:i.z},distance:a.distance+l.distance,endPoints:[{x:a.position.x,y:a.position.y,z:a.position.z,direction:"positive"},{x:l.position.x,y:l.position.y,z:l.position.z,direction:"negative"}],endComponents:[{componentId:a.id,modelId:a.modelId,direction:"positive"},{componentId:l.id,modelId:l.modelId,direction:"negative"}]}}return o};return o("X")("Y")("Z"),e}getNextResult(e){let[t,i]=e.split("_");if(!this._result[i]||!this._result[i].enable)return;let n=this._result[i][`${t}Intersects`],o=++this._result[i][`${t}Index`];n.length<=o&&(this._result[i][`${t}Index`]=o=0),this.opt.measure.measureByInfo({...this.getMeasureResult(),id:Glodon$1.Web.Lang.Utility.UUID.createUUID()}),this.nextButtons[e].position=n[o].position}draw(e){this.drawCaptureItem(e)}showDragButton(e){this.reset(),this.viewer.render(),this.dragButtonPoint=e,this.dragButtonVisible=!0;let{x:t,y:i}=this.viewer.worldToClient(e);this.dragButton.style.display="block",t&&i&&this.setButtonPosition(this.dragButton,t,i)}hideDragButton(){this.dragButtonVisible=!1,this.dragButton.style.display="none",Object.values(this.nextButtons).forEach((e=>e.position=void 0))}showNextButton(){this.nextButtonContainer.style.display="block"}hideNextButton(){this.nextButtonContainer.style.display="none"}clearNextButton(){Object.values(this.nextButtons).forEach((e=>e.position=void 0))}setButtonPosition(e,t,i){e.style.top=`${i}px`,e.style.left=`${t}px`}}measureNS.MeasureLaserClearDistanceItem=MeasureLaserClearDistanceItem;class MeasureDrawable{constructor(e,t,i,n){this.viewer=e,this.id=t,this.type=i,this.isShow=!0,this.xmlns="http://www.w3.org/2000/svg",this.defaultColor=n.defaultColor||"#F99D0B",this.svgGroup=[],this.lineWidth="3",this.radius=5,this.strokeWidth=2,this.hitTestEpsilon=10,this.hitTestSegments=[],this.selectElements=[],this.unSelectElements=[],this.elementsOnTop=[],this.isSelected=!0,this.mask=null,this.notation="ViewerGIS"===this.viewer.getViewerType()?new MeasureViewerGISNotation(i):new MeasureViewer3dNotation(i),this.measureParams={precision:0,scale:1,unit:"None"}}getSvgGroup(){return this.svgGroup}getId(){return this.id}getType(){return this.type}clear(e){this.detach(e),this.notation.clear(e),this.svgGroup=[],this.hitTestSegments=[]}detach(e){for(const e of this.svgGroup){(t=e.parentNode)&&t.removeChild(e)}for(const e of this.elementsOnTop){var t;(t=e.parentNode)&&t.removeChild(e)}}attach(e){for(const t of this.svgGroup)e.appendChild(t)}calcLine(e,t){let i=[];this.viewer.getViewer();var n=this.viewer.getDomElement().getBoundingClientRect(),o=this.viewer.viewerAdapter.worldPointsToClient(e,t);if(o){e=new Vector2(o.start.x-n.left,o.start.y-n.top),t=new Vector2(o.end.x-n.left,o.end.y-n.top);i.push(e,t)}return i}calcTerminalLines(e,t,i){if(0===e.length)return[];let n=[],o=e[0],s=e[1],r=o.clone().sub(s).normalize(),a=r.clone().multiplyScalar(i).add(o).rotateAround(o.clone(),t),l=r.clone().multiplyScalar(i).add(o).rotateAround(o.clone(),-t);n.push({start:a,end:l}),r=r.multiplyScalar(-1);let h=r.clone().multiplyScalar(i).add(s).rotateAround(s.clone(),t),d=r.clone().multiplyScalar(i).add(s).rotateAround(s.clone(),-t);return n.push({start:h,end:d}),n}select(){for(const e of this.selectElements)e.style.display="none";for(const e of this.unSelectElements)e.style.display="block";this.notation.select(),this.isSelected=!0}unselect(){for(const e of this.selectElements)e.style.display="block";for(const e of this.unSelectElements)e.style.display="none";this.notation.unselect(),this.isSelected=!1}getIsSelected(){return this.isSelected}actionWhenSelected(){}actionWhenUnselected(){}dropShadow(e){this.notation.dropShadow(e)}ifMaskDraw(e,t,i,n,o,s){if("ViewerDrawing"==this.viewer.viewerType){const r=this.viewer.getViewer().getLayoutViewportBoundingBox(t,i,n),a=this.viewer.getViewer().toScreenPoint(r.min),l=this.viewer.getViewer().toScreenPoint(r.max),h=e[0].start?e[0].start:e[0],d=e[1].end?e[1].end:e[1];if(h.x<a[0]||h.x>l[0]||h.y<l[1]||h.y>a[1]||d.x<a[0]||d.x>l[0]||d.y<l[1]||d.y>a[1])this.drawMask(r,!0);else if(-1==n&&-1!=o){const e=this.viewer.getViewer().getLayoutViewportBoundingBox(t,o,s);this.drawMask(e,!isFinite(e.max[0]))}else this.removeMask()}}drawMask(e,t=!0){const i=this.viewer.getViewer().toScreenPoint(e.min),n=this.viewer.getViewer().toScreenPoint(e.max);let o=this.mask=MeasureUtil.makeRectangle({x:t?0:i[0],y:t?0:n[1],width:t?this.viewer.getDomElement().clientWidth:n[0]-i[0],height:t?this.viewer.getDomElement().clientHeight:i[1]-n[1],radius:0,fillColor:0==this.viewer.getViewer().dc.printMode?"#444444":"#DDDDDD",fillOpacity:.7});this.svgGroup.push(o)}removeMask(){this.mask&&(this.mask.style.display="none"),this.mask=null}setMeasureParams(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit}show(){for(const e of this.svgGroup)e.style.display="block";for(const e of this.elementsOnTop)e.style.display="block";this.isShow=!0}hide(){for(const e of this.svgGroup)e.style.display="none";for(const e of this.elementsOnTop)e.style.display="none";this.isShow=!1}getNotation(){return this.notation}hitTest(e){let t=this.hitTestEpsilon;for(let i=0;i<this.hitTestSegments.length-1;i++){if(MeasureUtil.distanceToSegment(e,this.hitTestSegments[i],this.hitTestSegments[i+1])<=t)return!0}return!1}}class Viewer3dDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult=t.distance,this.auxLinesResult=[t.distanceX,t.distanceY,t.distanceZ],this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit,enableAuxiliaryValue:n.enableAuxiliaryValue||!1})}setMeasureParams(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit,this.measureParams.enableAuxiliaryValue=e.enableAuxiliaryValue}initialize(){let e=this.calcLine(this.worldPositions[0],this.worldPositions[1]);this.hitTestSegments=e;let{auxLines:t,auxLinePoints:i}=this.calAuxLines(),n=this.calcTerminalLines(e,Math.PI/2,6.5);this.attachSingleLine(e),this.attachTerminalLines(n);this.attachAuxLines(t,["#CC021B","#7CCF21","#4A90E2"]),this.attachTerminalPoints([t[0].start,t[2].end]);let o={x:(this.worldPositions[0].x+this.worldPositions[1].x)/2,y:(this.worldPositions[0].y+this.worldPositions[1].y)/2,z:(this.worldPositions[0].z+this.worldPositions[1].z)/2},s=this.viewer.worldToClient(o);this.viewer.isInViewFrustum(o)&&(this.attachNotation([s,s]),this.measureParams.enableAuxiliaryValue&&this.calAuxLinesNotation(i),this.notation.dropShadow(this.filterUrl),this.unselect())}attachTerminalPoints(e){for(const t of e){let e=MeasureUtil.makeCircle({position:t,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(e),e.setAttribute("filter",this.filterUrl),this.unSelectElements.push(e)}}attachSingleLine(e){if(0===e.length)return;let t=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(t)}attachTerminalLines(e){if(0!==e.length)for(let t=0;t<2;t++){let i=MeasureUtil.makeLine({start:e[t].start,end:e[t].end,color:this.defaultColor,lineWidth:2});this.selectElements.push(i),this.svgGroup.push(i)}}attachAuxLines(e,t){let i=0;for(const n of e){let e=MeasureUtil.makeLine({start:n.start,end:n.end,color:this.defaultColor,lineWidth:this.lineWidth});e.setAttribute("stroke-dasharray","6,4"),e.style.stroke=t[i++],this.unSelectElements.push(e),this.svgGroup.push(e)}}attachNotation(e){if(0===e.length)return;let t=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},this.getMeasureResult(this.measureResult),this.id);for(const e of t)this.svgGroup.push(e)}calAuxLinesNotation(e){if(e&&e.length&&4===e.length){let t,i=["#E22532","#6CC91A","#399DFF"];for(let n=0,o=e.length-1;n<o;n++){let o={x:(e[n].x+e[n+1].x)/2,y:(e[n].y+e[n+1].y)/2,z:(e[n].z+e[n+1].z)/2},s=this.viewer.viewerAdapter.worldToCanvas(o);t=this.notation.drawAnnotation({x:s.x,y:s.y},this.getMeasureResult(this.auxLinesResult[n])+"",this.id,i[n]);for(const e of t)this.svgGroup.push(e),this.notation.notationSelected.push(e)}}}calAuxLines(){let e=this.worldPositions;for(var t=this.viewer.getDomElement().getBoundingClientRect(),i={x:e[1].x,y:e[0].y,z:e[0].z},n={x:e[1].x,y:e[1].y,z:e[0].z},o=[],s=[e[0],i,n,e[1]],r=0;r<s.length-1;r++){var a=this.viewer.viewerAdapter.worldPointsToClient(s[r],s[r+1]);if(a)a.start.x-=t.left,a.start.y-=t.top,a.end.x-=t.left,a.end.y-=t.top;else{a={start:{x:-1,y:-1},end:{x:-1,y:-1}}}o.push(a)}return{auxLines:o,auxLinePoints:s}}getMeasureResult(e){let t=this.measureParams.unit;e=e.toString();let i=MeasureResultFormat.formatDistance(e,this.measureParams);return i+=MeasureResultFormat.getPostFix(t,!1),i.split(",").join("")}}class Viewer3dAngle extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureAngle=t.angle,this.setMeasureParams({precision:t.precision})}initialize(){let e=this.getClientPoints();if(!e)return;this.hitTestSegments=e;for(let t=0;t<e.length-1;t++){let i=MeasureUtil.makeLine({start:e[t],end:e[t+1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(i)}for(let t=0;t<e.length;t++){let i=MeasureUtil.makeCircle({position:e[t],radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.unSelectElements.push(i),this.svgGroup.push(i),i.setAttribute("filter",this.filterUrl)}var t=this.getArcData(e[0],e[1],e[2]);if(!t)return void this.unselect();var i=MeasureUtil.makePath({color:this.defaultColor,lineWidth:this.lineWidth,arcRadius:25,info:t});this.svgGroup.push(i);var n=new Vector2((t.pointA.x+t.pointB.x)/2,(t.pointA.y+t.pointB.y)/2),o=new Vector2(e[1].x,e[1].y),s=n.clone().sub(o);if(0==s.x&&0==s.y){var r=0==o.clone().sub(t.pointA).y;r&&0==t.direction?s.y=35:r&&1==t.direction?s.y=-35:r||0!=t.direction?r||1!=t.direction||(s.x=35):s.x=-35}else s.normalize().multiplyScalar(35);n=o.clone().add(s);let a=this.notation.drawAnnotation(n,this.getMeasureResult(),this.id);for(const e of a)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect()}getClientPoints(){let e=[],t=this.calcLine(this.worldPositions[0],this.worldPositions[1]),i=this.calcLine(this.worldPositions[1],this.worldPositions[2]);return t.length>0&&e.push(t[0],t[1]),i.length>0&&(e.length>0?e.push(i[1]):e.push(i[0],i[1])),e}getArcData(e,t,i){if(!e||!t||!i)return!1;e=new Vector2(e.x,e.y),t=new Vector2(t.x,t.y),i=new Vector2(i.x,i.y);var n,o=e.sub(t),s=i.sub(t);if(o.length()<25||s.length()<25)return!1;o.setLength(25),s.setLength(25);var r=o.angle(),a=180*(s.angle()-r)/Math.PI;return a<0&&(a+=360),n=a<180?1:0,{pointA:t.clone().add(o),pointB:t.clone().add(s),flag:1,direction:n}}getMeasureResult(){this.measureParams.unit;let e=this.measureAngle.toString();return MeasureResultFormat.formatPrecision(e,this.measureParams.precision).split(",").join("")+"°"}}class Viewer3dElevation extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.elevationPoint=t.points[0],this.elevation="number"==typeof t.elevation?t.elevation:t.points[0].z,this.initialElevation=t.initialElevation,this.setMeasureParams({precision:t.precision,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){if(this.viewer.isInViewFrustum&&!this.viewer.isInViewFrustum(this.elevationPoint))return;var e=new THREE.Vector3(this.elevationPoint.x,this.elevationPoint.y,this.elevationPoint.z);e=this.viewer.worldToClient(e);for(var t=[58,-12,-12,-12,0,0,12,-12],i="",n=0;n<t.length;n+=2)t[n]+=e.x,t[n+1]+=e.y,i+=t[n]+","+t[n+1]+" ";var o=MeasureUtil.makePolyline({color:this.defaultColor,width:2,points:i});this.svgGroup.push(o);var s=new THREE.Vector2(e.x,e.y);let r=this.notation.drawAnnotation(s,this.getMeasureResult(),this.id);for(const e of r)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect()}getMeasureResult(){let e=this.measureParams.unit,t=this.elevation.toString(),i=MeasureResultFormat.formatDistance(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!1),i=i.split(",").join(""),0==i.split(" ")[0]&&(i=`±${i}`),i}hitTest(e){var t=new THREE.Vector3(this.elevationPoint.x,this.elevationPoint.y,this.elevationPoint.z);t=this.viewer.getViewer().worldToCanvas(t);let i=new THREE.Vector2(t.x-12,t.y-22),n=new THREE.Vector2(t.x+58,t.y-22);return MeasureUtil.distanceToSegment(e,i,n)<=22||this.notation.hitTest(e)}}class Viewer3dMinDistanceLine extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.selectedComponentsId=t.points,this.worldPositions=[t.start,t.end],this.measureResult=t.distance,this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){let e=this.calcLine(this.worldPositions[0],this.worldPositions[1]);this.hitTestSegments=e;let t=this.calcTerminalLines(e,Math.PI/3,8);for(let i=0;i<t.length;i++){let n=[];n.push(t[i].start,e[i],t[i].end);let o=MeasureUtil.makePolyline({color:this.defaultColor,width:2,points:MeasureUtil.calcPolylinePoints(n)});this.svgGroup.push(o)}if(0===e.length)return void this.unselect();let i=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(i);let n={x:(this.worldPositions[0].x+this.worldPositions[1].x)/2,y:(this.worldPositions[0].y+this.worldPositions[1].y)/2,z:(this.worldPositions[0].z+this.worldPositions[1].z)/2},o=this.viewer.worldToClient(n);if(!this.viewer.isInViewFrustum(n))return;let s=this.notation.drawAnnotation({x:o.x,y:o.y},this.getMeasureResult(),this.id);for(const e of s)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect()}actionWhenSelected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).addSelectedComponentsById([e.userId])})),this.viewer.render()}actionWhenUnselected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).removeSelectedId([e.userId])})),this.viewer.render()}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatDistance(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!1),i.split(",").join("")}}class MeasureArea extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult=t.area,this.viewPortId=t.viewPortId,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId||0,this.isOnBorder=t.isOnBorder,this.boundaryPoints=[],this.scratchVector=new Vector3,this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit})}initialize(e=!1,t,i){if(this.viewer.loadedDrawings.length>0&&!Number.isNaN(this.layoutId)&&this.viewer.getCurrentViewId(!0)!=this.layoutId)return;let n=new Box2,o=this.worldPositions;var s="";this.boundaryPoints=[],!this.previousNormalPoints&&(this.previousNormalPoints=[]);const r=o.length;for(var a=0;a<=r;a++){if(o[a%o.length].viewId&&!o[a%o.length].isActiveLayoutElement&&!this.isOnBorder&&this.viewer.isDrawingIndexNotExist(this.drawingIndex))return;let l=this.drawingIndexes?this.worldToClient(o[a%o.length],this.drawingIndexes[a%o.length]):this.worldToClient(o[a%o.length]);e&&a+1<o.length&&this.ifMaskDraw([l,this.worldToClient(o[(a+1)%o.length])],this.layoutId,this.viewPortId,this.drawingIndex,i,t),this.drawingIndexes&&a<r&&(this.mask||(this.previousNormalPoints[a]=[o[a%o.length],this.drawingIndexes[a%o.length]]),this.mask&&(this.worldPositions[a]=this.previousNormalPoints[a][0],this.drawingIndexes[a]=this.previousNormalPoints[a][1])),a!==o.length&&this.hitTestSegments.push(new Vector2(l.x,l.y));let h=MeasureUtil.makeCircle({position:l,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(h),h.setAttribute("filter",this.filterUrl),this.unSelectElements.push(h),this.boundaryPoints.push(l),n.expandByPoint(new Vector2(l.x,l.y)),s+=l.x+","+l.y+" "}var l=MeasureUtil.makePolyline({color:this.defaultColor,fillColor:this.defaultColor,width:2,points:s});l.setAttribute("fill-opacity",.2),this.svgGroup.insert(0,l);var h=n.getCenter(this.scratchVector);let d=this.notation.drawAnnotation(h,this.getMeasureResult());for(const e of d)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect(),!this.viewer.loadedDrawings&&!this.isShow&&this.hide()}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatArea(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!0),i.split(",").join("")}worldToClient(e,t=-1){let i=[],n=this.viewer.getViewer();if(e.isActiveLayoutElement)i=n.toScreenPoint(e.point);else{const o=e.point?e.point:e;i=this.isOnBorder?n.toScreenPoint(o):n.toViewportScreenPoint(o,e.viewPortId,-1==t?-1==this.drawingIndex?0:this.drawingIndex:t)}return{x:i[0],y:i[1]}}setViewId(e){this.viewId=e}getViewId(){return this.viewId}hitTest(e){let t=this.boundaryPoints,i=MeasureUtil.isPointInPolygon(e,t),n=!1;for(let t=0;t<this.hitTestSegments.length;t++)if(Math.abs(this.hitTestSegments[t].x-e.x)<=3&&Math.abs(this.hitTestSegments[t].y-e.y)<=3){n=!0;break}return i||n}}class DrawingDistance extends Viewer3dDistance{constructor(e,t,i,n){super(e,t,i,n),this.filterUrl=t.filterUrl,this.startPoint=new Vector2(t.start[0],t.start[1]),this.endPoint=new Vector2(t.end[0],t.end[1]),this.viewPortId=t.viewPortId,this.measureResult=t.distance,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId||0,this.isOnBorder=t.isOnBorder,this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit}),this.isOnLayoutMeasure=t.isOnLayout}initialize(e=!1,t,i){if(this.viewer.loadedDrawings.length>0&&!Number.isNaN(this.layoutId)&&this.viewer.getCurrentViewId(!0)!=this.layoutId)return;if(this.isOnLayoutMeasure&&!this.isOnBorder&&this.viewer.isDrawingIndexNotExist(this.drawingIndex))return;const n=()=>{let e=this.calAuxLines(),t=[];return t.push(e[0].start,e[1].end),this.hitTestSegments=t,{auxLines:e,linePoints:t,terminalLines:this.calcTerminalLines(t,Math.PI/2,6.5)}};let{auxLines:o,linePoints:s,terminalLines:r}=n();if(e&&this.ifMaskDraw(r,this.layoutId,this.viewPortId,this.drawingIndex,i,t),this.mask||(this.previousNormalPoints=[this.startPoint.clone(),this.endPoint.clone()]),this.mask){this.startPoint=this.previousNormalPoints[0],this.endPoint=this.previousNormalPoints[1];const e=n();o=e.auxLines,s=e.linePoints,r=e.terminalLines}this.attachSingleLine(s),this.attachTerminalLines(r);this.attachAuxLines(o,["#7CCF21","#CC021B"]),this.attachTerminalPoints(s),this.attachNotation(s),this.notation.dropShadow(this.filterUrl),this.unselect(),!this.viewer.loadedDrawings&&!this.isShow&&this.hide()}attachNotation(e){if(0===e.length)return;let t=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},this.getMeasureResult(),this.id);for(const e of t)this.svgGroup.push(e)}calAuxLines(){let e=[],t=this.startPoint.clone(),i=this.endPoint.clone(),n={x:i.x,y:t.y};e.push(t,n,i);let o=[];for(let t=0;t<e.length-1;t++){let i=this.worldToClient(e[t],this.drawingIndexes&&this.drawingIndexes[0]),n=this.worldToClient(e[t+1],0==t?this.drawingIndexes&&this.drawingIndexes[0]:this.drawingIndexes&&this.drawingIndexes[1]);o.push({start:new Vector2(i.x,i.y),end:new Vector2(n.x,n.y)})}return o}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatDistance(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!1),i.split(",").join("")}worldToClient(e,t=-1){if(this.isOnLayoutMeasure){let i=this.isOnBorder?this.viewer.worldToClient(e):this.viewer.getViewer().toViewportScreenPoint([e.x,e.y],this.viewPortId,-1==t?this.drawingIndex:t);return{x:i[0],y:i[1]}}return this.viewer.worldToClient(e)}setViewId(e){this.viewId=e}getViewId(){return this.viewId}}class DrawingAngle extends Viewer3dAngle{constructor(e,t,i,n){super(e,t,i,n),this.isOnLayoutMeasure=t.isOnLayout,this.viewPortId=t.viewPortId,this.drawingIndex=t.drawingIndex,this.layoutId=t.layoutId||0,this.isOnBorder=t.isOnBorder}getClientPoints(){if(this.viewer.loadedDrawings.length>0&&!Number.isNaN(this.layoutId)&&this.viewer.getCurrentViewId(!0)!=this.layoutId)return;let e=[];for(let t=0;t<this.worldPositions.length;t++){if(this.isOnLayoutMeasure&&!this.isOnBorder&&this.viewer.isDrawingIndexNotExist(this.drawingIndex))continue;let i=new Vector2(this.worldPositions[t][0],this.worldPositions[t][1]),n=this.worldToClient(i,this.worldPositions[t][2]);e.push(new Vector2(n.x,n.y))}return e}worldToClient(e,t){if(this.isOnLayoutMeasure){let i=this.isOnBorder?this.viewer.worldToClient(e):this.viewer.getViewer().toViewportScreenPoint([e.x,e.y],t,this.drawingIndex);return{x:i[0],y:i[1]}}return this.viewer.worldToClient(e)}setViewId(e){this.viewId=e}getViewId(){return this.viewId}}class ViewerGISPolylineDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult={distance:t.distance,totalDistance:t.totalDistance},this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){let e=this.worldPositions.length;if(!(e<2)){for(let t=1;t<e;t++){let e=this.calcLine(this.worldPositions[t],this.worldPositions[t-1]);0!==e.length&&(1===t&&this.hitTestSegments.push(e[1]),this.hitTestSegments.push(e[0]),this.attachSelectedTerminalPoints(e[0]),this.attachLines(e),this.attachSelectedTerminalPoints(e[1]),this.attachUnselectedTerminalPoints(e[0]),this.attachUnselectedTerminalPoints(e[1]))}this.attachNotations(),this.unselect()}}attachSelectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:0,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.selectElements.push(t)}attachLines(e){let t=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(t)}attachUnselectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.unSelectElements.push(t)}attachNotations(){const e=this.worldPositions.length,t=this.getMeasureResult();for(let i=1;i<e;i++){let e={x:(this.worldPositions[i].x+this.worldPositions[i-1].x)/2,y:(this.worldPositions[i].y+this.worldPositions[i-1].y)/2,z:(this.worldPositions[i].z+this.worldPositions[i-1].z)/2},n=this.viewer.worldToClient(e);this.viewer.isInViewFrustum(e)&&this.attachNotation([n,n],t.distance[i-1])}let i={x:this.worldPositions[e-1].x,y:this.worldPositions[e-1].y,z:this.worldPositions[e-1].z},n=this.viewer.worldToClient(i);this.viewer.isInViewFrustum(i)&&this.attachNotation([n,n],`总长度:${t.totalDistance}`,!0),this.notation.dropShadow(this.filterUrl)}attachNotation(e,t,i){if(0===e.length)return;let n=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id,i);for(const e of n)this.svgGroup.push(e)}getMeasureResult(){let e=this.measureParams.unit,{distance:t,totalDistance:i}=this.measureResult,n=[],o=0;return t.forEach((t=>{o+=t;let i=t.toString();i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n.push(i)})),o=o.toString(),o=MeasureResultFormat.formatDistance(o,this.measureParams),o+=MeasureResultFormat.getPostFix(e,!1),{distance:n,totalDistance:o}}}class ViewerGISGroundlineDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult={distance:t.distance,totalDistance:t.totalDistance},this.groundInfos=t.groundInfos,this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit}),this.borderColor=n.color||new Glodon.Web.Graphics.Color(255,157,11,1),this.borderWidth=n.width||3}initialize(){let e=this.worldPositions.length;if(!(e<2)){for(let t=1;t<e;t++){let e=this.calcLine(this.worldPositions[t],this.worldPositions[t-1]);0!==e.length&&(1===t&&this.hitTestSegments.push(e[1]),this.hitTestSegments.push(e[0]),this.attachSelectedTerminalPoints(e[0]),this.attachSelectedTerminalPoints(e[1]),this.attachUnselectedTerminalPoints(e[0]),this.attachUnselectedTerminalPoints(e[1]))}this.updateGroundLine(this.worldPositions),this.attachNotations(),this.unselect()}}updateGroundLine(e){this.groundLine?this.groundLine.geometry.updateGeometry({points:e}):(this.groundLine=CLOUD.GroundPrimitiveManager.getInstance().createGroundCurve({points:e,color:this.borderColor,width:this.borderWidth,style:"Continuous",type:"polyline"}),this.groundLine.onAdded())}clearGroundLine(){this.groundLine&&(this.groundLine.onRemoved(),this.groundLine.dispose(),this.groundLine=null)}attachSelectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:0,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.selectElements.push(t)}attachLines(e){}attachUnselectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.unSelectElements.push(t)}attachNotations(){const e=this.worldPositions.length,t=this.getMeasureResult();for(let i=0;i<e-1;i++){let e={x:(this.worldPositions[i].x+this.worldPositions[i+1].x)/2,y:(this.worldPositions[i].y+this.worldPositions[i+1].y)/2,z:(this.worldPositions[i].z+this.worldPositions[i+1].z)/2},n=this.viewer.worldToClient(e);this.viewer.isInViewFrustum(e)&&this.attachNotation([n,n],t.distance[i])}let i={x:this.worldPositions[e-1].x,y:this.worldPositions[e-1].y,z:this.worldPositions[e-1].z},n=this.viewer.worldToClient(i);this.viewer.isInViewFrustum(i)&&this.attachNotation([n,n],`总长度:${t.totalDistance}`,!0),this.notation.dropShadow(this.filterUrl)}attachNotation(e,t,i){if(0===e.length)return;let n=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id,i);for(const e of n)this.svgGroup.push(e)}detach(e){super.detach(),e&&this.clearGroundLine()}getMeasureResult(){let e=this.measureParams.unit,{distance:t,totalDistance:i}=this.measureResult,n=[],o=0;return t.forEach((t=>{o+=t;let i=t.toString();i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n.push(i)})),o=o.toString(),o=MeasureResultFormat.formatDistance(o,this.measureParams),o+=MeasureResultFormat.getPostFix(e,!1),{distance:n,totalDistance:o}}}class ViewerGISPosition extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.positionPoint=t.points[0],this.measureResult={alt:t.altitude,lonLat:t.lonLat},this.innerRadius=3,this.innerStrokeWidth=2,this.outerRadius=7,this.outerStrokeWidth=1,this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){if(!this.viewer.isInViewFrustum(this.positionPoint))return;var e=new THREE.Vector3(this.positionPoint.x,this.positionPoint.y,this.positionPoint.z);e=this.viewer.worldToClient(e),this.attachSelectedCircle(e),this.attachUnselectedCircle(e);var t=new THREE.Vector2(e.x,e.y);let i=this.notation.drawAnnotation(t,this.getMeasureResult(),this.id);for(const e of i)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect()}attachSelectedCircle(e){let t=MeasureUtil.makeConcentricCircle({innerRadius:this.innerRadius,innerStrokeWidth:this.innerStrokeWidth,outerRadius:this.outerRadius,color:this.defaultColor,position:e});this.selectElements.push(t),this.svgGroup.push(t)}attachUnselectedCircle(e){let t=MeasureUtil.makeConcentricCircle({innerRadius:this.innerRadius,innerStrokeWidth:this.innerStrokeWidth,outerRadius:this.outerRadius,outerStrokeWidth:this.outerStrokeWidth,color:this.defaultColor,position:e});this.unSelectElements.push(t),this.svgGroup.push(t)}hitTest(e){var t=new THREE.Vector3(this.positionPoint.x,this.positionPoint.y,this.positionPoint.z);t=this.viewer.worldToClient(t);let i=new THREE.Vector2(t.x-12,t.y-22),n=new THREE.Vector2(t.x+58,t.y-22);return MeasureUtil.distanceToSegment(e,i,n)<=22||this.notation.hitTest(e)}getMeasureResult(){let e=this.measureParams.unit,{alt:t,lonLat:i}=this.measureResult,{elevation:n,latLon:o}=this.measureParams.precision,s={defaultUnit:this.measureParams.defaultUnit,precision:n,scale:this.measureParams.scale,unit:this.measureParams.unit},r=MeasureResultFormat.formatPrecision(i.latitude.toString(),o),a=MeasureResultFormat.formatPrecision(i.longitude.toString(),o),l=MeasureResultFormat.formatDistance(t.toString(),s);return l+=MeasureResultFormat.getPostFix(e,!1),`经度:${a} ° \n纬度:${r} ° \n高程:${l}`}}class ViewerGISTriangleDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult={distance:t.distance,horizontalDistance:t.horizontalDistance,verticalDistance:t.verticalDistance},this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){if(this.worldPositions.length<2)return;let e=this.getMeasureResult();if(this.attachSegmentByTerminalPoints(this.worldPositions,e.distance),this.worldPositions[0].z!=this.worldPositions[1].z){let t=this.worldPositions[0].z<this.worldPositions[1].z?this.worldPositions[0]:this.worldPositions[1],i=this.worldPositions[0].z<this.worldPositions[1].z?this.worldPositions[1]:this.worldPositions[0],n=this.calcTrianglePoint(this.worldPositions);this.attachSegmentByTerminalPoints([t,n],e.verticalDistance),this.attachSegmentByTerminalPoints([i,n],e.horizontalDistance)}else this.attachSegmentByTerminalPoints([this.worldPositions[0],this.worldPositions[0]],e.horizontalDistance);this.notation.dropShadow(this.filterUrl),this.unselect()}calcTrianglePoint(e){if(e.length<2)return null;let t=new THREE.Vector3;return e[0].z<e[1].z?t.set(e[0].x,e[0].y,e[1].z):e[0].z>e[1].z&&t.set(e[1].x,e[1].y,e[0].z),t}attachSegmentByTerminalPoints(e,t){let i=e[0],n=e[1],o=this.calcLine(i,n);this.hitTestSegments=this.hitTestSegments.concat(o),this.attachLine(o),this.attachSelectedTerminalPoints(o),this.attachUnselectedTerminalPoints(o);let s={x:(i.x+n.x)/2,y:(i.y+n.y)/2,z:(i.z+n.z)/2},r=this.viewer.worldToClient(s);this.viewer.isInViewFrustum(s)&&this.attachNotation([r,r],t)}attachSelectedTerminalPoints(e){for(const t of e){let e=MeasureUtil.makeCircle({position:t,radius:this.radius,strokeWidth:0,color:this.defaultColor});this.svgGroup.push(e),e.setAttribute("filter",this.filterUrl),this.selectElements.push(e)}}attachLine(e){if(0===e.length)return;let t=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(t)}attachUnselectedTerminalPoints(e){for(const t of e){let e=MeasureUtil.makeCircle({position:t,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(e),e.setAttribute("filter",this.filterUrl),this.unSelectElements.push(e)}}attachNotation(e,t){if(0===e.length)return;let i=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id);for(const e of i)this.svgGroup.push(e)}getMeasureResult(){const e=this.measureParams.unit;let{distance:t,horizontalDistance:i,verticalDistance:n}=this.measureResult;return t=t.toString(),t=MeasureResultFormat.formatDistance(t,this.measureParams),t+=MeasureResultFormat.getPostFix(e,!1),i=i.toString(),i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n=n.toString(),n=MeasureResultFormat.formatDistance(n,this.measureParams),n+=MeasureResultFormat.getPostFix(e,!1),{distance:t,horizontalDistance:i,verticalDistance:n}}}class ViewerGISSpatialArea extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.fillColor=new Glodon.Web.Graphics.Color(255,157,11,.2),this.filterUrl=t.filterUrl,this.worldPositions=t.points,this.measureResult=t.area,this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){const e=this.worldPositions,t=e.length;if(!(t<3)&&this.areaFrontOfCamera(e)){this.attachArea(e);for(let i=0;i<t;i++){let n=this.viewer.worldToClient(e[i]);n=new THREE.Vector2(n.x,n.y),this.hitTestSegments.push(n),this.attachSelectedTerminalPoints(n),this.attachUnselectedTerminalPoints(n),i==t-1&&this.attachNotation(n,`${this.getNotationTitle()}:${this.getMeasureResult()}`)}this.unselect()}}attachSelectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:0,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.selectElements.push(t)}attachArea(e){let t="";e.forEach((e=>{let i=this.viewer.worldToClient(e);t+=i.x+","+i.y+" "}));let i=MeasureUtil.makePolygon({points:t,width:this.lineWidth,color:this.defaultColor,fillColor:this.fillColor.getRGBA()});this.svgGroup.push(i)}attachUnselectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.unSelectElements.push(t)}attachNotation(e,t){let i=this.notation.drawAnnotation({x:e.x,y:e.y},t,this.id,!0);for(const e of i)this.svgGroup.push(e)}getNotationTitle(){return BimfaceLanguage.bf_tip_measure_spatial_area}areaFrontOfCamera(e){let t=this.viewer,i=t.getViewer(),n=new THREE.Vector3,o=new THREE.Plane(t.sceneToWorld(i.camera.getWorldDirection(n)).normalize());o.constant=-o.distanceToPoint(t.sceneToWorld(i.camera.position));for(let t=0;t<e.length;t++)if(o.distanceToPoint(e[t])<0)return!1;return!0}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString();return t=MeasureResultFormat.formatArea(t,this.measureParams),t+=MeasureResultFormat.getPostFix(e,!0),t}}class ViewerGISProjectedArea extends ViewerGISSpatialArea{constructor(e,t,i,n){super(e,t,i,n)}getNotationTitle(){return BimfaceLanguage.bf_tip_measure_projected_area}}class MeasureSurfaceAreaMesh{constructor(e){e&&(this._opt=e,this.measurePoints=e.points||[],this.fillColor=e.fillColor||new Glodon$1.Web.Graphics.Color(255,157,11,.2),this.borderColor=e.color||new Glodon$1.Web.Graphics.Color(255,157,11,1),this.borderWidth=e.width||3,this.update())}setMeasurePoints(e){"[object Array]"===Object.prototype.toString.call(e)?(this.measurePoints=e,this.update()):console.warn("Parameter points is invalid.")}update(){if(this.measurePoints.length<2)this.disposeGroundBorder(),this.disposeGroundSurface();else if(2===this.measurePoints.length)this.disposeGroundSurface(),this.updateGroundBorder(this.measurePoints);else if(this.measurePoints.length>2){this.updateGroundSurface(this.measurePoints);let e=[...this.measurePoints];e.push(this.measurePoints[0]),this.updateGroundBorder(e)}}updateGroundBorder(e){this.groundBorder?this.groundBorder.geometry.updateGeometry({points:e}):(this.groundBorder=CLOUD.GroundPrimitiveManager.getInstance().createGroundCurve({points:e,color:this.borderColor,width:this.borderWidth,style:"Continuous",type:"polyline"}),this.groundBorder.onAdded())}updateGroundSurface(e){this.groundSurface?this.groundSurface.geometry.updateGeometry({points:e}):(this.groundSurface=CLOUD.GroundPrimitiveManager.getInstance().createGroundPolygon({points:e,color:this.fillColor}),this.groundSurface.onAdded())}updateTerminalPoints(e){this.selectedGroup||(this.selectedGroup=new THREE.Group,this.add(this.selectedGroup));let t=this.selectedGroup.children;for(let e=t.length-1;e>=0;e--)this.selectedGroup.remove(t[e]);let i=new THREE.CircleGeometry(200,180),n=new THREE.MeshBasicMaterial({color:this.borderColor,side:THREE.DoubleSide,depthTest:!1}),o=new THREE.Mesh(i,n);for(let t=0,i=e.length;t<i;t++){let i=o.clone();i.position.copy(e[t]),this.selectedGroup.add(i)}this.updateMatrixWorld()}hide(){this.hideGroundSurface(),this.hideGroundBorder()}hideGroundSurface(){this.groundSurface&&(this.groundSurface.visible=!1)}hideGroundBorder(){this.groundBorder&&(this.groundBorder.visible=!1)}show(){this.showGroundSurface(),this.showGroundBorder()}showGroundSurface(){this.groundSurface&&(this.groundSurface.visible=!0)}showGroundBorder(){this.groundBorder&&(this.groundBorder.visible=!0)}disposeGroundSurface(){this.groundSurface&&(this.groundSurface.onRemoved(),this.groundSurface.dispose(),this.groundSurface=null)}disposeGroundBorder(){this.groundBorder&&(this.groundBorder.onRemoved(),this.groundBorder.dispose(),this.groundBorder=null)}dispose(){this.measurePoints=null,this.disposeGroundSurface(),this.disposeGroundBorder()}}class ViewerGISSurfaceArea extends ViewerGISSpatialArea{constructor(e,t,i,n){super(e,t,i,n),this.measureSurfaceMesh=null,this.layerType=t.layerType}initialize(){this.measureSurfaceMesh||(this.measureSurfaceMesh=new MeasureSurfaceAreaMesh({fillColor:new Glodon.Web.Graphics.Color(255,157,11,.2),color:new Glodon.Web.Graphics.Color(255,157,11,1),width:this.lineWidth})),super.initialize()}attachArea(e){this.measureSurfaceMesh.setMeasurePoints(e),this.viewer.render()}getNotationTitle(){return BimfaceLanguage.bf_tip_measure_surface_area}clear(e){super.clear(),this.measureSurfaceMesh&&e&&(this.measureSurfaceMesh.dispose(),this.measureSurfaceMesh=null)}}class Viewer3dLaserClearDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.lineWidth=1,this.data=t,this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){const e={X:"#CC021B",Y:"#7CCF21",Z:"#4A90E2"};let t=[];const i=n=>{const o=this.data[`Laser${n}`];if(o){const s=e[n],[r,a]=o.endPoints,l=new THREE.Vector3(r.x,r.y,r.z),h=new THREE.Vector3(a.x,a.y,a.z),d=o.distance;let c=this.calcLine(l,h);if(2!==c.length)return i;let u=MeasureUtil.makeLine({start:c[0],end:c[1],color:s,lineWidth:this.lineWidth});this.svgGroup.push(u);let p=this.calcTerminalLines(c,5*Math.PI/6,8);for(let e=0;e<p.length;e++){let t=[];t.push(p[e].start,c[e],p[e].end);let i=MeasureUtil.makePolyline({color:s,width:this.lineWidth,points:MeasureUtil.calcPolylinePoints(t)});this.svgGroup.push(i)}let g={x:(l.x+h.x)/2,y:(l.y+h.y)/2,z:(l.z+h.z)/2},m=this.viewer.worldToClient(g);if(!this.viewer.isInViewFrustum(g)){const{offsetHeight:e,offsetWidth:t}=this.viewer.getDomElement(),n=i=>i.x>0&&i.y>0&&i.x<t&&i.y<e;let o=new THREE.Vector3(this.data.pointSelected.x,this.data.pointSelected.y,this.data.pointSelected.z);if(!this.viewer.isInViewFrustum(o))return i;let s=this.viewer.worldToClient(o),r=new THREE.Vector3(s.x,s.y,s.z),a=new THREE.Vector3(m.x,m.y,m.z);const l=100;if(m=r.clone().add(a.clone().sub(r).normalize().multiplyScalar(l)),n(m)||(m=r.clone().add(a.clone().sub(r).normalize().multiplyScalar(-l))),!n(m))return i}let f=this.notation.drawAnnotation({x:m.x,y:m.y},this.getMeasureResult(d),this.id,s);t.push(f)}return i};i("X")("Y")("Z"),t.flat().forEach((e=>this.svgGroup.push(e))),this.unselect()}getMeasureResult(e){let t=this.measureParams.unit,i=e.toString(),n=MeasureResultFormat.formatDistance(i,this.measureParams);return n+=MeasureResultFormat.getPostFix(t,!1),n.split(",").join("")}select(){super.select()}unselect(){super.unselect()}}class Viewer3dVolume extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.selectedComponentsId=t.points,this.worldPosition=this.viewer.sceneToWorld(t.volumePosition),this.measureResult=t.volumeResult,this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(){if(!this.measureResult)return;let e=this.viewer.worldToClient(this.worldPosition),t=this.notation.drawAnnotation({x:e.x,y:e.y},this.getMeasureResult(),this.id);for(const e of t)this.svgGroup.push(e);this.notation.dropShadow(this.filterUrl),this.unselect()}actionWhenSelected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).addSelectedComponentsById([e.userId])})),this.viewer.render()}actionWhenUnselected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).removeSelectedId([e.userId])})),this.viewer.render()}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatCubic(t,this.measureParams);return i=i+MeasureResultFormat.getPostFix(e,!1)+"³",i.split(",").join("")}}class DrawingPolylineDistance extends MeasureDrawable{constructor(e,t,i,n){super(e,i,t.type,n),this.filterUrl=t.filterUrl,this.isOnLayoutMeasure=t.isOnLayout,this.viewPortId=t.viewPortId,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId||0,this.isOnBorder=t.isOnBorder,this.worldPositions=t.points?t.points:[];for(let e=0;e<this.worldPositions.length;e++)this.worldPositions[e]=new Vector2(this.worldPositions[e][0],this.worldPositions[e][1]);this.measureResult={distance:t.distance,totalDistance:t.totalDistance},this.selectElements=[],this.unSelectElements=[],this.setMeasureParams({precision:t.precision,scale:t.scale,unit:t.unit,defaultUnit:t.defaultUnit})}initialize(e=!1,t,i){if(this.viewer.loadedDrawings.length>0&&!Number.isNaN(this.layoutId)&&this.viewer.getCurrentViewId(!0)!=this.layoutId)return;if(this.isOnLayoutMeasure&&!this.isOnBorder&&this.viewer.isDrawingIndexNotExist(this.drawingIndex))return;let n=this.worldPositions.length;if(!(n<2)){this.previousNormalPoints||(this.previousNormalPoints=[]);for(let o=1;o<n;o++){let n=[this.worldToClient(this.worldPositions[o],this.drawingIndexes[o]),this.worldToClient(this.worldPositions[o-1],this.drawingIndexes[o-1])];0!==n.length&&(e&&this.ifMaskDraw(n,this.layoutId,this.viewPortId,this.drawingIndex,i,t),this.mask||(this.previousNormalPoints[o]=[this.worldPositions[o],this.drawingIndexes[o]],1==o&&(this.previousNormalPoints[0]=[this.worldPositions[0],this.drawingIndexes[0]])),this.mask&&(1==o&&(this.worldPositions[0]=this.previousNormalPoints[0][0],this.drawingIndexes[0]=this.previousNormalPoints[0][1]),this.worldPositions[o]=this.previousNormalPoints[o][0],this.drawingIndexes[o]=this.previousNormalPoints[o][1],n=[this.worldToClient(this.worldPositions[o],this.drawingIndexes[o]),this.worldToClient(this.worldPositions[o-1],this.drawingIndexes[o-1])]),1===o&&this.hitTestSegments.push(new Vector2(n[1].x,n[1].y)),this.hitTestSegments.push(new Vector2(n[0].x,n[0].y)),this.attachSelectedTerminalPoints(n[0]),this.attachLines(n),this.attachSelectedTerminalPoints(n[1]),this.attachUnselectedTerminalPoints(n[0]),this.attachUnselectedTerminalPoints(n[1]))}this.attachNotations(),this.unselect()}}worldToClient(e,t=-1){if(this.isOnLayoutMeasure){let i=this.isOnBorder?this.viewer.worldToClient(e):this.viewer.getViewer().toViewportScreenPoint([e.x,e.y],this.viewPortId,-1==t?this.drawingIndex:t);return{x:i[0],y:i[1]}}return this.viewer.worldToClient(e)}attachSelectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:0,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.selectElements.push(t)}attachLines(e){let t=MeasureUtil.makeLine({start:e[0],end:e[1],color:this.defaultColor,lineWidth:this.lineWidth});this.svgGroup.push(t)}attachUnselectedTerminalPoints(e){let t=MeasureUtil.makeCircle({position:e,radius:this.radius,strokeWidth:this.strokeWidth,color:this.defaultColor});this.svgGroup.push(t),t.setAttribute("filter",this.filterUrl),this.unSelectElements.push(t)}attachNotations(){const e=this.worldPositions.length,t=this.getMeasureResult();for(let i=1;i<e;i++){let e={x:(this.worldPositions[i].x+this.worldPositions[i-1].x)/2,y:(this.worldPositions[i].y+this.worldPositions[i-1].y)/2},n=this.worldToClient(e);this.attachNotation([n,n],t.distance[i-1])}let i={x:this.worldPositions[e-1].x,y:this.worldPositions[e-1].y},n=this.worldToClient(i);n.x+=10+MeasureUtil.measureText(`${BimfaceLanguage.bf_panel_measure_total_distance}:${t.totalDistance}`)/2,n.y-=15,this.attachNotation([n,n],`${BimfaceLanguage.bf_panel_measure_total_distance}:${t.totalDistance}`),this.notation.dropShadow(this.filterUrl)}attachNotation(e,t,i){if(0===e.length)return;let n=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id,i);for(const e of n)this.svgGroup.push(e)}getMeasureResult(){let e=this.measureParams.unit,{distance:t,totalDistance:i}=this.measureResult,n=[],o=0;return t.forEach((t=>{o+=t;let i=t.toString();i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n.push(i)})),o=o.toString(),o=MeasureResultFormat.formatDistance(o,this.measureParams),o+=MeasureResultFormat.getPostFix(e,!1),{distance:n,totalDistance:o}}setViewId(e){this.viewId=e}getViewId(){return this.viewId}}class MeasureItemFactory{constructor(e){this.viewer=e}make(e,t,i,n){let o=null,s="ViewerDrawing"===this.viewer.getViewerType(),r={defaultColor:`#${n._opt.color.getHEX()}`,enableAuxiliaryValue:n._opt.enableAuxiliaryValue};switch(e){case"Distance":o=s?new DrawingDistance(this.viewer,t,i,r):new Viewer3dDistance(this.viewer,t,i,r);break;case"Angle":o=s?new DrawingAngle(this.viewer,t,i,r):new Viewer3dAngle(this.viewer,t,i,r);break;case"MinimumDistance":o=new Viewer3dMinDistanceLine(this.viewer,t,i,r);break;case"Elevation":o=new Viewer3dElevation(this.viewer,t,i,r);break;case"Area":o=new MeasureArea(this.viewer,t,i,r);break;case"GroundlineDistance":o=new ViewerGISGroundlineDistance(this.viewer,t,i,r);break;case"PolylineDistance":o=s?new DrawingPolylineDistance(this.viewer,t,i,r):new ViewerGISPolylineDistance(this.viewer,t,i,r);break;case"Position":o=new ViewerGISPosition(this.viewer,t,i,r);break;case"TriangleDistance":o=new ViewerGISTriangleDistance(this.viewer,t,i,r);break;case"SpatialArea":o=new ViewerGISSpatialArea(this.viewer,t,i,r);break;case"ProjectedArea":o=new ViewerGISProjectedArea(this.viewer,t,i,r);break;case"SurfaceArea":o=new ViewerGISSurfaceArea(this.viewer,t,i,r);break;case"LaserClearDistance":o=new Viewer3dLaserClearDistance(this.viewer,t,i,r),o.measure=n;break;case"Volume":o=new Viewer3dVolume(this.viewer,t,i,r)}return o.initialize(),o}}class Viewer3dDistance$1 extends Viewer3dDistance{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex}calculate(e){this.worldPositions[this.updateIndex]=e,this.distanceX=Math.abs(this.worldPositions[1].x-this.worldPositions[0].x),this.distanceY=Math.abs(this.worldPositions[1].y-this.worldPositions[0].y),this.distanceZ=Math.abs(this.worldPositions[1].z-this.worldPositions[0].z),this.measureResult=Math.sqrt(Math.pow(this.distanceX,2)+Math.pow(this.distanceY,2)+Math.pow(this.distanceZ,2))}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),distance:this.measureResult,distanceX:this.distanceX,distanceY:this.distanceY,distanceZ:this.distanceZ,points:this.worldPositions,type:this.type}}}class Viewer3dAngle$1 extends Viewer3dAngle{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureAngle=t.measureAngle,this.updateIndex=t.updateIndex}calculate(e){this.worldPositions[this.updateIndex]=e;var t=new THREE.Vector3(this.worldPositions[0].x-this.worldPositions[1].x,this.worldPositions[0].y-this.worldPositions[1].y,this.worldPositions[0].z-this.worldPositions[1].z),i=new THREE.Vector3(this.worldPositions[2].x-this.worldPositions[1].x,this.worldPositions[2].y-this.worldPositions[1].y,this.worldPositions[2].z-this.worldPositions[1].z),n=t.angleTo(i);this.measureAngle=180*n/Math.PI}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),angle:this.measureAngle,points:this.worldPositions,type:this.type}}}class DrawingDistance$1 extends DrawingDistance{constructor(e,t){t.start=t.startPoint,t.end=t.endPoint,super(e,t,t.id,{defaultColor:t.defaultColor}),this.startPoint=new Vector2(t.worldPositions[0][0],t.worldPositions[0][1]),this.endPoint=new Vector2(t.worldPositions[1][0],t.worldPositions[1][1]),this.viewPortId=t.viewPortId,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex,this.isOnLayoutMeasure=t.isOnLayoutMeasure,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId,this.isOnBorder=t.isOnBorder}calculate(e,t){if(this.viewPortId&&t!=this.viewPortId)return;0===this.updateIndex?this.startPoint=new Vector2(e[0],e[1]):this.endPoint=new Vector2(e[0],e[1]);let i=this.endPoint.x-this.startPoint.x,n=this.endPoint.y-this.startPoint.y;this.measureResult=Math.sqrt(i*i+n*n)}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),start:[this.startPoint.x,this.startPoint.y],end:[this.endPoint.x,this.endPoint.y],points:[[this.startPoint.x,this.startPoint.y],[this.endPoint.x,this.endPoint.y]],viewPortId:this.viewPortId,distance:this.measureResult,isOnLayout:this.isOnLayoutMeasure,drawingIndex:this.drawingIndex,drawingIndexes:this.drawingIndexes,layoutId:this.layoutId,isOnBorder:this.isOnBorder,type:this.type}}}class DrawingAngle$1 extends Viewer3dAngle$1{constructor(e,t){super(e,t),this.isOnLayoutMeasure=t.isOnLayoutMeasure,this.viewPortId=t.viewPortId,this.drawingIndex=t.drawingIndex,this.layoutId=t.layoutId,this.drawingIndex=t.drawingIndex,this.isOnBorder=t.isOnBorder}calculate(e,t){if(this.viewer.loadedDrawings.length>0&&!Number.isNaN(this.layoutId)&&this.viewer.getCurrentViewId(!0)!=this.layoutId)return;if(this.viewPortId&&t!=this.viewPortId)return;this.worldPositions[this.updateIndex]=e;let i=this.getClientPoints();this.measureAngle=this.angleByArr([i[0].x,i[0].y],[i[1].x,i[1].y],[i[2].x,i[2].y])}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),angle:this.measureAngle,points:this.worldPositions,isOnLayout:this.isOnLayoutMeasure,viewPortId:this.viewPortId,drawingIndex:this.drawingIndex,layoutId:this.layoutId,isOnBorder:this.isOnBorder,type:this.type}}angleByArr(e,t,i){let n=Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)),o=Math.sqrt(Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2)),s=Math.sqrt(Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2)),r=(Math.pow(n,2)+Math.pow(o,2)-Math.pow(s,2))/(2*n*o);return r=r.toFixed(12),180*Math.acos(r)/Math.PI}getClientPoints(){let e=[];for(let t=0;t<this.worldPositions.length;t++){let i=new Vector2(this.worldPositions[t][0],this.worldPositions[t][1]),n=this.worldToClient(i,this.worldPositions[t][2]);e.push(new Vector2(n.x,n.y))}return e}worldToClient(e,t){if(this.isOnLayoutMeasure){let i=this.viewer.getViewer().toViewportScreenPoint([e.x,e.y],t,this.drawingIndex);return{x:i[0],y:i[1]}}return this.viewer.worldToClient(e)}setViewId(e){this.viewId=e}getViewId(){return this.viewId}}class DrawingArea extends MeasureArea{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.viewPortId=t.viewPortId,this.updateIndex=t.updateIndex,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId,this.isOnBorder=t.isOnBorder}calculate(e,t){if(this.viewPortId&&t!=this.viewPortId)return;this.worldPositions[this.updateIndex]={point:[e[0],e[1]],viewPortId:t,isActiveLayoutElement:-1===t};let i=[];for(var n=0;n<this.worldPositions.length;n++)i.push(this.worldPositions[n].point);this.measureResult=this.getArea(i)}getArea(e){var t=e.length;if(t<3)return 0;for(var i=e[0][1]*(e[t-1][0]-e[1][0]),n=1;n<t;++n)i+=e[n][1]*(e[n-1][0]-e[(n+1)%t][0]);return Math.abs(i/2)}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),area:this.measureResult,points:this.worldPositions,viewPortId:this.viewPortId,drawingIndex:this.drawingIndex,drawingIndexes:this.drawingIndexes,layoutId:this.layoutId,isOnBorder:this.isOnBorder,type:this.type}}}class DrawingPolylineDistance$1 extends DrawingPolylineDistance{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.isOnLayoutMeasure=t.isOnLayoutMeasure,this.viewPortId=t.viewPortId,this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex,this.drawingIndex=t.drawingIndex,this.drawingIndexes=t.drawingIndexes,this.layoutId=t.layoutId,this.isOnBorder=t.isOnBorder}calculate(e,t){if(this.viewPortId&&t!=this.viewPortId)return;this.worldPositions[this.updateIndex]=new Vector2(e[0],e[1]);let i=[],n=0;for(let e=1;e<this.worldPositions.length;e++){let t=this.worldPositions[e].x-this.worldPositions[e-1].x,o=this.worldPositions[e].y-this.worldPositions[e-1].y,s=Math.sqrt(t*t+o*o);i.push(s),n+=s}this.measureResult={distance:i,totalDistance:n}}getInfo(){let e=[];for(let t=0;t<this.worldPositions.length;t++)e.push([this.worldPositions[t].x,this.worldPositions[t].y]);return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),distance:this.measureResult.distance,totalDistance:this.measureResult.totalDistance,isOnLayout:this.isOnLayoutMeasure,viewPortId:this.viewPortId,points:e,drawingIndex:this.drawingIndex,drawingIndexes:this.drawingIndexes,layoutId:this.layoutId,isOnBorder:this.isOnBorder,type:this.type}}}class ViewerGISPolylineDistance$1 extends ViewerGISPolylineDistance{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex}calculate(e){this.worldPositions[this.updateIndex]=e;let t=this.worldPositions.length,i=[],n=0;for(let e=1;e<t;e++){let t=this.worldPositions[e].distanceTo(this.worldPositions[e-1]);i.push(t),n+=t}this.measureResult={distance:i,totalDistance:n}}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),distance:this.measureResult.distance,totalDistance:this.measureResult.totalDistance,points:this.worldPositions,type:this.type}}}class ViewerGISTriangleDistance$1 extends ViewerGISTriangleDistance{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex}calculate(e){this.worldPositions[this.updateIndex]=e,this.measureResult.distance=this.worldPositions[0].distanceTo(this.worldPositions[1]);let t=this.worldPositions[0].clone(),i=0,n=0;this.worldPositions[0].z<this.worldPositions[1].z?(t.set(this.worldPositions[0].x,this.worldPositions[0].y,this.worldPositions[1].z),i=t.distanceTo(this.worldPositions[1]),n=t.distanceTo(this.worldPositions[0])):this.worldPositions[0].z>this.worldPositions[1].z&&(t.set(this.worldPositions[1].x,this.worldPositions[1].y,this.worldPositions[0].z),i=t.distanceTo(this.worldPositions[0]),n=t.distanceTo(this.worldPositions[1])),this.measureResult.horizontalDistance=i,this.measureResult.verticalDistance=n}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),distance:this.measureResult.distance,horizontalDistance:this.measureResult.horizontalDistance,verticalDistance:this.measureResult.verticalDistance,points:this.worldPositions,type:this.type}}}class ViewerGISSpatialArea$1 extends ViewerGISSpatialArea{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex,this.selectElements=[],this.unSelectElements=[]}calculate(e){this.worldPositions[this.updateIndex]=e,this.measureResult=MeasureUtil.calcSpatialArea(this.worldPositions)}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),area:this.measureResult,points:this.worldPositions,type:this.type}}}class ViewerGISProjectedArea$1 extends ViewerGISSpatialArea$1{constructor(e,t){super(e,t)}calculate(e){this.worldPositions[this.updateIndex]=e,this.measureResult=MeasureUtil.calcProjectedArea(this.worldPositions)}getNotationTitle(){return BimfaceLanguage.bf_tip_measure_projected_area}}class ViewerGISSurfaceArea$1 extends ViewerGISSpatialArea$1{constructor(e,t){super(e,t),this.measureSurfaceMesh=null,this.layerType=t.layerType}calculate(e){this.worldPositions[this.updateIndex]=e,this.measureResult=MeasureUtil.calcSurfaceArea(this.worldPositions,this.viewer,this.layerType)}initialize(){this.measureSurfaceMesh||(this.measureSurfaceMesh=new MeasureSurfaceAreaMesh({fillColor:new Glodon.Web.Graphics.Color(255,157,11,.2),color:new Glodon.Web.Graphics.Color(255,157,11,1),width:this.lineWidth})),super.initialize()}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),area:this.measureResult,points:this.worldPositions,type:this.type,layerType:this.layerType}}attachArea(e){this.measureSurfaceMesh.setMeasurePoints(e),this.viewer.render()}getNotationTitle(){return BimfaceLanguage.bf_tip_measure_surface_area}clear(){super.clear(),this.measureSurfaceMesh&&(this.measureSurfaceMesh.dispose(),this.measureSurfaceMesh=null)}}class ViewerGISGroundlineDistance$1 extends ViewerGISGroundlineDistance{constructor(e,t){super(e,t,t.id,{defaultColor:t.defaultColor}),this.worldPositions=t.worldPositions,this.measureResult=t.measureResult,this.updateIndex=t.updateIndex,this.groundInfos=t.groundInfos,this.isFirst=!0,this.lastGroundLineMes={},this.borderColor=t.color||new Glodon.Web.Graphics.Color(255,157,11,1),this.borderWidth=t.width||3}init(){this.updateGroundLine(this.worldPositions)}debounce(e,t=300){let i=null;return function(...n){i&&(clearTimeout(i),i=null),i=setTimeout((()=>{e(...n)}),t)}}calculate(e){this.isFirst&&(this.init(),this.isFirst=!1),this.worldPositions[this.updateIndex]=e;let t=()=>{this.isEnd||this.handle()};this.debounceFun||(this.debounceFun=this.debounce(t)),this.debounceFun(),this.updateGroundLine(this.worldPositions)}handle(){this.groundInfos.length!==this.measureResult.distance.length&&this.groundInfos.pop(),this.updateIndex>0&&(this.groundInfos[this.updateIndex-1]=this.calculateGroundlineDistance(this.worldPositions[this.updateIndex-1],this.worldPositions[this.updateIndex])),this.updateIndex<this.worldPositions.length-1&&(this.groundInfos[this.updateIndex]=this.calculateGroundlineDistance(this.worldPositions[this.updateIndex],this.worldPositions[this.updateIndex+1]));let e=[],t=0;for(let i=0;i<this.groundInfos.length;i++){let n=this.groundInfos[i];e.push(n.length),t+=n.length}this.measureResult.distance=e,this.measureResult.totalDistance=t}end(){this.handle(),this.isEnd=!0}getInfo(){return{id:Glodon.Web.Lang.Utility.UUID.createUUID(),distance:this.measureResult.distance,totalDistance:this.measureResult.totalDistance,points:this.worldPositions,groundInfos:this.groundInfos,type:this.type}}clear(){super.clear(),this.clearGroundLine()}calculateGroundlineDistance(e,t){if(!e||!t)return null;let i=this.viewer,n=new THREE.Vector3(e.x,e.y,e.z),o=new THREE.Vector3(t.x,t.y,t.z);if(n.equals(o))return null;if(this.lastPoint0&&this.lastPoint1&&n.equals(this.lastPoint0)&&o.equals(this.lastPoint1))return this.lastGroundInfo;let s,r=[];r.push(n),r.push(o),s=new THREE.CatmullRomCurve3(r),s.tension=0,s.type="catmullrom";var a=new CLOUD.Raycaster,l=new THREE.Vector3,h=i.getViewer().cameraControl.getIntersectContext(null),d=new CLOUD.IntersectHelper(i.getViewer());a.camera=h.camera,a.viewportSize=h.viewportSize;var c=[];s.getPoints(100).forEach((e=>{l.copy(e),(l=i.worldToScene(e)).y=1e4,a.set(l,new THREE.Vector3(0,-1,0));let t=d.getObjectsByRaycaster(h,a,!0);if(t.length>0){let e;e=i.sceneToWorld(t[0].point),c.push(e)}else c.push(e)})),s=null;let u=new Glodon.Bimface.Plugins.Geometry.SplineCurve(c);return u.projectToGround(!0),this.lastPoint0=n,this.lastPoint1=o,this.lastGroundInfo={length:u.length,midPoint:u.getPointByParameter(.5),endPoint:u.getPointByParameter(1),status:"finished"},this.lastGroundInfo}}class MeasureUpdateManager{constructor(e,t,i){this.domContainer=e,this.viewer=t,this.measure=i,this.drawable=null,this.isDrawed=!1,this.lastMeasureType="",this.currentMeasureType=""}createDrawable(e){this.lastMeasureType=this.measure.type,this.currentMeasureType=e.type;let t="ViewerDrawing"===this.viewer.getViewerType();switch(e.type){case"Distance":this.drawable=t?new DrawingDistance$1(this.viewer,e):new Viewer3dDistance$1(this.viewer,e);break;case"Angle":this.drawable=t?new DrawingAngle$1(this.viewer,e):new Viewer3dAngle$1(this.viewer,e);break;case"PolylineDistance":this.drawable=t?new DrawingPolylineDistance$1(this.viewer,e):new ViewerGISPolylineDistance$1(this.viewer,e);break;case"Area":this.drawable=new DrawingArea(this.viewer,e);break;case"TriangleDistance":this.drawable=new ViewerGISTriangleDistance$1(this.viewer,e);break;case"SpatialArea":this.drawable=new ViewerGISSpatialArea$1(this.viewer,e);break;case"ProjectedArea":this.drawable=new ViewerGISProjectedArea$1(this.viewer,e);break;case"SurfaceArea":this.drawable=new ViewerGISSurfaceArea$1(this.viewer,e);break;case"GroundlineDistance":this.drawable=new ViewerGISGroundlineDistance$1(this.viewer,e);break;default:this.drawable=null}}draw(e,t){if(!this.drawable)return;this.isDrawed||this.measure.setMeasureType(this.currentMeasureType),this.isDrawed=!0;let i="ViewerDrawing"===this.viewer.getViewerType(),n={x:i&&!this.viewer.isFullScreen?e.clientX-t.left:e.clientX,y:i&&!this.viewer.isFullScreen?e.clientY-t.top:e.clientY},o={};if(i){var s=[],r=this.viewer._drawingViewer.snapToPoint(n.x,n.y),a=r.GetViewPortId&&r.GetViewPortId();if(r.GetPoint().length>0&&(s=[r.GetPoint()[0],r.GetPoint()[1],a]),!r.GetID()){let e=this.viewer._drawingViewer.toScreenPoint(r.GetPoint()),t=this.viewer._drawingViewer.toModelWorld(e);s=t,a=t[2]}o=s,this.drawable.calculate(o,a)}else{let e=this.viewer.getViewer().pickToPoint(n,5);e&&e.pickPoint&&(o=this.viewer.sceneToWorld(e.pickPoint),this.drawable.calculate(o))}let l=this.drawable.getInfo();this.measure.getEventManager().fireEvent(Glodon.Bimface.Plugins.Measure.MeasureEvent.MeasureResultUpdating,l),this.drawable.clear(),this.drawable.initialize(!0,i&&r&&r.GetDrawingIndex(),i&&r&&r.GetViewPortId()),this.drawable.select(),this.drawable.attach(this.domContainer)}end(){if(!this.drawable||!this.isDrawed)return;this.drawable.end&&this.drawable.end();let e=this.drawable.getInfo();this.measure.drawableManager.addItem(e),this.drawable.clear(),this.drawable=null,this.isDrawed=!1,this.measure.getEventManager().fireEvent(Glodon.Bimface.Plugins.Measure.MeasureEvent.MeasureResultUpdated,e)}update(){this.drawable&&this.isDrawed&&(this.drawable.clear(),this.drawable.initialize(),this.drawable.select(),this.drawable.attach(this.domContainer))}}class SelectionControl{constructor(e,t,i){this.domContainer=e,this.measureItems=t,this.manage=i,this.measureUpdateManage=new MeasureUpdateManager(e,i.viewer,i.measure),this.selectedItem=null,this.selectionChanged=null,this.hoverChanged=null,this.isEnableSelection=!0,this.mousedownHitItem=null,this.offset=e.getBoundingClientRect(),Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.hookEvents()}hookEvents(){this.domContainer.addEventListener("mousemove",(e=>{if(this.manage.measure.isSelectItem=!1,!this.isEnableSelection)return;let t=new Vector2(e.clientX,e.clientY);if(this.manage.viewer.isFullScreen||(t.x-=this.offset.left,t.y-=this.offset.top),!this.isMoveed&&this.mouseDownPoint&&(Math.abs(this.mouseDownPoint.x-e.clientX)>=1||Math.abs(this.mouseDownPoint.y-e.clientY)>=1)&&(this.isMoveed=!0),this.isMoveed&&this.mouseDownHelperHitItem&&this.mouseDownHelperHitItem.canEdit&&this.mouseDownHelperHitItem.selectChild&&"Point"==this.mouseDownHelperHitItem.selectChild.type){let t={x:e.clientX,y:e.clientY},i=this.manage.viewer.getViewer().pickToPoint(t,5);if(i&&i.pickPoint){let e=this.manage.viewer.sceneToWorld(i.pickPoint);this.mouseDownHelperHitItem.update(e)}return void(this.isMouseDownHelperHitItemMove=!0)}if(!this.isMouseDownMove&&this.mousedownPoint&&Math.abs(this.mousedownPoint.x-t.x)>=1&&Math.abs(this.mousedownPoint.y-t.y)>=1&&(this.isMouseDownMove=!0,this.mousedownPoint=null),this.isMouseDownMove&&(this.selectPointItemId&&(this.manage.removeItemById(this.selectPointItemId),this.selectPointItemId=null),this.measureUpdateManage.draw(e,this.offset)),this.isMouseDown)return;let i=this.hitTest(t);if("Viewer3D"===this.manage.viewer.viewerType){i=this.manage.measure.measureHelper.hitTest(new Vector2(e.clientX,e.clientY),new Vector2(t.x,t.y))||i}this.hoverChanged(i),i?(this.domContainer.style.cursor="default",e.preventDefault(),e.stopPropagation()):this.domContainer.style.cursor=""}),!1),this.domContainer.addEventListener("mousedown",(e=>{if(this.mousedownHitItem=null,this.selectPointItemId=null,this.mousedownPoint=null,this.isMouseDownMove=!1,this.isMouseDown=!0,this.mouseDownHelperHitItem=null,this.isMouseDownHelperHitItemMove=!1,this.isMoveed=!1,this.mouseDownPoint={x:e.clientX,y:e.clientY},!this.isEnableSelection)return;let t=new Vector2(e.clientX,e.clientY);if(this.manage.viewer.isFullScreen||(t.x-=this.offset.left,t.y-=this.offset.top),"Viewer3D"===this.manage.viewer.viewerType){let i=this.manage.measure.measureHelper.hitTestPoint(new Vector2(e.clientX,e.clientY),new Vector2(t.x,t.y));i&&(this.mouseDownHelperHitItem=i);let n=this.manage.measure.measureHelper.hitTest(new Vector2(e.clientX,e.clientY),new Vector2(t.x,t.y));if(n)return this.manage.measure.isSelectItem=!0,n.getIsSelected()?(this.selectionChanged(null),this.setSelectedItem(null),n.unselect()):(this.selectionChanged(n),this.setSelectedItem(n),n.select()),e.preventDefault(),void e.stopPropagation()}let i=this.hitTest(t);if(this.mousedownHitItem=i,i){this.manage.measure.isSelectItem=!0;for(let e=0;e<i.hitTestSegments.length;e++)if(Math.abs(i.hitTestSegments[e].x-t.x)<=3&&Math.abs(i.hitTestSegments[e].y-t.y)<=3){let n={...i,...i.measureParams,updateIndex:e};this.measureUpdateManage.createDrawable(n),this.measureUpdateManage.drawable&&(this.selectPointItemId=i.id,this.mousedownPoint=t);break}i.getIsSelected()?(this.selectionChanged(null),this.setSelectedItem(null),i.unselect()):(this.selectionChanged(i),this.setSelectedItem(i),i.select()),e.preventDefault(),e.stopPropagation()}}),!1),this.domContainer.addEventListener("mouseup",(e=>{this.manage.measure.isSelectItem=!1,this.isMoveed&&this.mouseDownHelperHitItem&&this.mouseDownHelperHitItem.canEdit&&this.mouseDownHelperHitItem.selectChild&&"Point"==this.mouseDownHelperHitItem.selectChild.type&&this.isMouseDownHelperHitItemMove&&(this.mouseDownHelperHitItem.endUpdate(this.manage.mapMeasureInfo),this.setSelectedItem(this.mouseDownHelperHitItem),this.mouseDownHelperHitItem.select(),this.mouseDownHelperHitItem=null),this.measureUpdateManage.end(),this.selectPointItemId=null,this.mousedownPoint=null,this.isMouseDownMove=!1,this.isMouseDown=!1,this.mouseDownHelperHitItem=null,this.isMouseDownHelperHitItemMove=!1,this.isMoveed=!1,this.mouseDownPoint=null,this.mousedownHitItem&&(e.preventDefault(),e.stopPropagation())}),!1),this.domContainer.addEventListener("dblclick",(()=>{event.preventDefault(),event.stopPropagation()}),!1)}hitTest(e){for(var t=this.measureItems.length-1;t>=0;t--){let i=this.measureItems[t];if(i.getNotation().hitTest(e))return i}for(t=this.measureItems.length-1;t>=0;t--){let i=this.measureItems[t];if(i.hitTest(e))return i}return null}setSelectedItem(e){this.selectedItem&&(this.selectedItem.actionWhenUnselected(),this.selectedItem.unselect()),this.selectedItem=e,e&&e.actionWhenSelected()}getSelectedItem(){return this.selectedItem}hasSelected(){return null!==this.selectedItem}setIsEnableSelection(e){this.isEnableSelection=e}}class DropShadow{constructor(e){this.filterId=e.filterId,this.filterUnits=e.filterUnits,this.stdDeviation=e.stdDeviation,this.feOffset1=e.feOffset1,this.feOffset2=e.feOffset2,this.shadowOpacity=e.opacity,this.initialize()}initialize(){let e=document.createElementNS(this.xmlns,"defs"),t=document.createElementNS(this.xmlns,"filter");t.setAttribute("id",this.filterId),t.setAttribute("filterUnits",this.filterUnits);let i=document.createElementNS(this.xmlns,"feGaussianBlur");i.setAttribute("in","SourceAlpha"),i.setAttribute("stdDeviation",this.stdDeviation),t.appendChild(i);let n=document.createElementNS(this.xmlns,"feOffset");n.setAttribute("dx",this.feOffset1.dx),n.setAttribute("dy",this.feOffset1.dy),n.setAttribute("result","offsetblur");let o=document.createElementNS(this.xmlns,"feOffset");o.setAttribute("dx",this.feOffset2.dx),o.setAttribute("dy",this.feOffset2.dy),o.setAttribute("result","offsetblur"),t.appendChild(n),t.appendChild(o);let s=document.createElementNS(this.xmlns,"feComponentTransfer"),r=document.createElementNS(this.xmlns,"feFuncA");r.setAttribute("type","linear"),r.setAttribute("slope",this.shadowOpacity),s.appendChild(r),t.appendChild(s);let a=document.createElementNS(this.xmlns,"feMerge"),l=document.createElementNS(this.xmlns,"feMergeNode"),h=document.createElementNS(this.xmlns,"feMergeNode");h.setAttribute("in","SourceGraphic");let d=document.createElementNS(this.xmlns,"feMergeNode");d.setAttribute("in","SourceGraphic"),a.appendChild(l),a.appendChild(h),a.appendChild(d),t.appendChild(a),e.appendChild(t),this.dropShadowDefs=e}attach(e){this.dropShadowDefs||this.initialize(),e.appendChild(this.dropShadowDefs);let t=e.innerHTML;e.removeChild(this.dropShadowDefs),e.innerHTML=t}getFilterUrl(){return"url(#"+this.filterId+")"}}let DomNS$1=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),hoverColor=new Glodon$1.Web.Graphics.Color(17,218,183,.2),strokeColor=new Glodon$1.Web.Graphics.Color(17,218,183,1);class MeasrueControl{constructor(e){this.object3D=new THREE.Object3D,this.children=[],this.id=e&&e.id||Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.measure=e.measure,this.nextMeasurePoint=null,this.measurePoints=[],this.maxPointsNum=2,this.measureResult=null,this.measureParams={precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit},this.measureItemConfig=e,this.linewidth="number"==typeof e.width?e.width>10||e.width<1?3:e.width:3,this.viewer=e.viewer,this.selectChild=null,this.isEndDrawing=!1,this._config=e,this.helper=e.helper,this.hoveredObject=null,this.selectedObject=null,this.object3D.visible=!0,this.isSelected=!0,this.helperEvents={},this.color=e.color instanceof Glodon$1.Web.Graphics.Color?"#"+e.color.getHEX():"#ff9d0b",this.svgContainer=this.helper.svgContainer,this.notationGroup=[],this.notation=new MeasureViewer3dNotation(e.measureType);let t=DomNS$1.createNS("circle","bf-measure-handle");t.setAttribute("stroke-width",0),t.setAttribute("r",6),t.setAttribute("fill",hoverColor.getRGB()),t.style.fill=hoverColor.getRGB();let i=DomNS$1.createNS("line","bf-measure-line");i.style.strokeWidth=2,i.style.stroke=hoverColor.getRGB();let n=DomNS$1.createNS("polygon","bf-measure-rect");n.setAttribute("fill",hoverColor.getRGBA()),n.setAttribute("stroke",hoverColor.getRGB()),n.setAttribute("stroke-width",1);var o=DomNS$1.createNS("path","bf-measure-foot");o.setAttribute("fill","none"),o.setAttribute("stroke",hoverColor.getRGB()),o.setAttribute("stroke-width",2);const s=DomNS$1.createNS("rect","bf-snap-handle");s.setAttribute("width",14),s.setAttribute("height",14),s.setAttribute("fill","none"),s.setAttribute("stroke",strokeColor.getRGB()),s.setAttribute("stroke-width",2);const r=DomNS$1.createNS("path","bf-snap-handle");r.setAttribute("d","M 7 0 L 16 16 L 0 16 L 7 0"),r.setAttribute("fill","none"),r.setAttribute("stroke",strokeColor.getRGB()),r.setAttribute("stroke-width",2);const a=DomNS$1.createNS("line","bf-snap-handle");a.setAttribute("x1",0),a.setAttribute("y1",0),a.setAttribute("x2",14),a.setAttribute("y2",14),a.setAttribute("stroke",hoverColor.getRGB()),a.setAttribute("stroke-width",2);const l=DomNS$1.createNS("line","bf-snap-handle");l.setAttribute("x1",14),l.setAttribute("y1",0),l.setAttribute("x2",0),l.setAttribute("y2",14),l.setAttribute("stroke",hoverColor.getRGB()),l.setAttribute("stroke-width",2),this.hoverFoot=o,this.hoverPoint=t,this.hoverLine=i,this.hoverPanel=n,this.hoverEndPoint=s,this.hoverMidPoint=r,this.hoverIntersectionPointA=a,this.hoverIntersectionPointB=l,this.hoverPanelSize={width:20,height:20},this.isReserverd=!1,this.hoverPositionUpdated=!1}init(){}getConfig(){return this._config}getCloudViewer(){return this.helper.viewer}draw(){}endDraw(){}update(){}endUpdate(){}select(){this.isSelected=!0}unselect(){this.isSelected=!1}getIsSelected(){return this.isSelected}actionWhenSelected(){}actionWhenUnselected(){}updateResult(){}attachNotation(e){if(0===e.length)return;let t=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},this.getMeasureResult(),this.id);for(const e of t)this.notationGroup.push(e);this.attach(this.notationGroup)}attach(e){if(0!=e.length)for(const t of e)this.svgContainer.appendChild(t)}detach(e){if(0!=e.length)for(const i of e){var t=i.parentNode;t&&t.removeChild(i)}}updateNotationPositionFun(e,t){let i=this.viewer.worldToScene({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,z:(t[0].z+t[1].z)/2});i=new THREE.Vector3(i.x,i.y,i.z);let n,o=i.applyMatrix4(this.viewer.getViewer().camera.matrixWorldInverse.clone()).applyMatrix4(this.viewer.getViewer().camera.projectionMatrix);n=Math.abs(o.x)>1||Math.abs(o.y)>1||Math.abs(o.z)>1?{x:-100,y:-100}:this.viewer.worldToClient({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,z:(t[0].z+t[1].z)/2});let s=this.notation.calcAnnotationStyle(this.getMeasureResult(),n);e[0].setAttribute("x",s.offsetRect.x),e[0].setAttribute("y",s.offsetRect.y),e[1].setAttribute("x",s.offsetRect.x-2),e[1].setAttribute("y",s.offsetRect.y-2),e[2].setAttribute("x",s.offsetText.x),e[2].setAttribute("y",s.offsetText.y);let r=new Vector2(s.offsetRect.x,s.offsetRect.y+this.notation.annotationStyle.height/2),a=new Vector2(s.offsetRect.x+s.width,r.y);this.notation.notationSegmentRects.push({start:r,end:a})}hitTest(e,t){let i=null;return this.children.some((n=>{const o=n.hitTest(e,t);return o&&(i=n),o})),this.hoveredObject=i,this.hoveredObject?!!this.hoveredObject:this.notation.hitTest(t)}hitTestPoint(e,t){let i=null;return this.children.some((n=>{const o="Point"==n.type&&n.hitTest(e,t);return o&&(i=n),o})),this.selectChild=i,!!this.selectChild}add(e){this.children.push(e),this.object3D.add(e.object3D)}remove(e){for(let t=0;t<this.children.length;t++)if(this.children[t]===e){this.object3D.remove(e.object3D),this.children.splice(t,1);break}}addHelperEvent(e,t){this.helperEvents[e]=t,this.helper.group.addEventListener(e,t)}getLinearColor(e){const t=new THREE.Color(e),i=e=>{let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t},n=i(t.r),o=i(t.g),s=i(t.b);new THREE.Color(n,o,s);return t}destroy(){for(this._destroyed=!0,Object.entries(this.helperEvents).forEach((([e,t])=>{this.helper.group.removeEventListener(e,t)}));this.children.length>0;)this.children[0].destroy(),this.object3D.remove(this.children[0].object3D),this.children.splice(0,1);this.helper.viewer.render(),this.removeAllSvg()}removeAllSvg(){this.detach(this.notationGroup),this.notationGroup=[]}stretchOnDirection(e,t,i){let n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]}drawCaptureItem(e){let t=this.hoverPoint,i=this.hoverLine,n=this.hoverPanel,o=this.hoverEndPoint,s=this.hoverMidPoint,r=this.hoverIntersectionPointA,a=this.hoverIntersectionPointB,l=e.hoverPosition&&e.hoverPosition.x,h=e.hoverPosition&&e.hoverPosition.y,d=this.hoverPanelSize;switch(e.hoverObjectType){case"Point":t.setAttribute("cx",l),t.setAttribute("cy",h),e.svg.appendChild(t);break;case"EndPoint":o.setAttribute("x",l-7),o.setAttribute("y",h-7),e.svg.appendChild(o);break;case"MidPoint":s.setAttribute("d",`M ${l} ${h-7} L ${l+8} ${h+8} L ${l-8} ${h+8} L ${l} ${h-7}`),e.svg.appendChild(s);break;case"IntersectionPoint":r.setAttribute("x1",l-7),r.setAttribute("y1",h-7),r.setAttribute("x2",l+7),r.setAttribute("y2",h+7),e.svg.appendChild(r),a.setAttribute("x1",l+7),a.setAttribute("y1",h-7),a.setAttribute("x2",l-7),a.setAttribute("y2",h+7),e.svg.appendChild(a);break;case"Line":if(e.footPoint){let t=e.footPoint.x,i=e.footPoint.y;this.hoverFoot.setAttribute("d",`M ${t},${i-14} v 14 h 14 M ${t},${i-9} h 9 v 9`),e.svg.appendChild(this.hoverFoot)}else i.setAttribute("x1",e.lineStartPoint.x),i.setAttribute("y1",e.lineStartPoint.y),i.setAttribute("x2",e.lineEndPoint.x),i.setAttribute("y2",e.lineEndPoint.y),e.svg.appendChild(i);break;case"Panel":let c=e.clientPts,u=c[0].distanceTo(c[1]),p=c[0].distanceTo(c[3]),g=u/d.width,m=p/d.height;if(1!=g){let e=this.stretchOnDirection(c[0],c[1],d.width),t=this.stretchOnDirection(c[2],c[3],d.width);c=e.concat(t)}if(1!=m){let e=this.stretchOnDirection(c[0],c[3],d.height),t=this.stretchOnDirection(c[1],c[2],d.height);c=[e[0],t[0],t[1],e[1]]}let f="";for(let e=0;e<c.length;e++)f+=c[e].x+",",f+=c[e].y+" ";n.setAttribute("points",f),e.svg.appendChild(n)}}reset(){if(this.measurePoints=[],this.nextMeasurePoint=null,this.measureResult=null,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}}addPoint(e){if(this.measurePoints.length==this.maxPointsNum)this.reset();else if(this.measurePoints.length>0){let t=this.measurePoints.length,i=this.measurePoints[t-1];if(e.x===i.x&&e.y===i.y&&e.z===i.z)return}this.measurePoints.push(e),this.setIsReserverd(!1)}redo(){this.measurePoints.length>0&&this.measurePoints.length<this.maxPointsNum?this.measurePoints.pop():this.measurePoints=[]}getId(){return this.id}getType(){return this.type}getPoints(){return this.measurePoints}setMeasureParams(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit}setIsReserverd(e){this.isReserverd=e}getIsReserverd(){return this.isReserverd}getOrthogonalityCameraScaleValue(){return 1/(this.getCloudViewer().camera.zoom/this.getCloudViewer().camera.position.clone().sub(this.getCloudViewer().camera.target.clone()).length())}}class BaseItem{constructor(e){this.object3D=new THREE.Object3D,this._config=e,this.name=e.name,this.viewer=e.viewer,this._cloudViewer=this.viewer.getViewer(),this.control=e.control,this.init&&this.init()}init(){}getConfig(){return this._config}getViewer(){return this.viewer}getCloudViewer(){return this._cloudViewer}updateMaterialResolution(){}hitTest(){return!1}getLinearColor(e){const t=new THREE.Color(e),i=e=>{let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t},n=i(t.r),o=i(t.g),s=i(t.b);new THREE.Color(n,o,s);return t}getOrthogonalityCameraScaleValue(){return 1/(this.getCloudViewer().camera.zoom/this.getCloudViewer().camera.position.clone().sub(this.getCloudViewer().camera.target.clone()).length())}destroy(){this.object3D.children.forEach((e=>{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&e.material.dispose&&e.material.dispose()}))}}class Point extends BaseItem{constructor(e){super(e),this.type="Point",this.isSelected=!1}init(){const{point:e,showText:t,noBorder:i}=this.getConfig();this.bgColor=this.getConfig().bgColor||"#ff9d0b",this.borderColor=this.getConfig().borderColor||"#FFFFFF",this.noBorder=i,this.object3D.position.set(e.x,e.y,e.z),this.showText=0!=t||t,this.object3D.updateMatrixWorld(),this.addPoint(),this.addRigidBody(),super.init()}update(e){this.object3D.position.set(e.x,e.y,e.z),this.object3D.updateMatrixWorld()}addPoint(){this.updateScaleFactor(),this.defaultTexture=this.getTexture();const e=new CLOUD.SpriteShaderMaterial({map:this.defaultTexture,depthTest:!1}),t=this.point=new THREE.Sprite(e);t.renderOrder=CLOUD.EnumRenderOrder.Effect+200,this.object3D.add(t)}getTexture(e){const t=document.createElement("canvas");t.width=16,t.height=16;const i=t.getContext("2d");this.noBorder||(i.beginPath(),i.arc(8,8,8,0,2*Math.PI),i.fillStyle="#"+this.getLinearColor(this.borderColor).getHexString(),i.fill()),i.beginPath(),i.arc(8,8,5.5,0,2*Math.PI),i.fillStyle="#"+this.getLinearColor(this.bgColor).getHexString(),i.fill();return new THREE.CanvasTexture(t)}addRigidBody(){const e=new THREE.BoxGeometry(1,1,1),t=new THREE.MeshBasicMaterial,i=this.rigidBody=new THREE.Mesh(e,t);i.visible=!1,this.object3D.add(i)}updateScaleFactor(e,t){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var i=this.object3D.position,n=e.clone().sub(i.clone()).length(),o=t.angleTo(this.object3D.position.clone().sub(e.clone()));n=Math.sin(Math.PI/2-o)*n,this.getCloudViewer().camera.isPerspective||(n=this.getOrthogonalityCameraScaleValue());var s=10*n/this.getCloudViewer().domElement.offsetHeight;this.object3D.scale.set(s,s,s),this.object3D.updateMatrixWorld()}hitTest(e){const t=[];return this.rigidBody.raycast(e,t),t.length>0}}class Line extends BaseItem{constructor(e){super(e)}init(){const{points:e,color:t,dashSize:i,gapSize:n}=this.getConfig();this.isNotHitTest=this.getConfig().isNotHitTest||!1,this.points=e,this.linewidth=this.getConfig().linewidth||3,this.dashSize=i,this.gapSize=n;const o=[];e.forEach((e=>o.push(e.x,e.y,e.z))),this.addLine(o,{color:this.getLinearColor(t)}),super.init()}addLine(e,t){const i=new THREE.LineGeometry;if(i.setPositions(e),!this.lineMaterial){let e;!0===this.getConfig().dashed?(e=new THREE.LineMaterial({linewidth:this.linewidth,dashed:!0,dashSize:this.dashSize||1,gapSize:this.gapSize||1,dashScale:.1,depthTest:!1,...t}),e.defines.USE_DASH=""):e=new THREE.LineMaterial({linewidth:this.linewidth,dashed:!1,depthTest:!1,...t}),e.resolution.set(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.lineMaterial=e}const n=new THREE.Line2(i,this.lineMaterial);n.computeLineDistances(),n.renderOrder=CLOUD.EnumRenderOrder.Effect+100,this.object3D.add(n),this.line=n}update(e){this.points=e,this.object3D.remove(this.line),this.line.geometry.dispose();const t=[];e.forEach((e=>t.push(e.x,e.y,e.z))),this.addLine(t),this.object3D.updateMatrixWorld()}updateMaterialResolution(){this.line.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.object3D.updateMatrixWorld()}updateScaleFactor(e,t){if(!0===this.getConfig().dashed){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var i=this.points[0].clone().add(this.points[1]).multiplyScalar(.5),n=e.clone().sub(i.clone()).length(),o=t.angleTo(i.clone().sub(e.clone()));n=Math.sin(Math.PI/2-o)*n,this.getCloudViewer().camera.isPerspective||(n=this.getOrthogonalityCameraScaleValue());var s=n/this.getCloudViewer().domElement.offsetHeight*.8;s<.2?s*=1.8:s<.5?s*=1.4:s<1&&(s*=1.2),this.line.material.dashSize=s,this.line.material.gapSize=s,this.line.computeLineDistances()}}hitTest(e,t){if(this.isNotHitTest)return!1;if(2!=this.points.length)return!1;let i=this.viewer.worldToClient(this.viewer.sceneToWorld(this.points[0])),n=this.viewer.worldToClient(this.viewer.sceneToWorld(this.points[1]));var o=new Vector2(i.x,i.y),s=new Vector2(n.x,n.y);return MeasureUtil.distanceToSegment(t,o,s)<=10}}class LinePoint extends BaseItem{constructor(e){super(e)}init(){const{point:e,color:t}=this.getConfig();this.point=e,this.anotherPoint=this.getConfig().anotherPoint;this.object3D.position.set(e.x,e.y,e.z),this.addLine([10,0,0,-10,0,0],{color:this.getLinearColor(t)}),super.init(),this.updateScaleFactor()}addLine(e,t){const i=new THREE.LineGeometry;i.setPositions(e);let n=new THREE.LineMaterial({linewidth:2,dashed:!1,depthTest:!1,...t});n.resolution.set(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.lineMaterial=n;const o=new THREE.Line2(i,this.lineMaterial);o.computeLineDistances(),o.renderOrder=CLOUD.EnumRenderOrder.Effect+100,this.object3D.add(o),this.line=o}update(e){this.point=e,this.object3D.position.set(e.x,e.y,e.z),this.object3D.updateMatrixWorld()}updateAnotherPoint(e){this.anotherPoint=e,this.updateDirection(),this.object3D.updateMatrixWorld()}updateMaterialResolution(){this.line.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.object3D.updateMatrixWorld()}updateScaleFactor(e,t,i){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var n=this.object3D.position,o=e.clone().sub(n.clone()).length(),s=t.angleTo(this.object3D.position.clone().sub(e.clone()));o=Math.sin(Math.PI/2-s)*o,this.getCloudViewer().camera.isPerspective||(o=this.getOrthogonalityCameraScaleValue());var r=.4*o/this.getCloudViewer().domElement.offsetHeight;if(this.object3D.scale.set(r,r,r),this.updateDirection(),i){let e=this.point.clone().sub(this.anotherPoint.clone()).normalize();var a=this.point.clone().add(e.clone().multiplyScalar(r*i));this.object3D.position.set(a.x,a.y,a.z)}this.object3D.updateMatrixWorld()}updateDirection(){var e=this.viewer.getDomElement().getBoundingClientRect(),t=this.viewer.worldToClient(this.viewer.sceneToWorld(this.anotherPoint)),i=this.getCloudViewer().cameraControl.getRaycaster(t.x+e.left,t.y+e.top);let n=i.ray.origin.clone(),o=i.ray.direction.clone(),s=(new THREE.Plane).setFromNormalAndCoplanarPoint(o,this.point),r=new THREE.Vector3,a=s.projectPoint(n,r),l=this.point.clone().sub(a).normalize().clone().normalize().cross(o.clone().normalize()).normalize();var h=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),l);this.line.quaternion.set(h.x,h.y,h.z,h.w)}hitTest(e){return!1}}class MeasureDistanceControl extends MeasrueControl{constructor(e){super(e),this.name="distance",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Distance,this.maxPointsNum=2,this.measurePoints=[],this.points=[],this.auxLines=[],this.auxLinesNotationGroup=[],this.selectedArr=[],this.canEdit=!0,this.firstUpdate=!0,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}stretchOnDirection(e,t,i){var n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]}initByData(e){this.id=e.id,this.setData(e),this.point1=new Point({control:this,name:"point1",viewer:this.viewer,point:this.viewer.worldToScene(this.measurePoints[0]),bgColor:this.color}),this.points.push(this.point1),this.add(this.point1),this.point2=new Point({control:this,name:"point2",viewer:this.viewer,point:this.viewer.worldToScene(this.measurePoints[1]),bgColor:this.color}),this.points.push(this.point2),this.add(this.point2),this.line=new Line({control:this,name:"line",viewer:this.viewer,points:[this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1])],color:this.color,linewidth:this.linewidth}),this.add(this.line),this.endDraw(),this.unselect()}draw(e){if(!this.getIsReserverd())switch(this._svg=e.svg,this.drawCaptureItem(e),e.clientPoints.length){case 2:let t=new Point({control:this,name:"point2",viewer:this.viewer,point:this.viewer.worldToScene(e.worldPosition),bgColor:this.color});this.add(t),this.point2=t,this.points.push(t),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render();break;case 1:if(!this.point1){let t=new Point({control:this,name:"point1",viewer:this.viewer,point:this.viewer.worldToScene(e.worldPosition),bgColor:this.color});this.point1=t,this.points.push(t),this.add(t)}this.line?this.line.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]):(this.line=new Line({control:this,name:"line",viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth}),this.add(this.line)),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}}endDraw(){this.isEndDrawing=!0,this.addAuxLines(),this.measureParams.enableAuxiliaryValue&&this.calAuxLinesNotation();let e=this.viewer.worldToClient({x:(this.measurePoints[0].x+this.measurePoints[1].x)/2,y:(this.measurePoints[0].y+this.measurePoints[1].y)/2,z:(this.measurePoints[0].z+this.measurePoints[1].z)/2});this.attachNotation([e,e]),this.line.update([this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1])]),this.linePoint1=new LinePoint({control:this,name:"linePoint1",viewer:this.viewer,point:this.viewer.worldToScene(this.measurePoints[0]),anotherPoint:this.viewer.worldToScene(this.measurePoints[1]),color:this.color}),this.add(this.linePoint1),this.linePoint2=new LinePoint({control:this,name:"linePoint2",viewer:this.viewer,point:this.viewer.worldToScene(this.measurePoints[1]),anotherPoint:this.viewer.worldToScene(this.measurePoints[0]),color:this.color}),this.add(this.linePoint2)}update(e){this.firstUpdate&&(this.auxLinesNotationGroup.length>0&&this.auxLinesNotationGroup.map((e=>this.detach(e))),this.auxLinesNotationGroup=[],this.select(),this.firstUpdate=!1),"point1"==this.selectChild.name?this.measurePoints[0]=e:this.measurePoints[1]=e,this.selectChild.update(this.viewer.worldToScene(e)),this.line.update([this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1])]),this.updateAuxLines(),this.calculate(),this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let t=this.viewer.worldToClient({x:(this.measurePoints[0].x+this.measurePoints[1].x)/2,y:(this.measurePoints[0].y+this.measurePoints[1].y)/2,z:(this.measurePoints[0].z+this.measurePoints[1].z)/2});this.attachNotation([t,t]),this.notation.select(),this.linePoint1.update(this.viewer.worldToScene(this.measurePoints[0])),this.linePoint2.update(this.viewer.worldToScene(this.measurePoints[1])),this.updateScaleFactor(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render(),this.measure.getEventManager().fireEvent(Glodon.Bimface.Plugins.Measure.MeasureEvent.MeasureResultUpdating,this.getInfo())}endUpdate(){this.firstUpdate=!0,this.measureParams.enableAuxiliaryValue&&(this.auxLinesNotationGroup.length>0&&this.auxLinesNotationGroup.map((e=>this.detach(e))),this.auxLinesNotationGroup=[],this.calAuxLinesNotation()),this.linePoint1.updateAnotherPoint(this.viewer.worldToScene(this.measurePoints[1])),this.linePoint2.updateAnotherPoint(this.viewer.worldToScene(this.measurePoints[0])),this.info.distance=this.measureResult,this.info.distanceX=this.distanceX,this.info.distanceY=this.distanceY,this.info.distanceZ=this.distanceZ,this.info.points=this.measurePoints}updateResult(){this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let e=this.viewer.worldToClient({x:(this.measurePoints[0].x+this.measurePoints[1].x)/2,y:(this.measurePoints[0].y+this.measurePoints[1].y)/2,z:(this.measurePoints[0].z+this.measurePoints[1].z)/2});this.attachNotation([e,e]),this.auxLinesNotationGroup.length>0&&this.auxLinesNotationGroup.map((e=>this.detach(e))),this.auxLinesNotationGroup=[],this.measureParams.enableAuxiliaryValue&&this.calAuxLinesNotation(),this.isSelected?this.select():this.unselect(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}getInfo(){return{id:this.id,distance:this.measureResult,distanceX:this.distanceX,distanceY:this.distanceY,distanceZ:this.distanceZ,points:this.measurePoints,type:this.type}}calculate(){this.distanceX=Math.abs(this.measurePoints[1].x-this.measurePoints[0].x),this.distanceY=Math.abs(this.measurePoints[1].y-this.measurePoints[0].y),this.distanceZ=Math.abs(this.measurePoints[1].z-this.measurePoints[0].z),this.auxLinesResult=[this.distanceX,this.distanceY,this.distanceZ],this.measureResult=Math.sqrt(Math.pow(this.distanceX,2)+Math.pow(this.distanceY,2)+Math.pow(this.distanceZ,2))}addAuxLines(){let e=["#CC021B","#7CCF21","#4A90E2"];for(var t={x:this.measurePoints[1].x,y:this.measurePoints[0].y,z:this.measurePoints[0].z},i={x:this.measurePoints[1].x,y:this.measurePoints[1].y,z:this.measurePoints[0].z},n=[this.measurePoints[0],t,i,this.measurePoints[1]],o=0;o<n.length-1;o++){let t=new Line({control:this,name:"Line",viewer:this.viewer,isNotHitTest:!0,points:[this.viewer.worldToScene(n[o]),this.viewer.worldToScene(n[o+1])],color:e[o],linewidth:this.linewidth,dashed:!0});t.object3D.visible=!1,this.auxLines.push(t),this.selectedArr.push(t),this.add(t)}}updateAuxLines(){for(var e={x:this.measurePoints[1].x,y:this.measurePoints[0].y,z:this.measurePoints[0].z},t={x:this.measurePoints[1].x,y:this.measurePoints[1].y,z:this.measurePoints[0].z},i=[this.measurePoints[0],e,t,this.measurePoints[1]],n=0;n<i.length-1;n++)this.auxLines[n].update([this.viewer.worldToScene(i[n]),this.viewer.worldToScene(i[n+1])])}calAuxLinesNotation(){var e={x:this.measurePoints[1].x,y:this.measurePoints[0].y,z:this.measurePoints[0].z},t={x:this.measurePoints[1].x,y:this.measurePoints[1].y,z:this.measurePoints[0].z},i=[this.measurePoints[0],e,t,this.measurePoints[1]];if(i&&i.length&&4===i.length){let e,t=["#E22532","#6CC91A","#399DFF"];for(let n=0,o=i.length-1;n<o;n++){let o={x:(i[n].x+i[n+1].x)/2,y:(i[n].y+i[n+1].y)/2,z:(i[n].z+i[n+1].z)/2},s=this.viewer.worldToClient(o);e=this.notation.drawAnnotation({x:s.x,y:s.y},this.getMeasureResult(this.auxLinesResult[n])+"",this.id,t[n]),this.auxLinesNotationGroup.push(e),this.attach(e);for(const t of e)this.notation.notationSelected.push(t)}}}setData(e){this.info=e,this.id=e.id,this.measureResult=e.distance,this.measurePoints=e.points,this.worldPositions=e.points,this.auxLinesResult=[e.distanceX,e.distanceY,e.distanceZ],this.setMeasureParams({precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit,enableAuxiliaryValue:e.enableAuxiliaryValue||!1}),this.calculate()}setMeasureParams(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit,this.measureParams.enableAuxiliaryValue=e.enableAuxiliaryValue}getMeasureResult(e){let t=this.measureParams.unit,i=e||this.measureResult.toString(),n=MeasureResultFormat.formatDistance(i,this.measureParams);return n+=MeasureResultFormat.getPostFix(t,!1),n.split(",").join("")}select(){super.select(),this.selectedArr.map((e=>{e.object3D.visible=!0})),this.notation.select(),this.point1.object3D.visible=!0,this.point2.object3D.visible=!0,this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}unselect(){super.unselect(),this.selectedArr.map((e=>{e.object3D.visible=!1})),this.notation.unselect(),this.point1.object3D.visible=!1,this.point2.object3D.visible=!1,this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize()),this.points.forEach((e=>e.updateScaleFactor(t,i))),this.updateNotationPosition(),this.linePoint1&&this.linePoint1.updateScaleFactor(t,i,this.linewidth),this.linePoint2&&this.linePoint2.updateScaleFactor(t,i,this.linewidth),this.auxLines.forEach((e=>e.updateScaleFactor(t,i)))}updateNotationPosition(){if(this.isEndDrawing&&(this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,this.measurePoints),this.auxLinesNotationGroup.length>0)){var e={x:this.measurePoints[1].x,y:this.measurePoints[0].y,z:this.measurePoints[0].z},t={x:this.measurePoints[1].x,y:this.measurePoints[1].y,z:this.measurePoints[0].z},i=[this.measurePoints[0],e,t,this.measurePoints[1]];for(let e=0,t=i.length-1;e<t;e++)this.updateNotationPositionFun(this.auxLinesNotationGroup[e],[i[e],i[e+1]])}}removeAllSvg(){super.removeAllSvg(),this.auxLinesNotationGroup.length>0&&(this.auxLinesNotationGroup.map((e=>this.detach(e))),this.auxLinesNotationGroup=[])}reset(){this.children=[],this.measurePoints=[],this.points=[],this.auxLines=[],this.notationGroup=[],this.auxLinesNotationGroup=[],this.selectedArr=[],this.line=null,this.point1=null,this.point2=null,this.text=null,this.textUnselect=null,this.linePoint1=null,this.linePoint2=null,this.object3D.clear()}redo(){1==this.measurePoints.length&&(this.remove(this.point1),this.remove(this.line),this.point1=null,this.line=null,this.points.pop()),super.redo()}}class LineTriangle extends BaseItem{constructor(e){super(e)}init(){const{point:e,color:t,direction:i}=this.getConfig();this.dir=i,this.point=e;this.line1=this.getLine([0,0,0,3,0,-3],{color:this.getLinearColor(t)}),this.object3D.add(this.line1);this.line2=this.getLine([0,0,0,-3,0,-3],{color:this.getLinearColor(t)}),this.object3D.add(this.line2),this.addRigidBody(),this.object3D.position.set(e.x,e.y,e.z),super.init(),this.updateScaleFactor()}getLine(e,t){const i=new THREE.LineGeometry;i.setPositions(e);let n=new THREE.LineMaterial({linewidth:2,dashed:!1,depthTest:!1,...t});n.resolution.set(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.lineMaterial=n;const o=new THREE.Line2(i,this.lineMaterial);return o.computeLineDistances(),o.renderOrder=CLOUD.EnumRenderOrder.Effect+100,o}addRigidBody(){const e=new THREE.BoxGeometry(8,8,8),t=new THREE.MeshBasicMaterial,i=this.rigidBody=new THREE.Mesh(e,t);i.visible=!1,this.object3D.add(i)}updateScaleFactor(e,t){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var i=this.object3D.position,n=e.clone().sub(i.clone()).length(),o=t.angleTo(this.object3D.position.clone().sub(e.clone()));n=Math.sin(Math.PI/2-o)*n,this.getCloudViewer().camera.isPerspective||(n=this.getOrthogonalityCameraScaleValue());var s=1.6*n/this.getCloudViewer().domElement.offsetHeight;this.object3D.scale.set(s,s,s),this.updateDirection(),this.object3D.updateMatrixWorld()}updateDirection(){let e=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();this.directionQuaternion=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,-1),this.dir.clone().normalize());const t=this.control.object3D.quaternion.clone().invert(),i=new THREE.Vector3(0,1,0).applyQuaternion(this.directionQuaternion),n=new THREE.Plane(new THREE.Vector3(...Object.values(this.dir)).normalize()),o=new THREE.Vector3;n.projectPoint(e.clone().applyQuaternion(t),o);const s=(new THREE.Quaternion).setFromUnitVectors(i,o.normalize()).multiply(this.directionQuaternion.clone());this.object3D.quaternion.set(s.x,s.y,s.z,s.w),this.object3D.updateMatrixWorld(!0)}updateMaterialResolution(){this.line1.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.line2.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.object3D.updateMatrixWorld()}hitTest(e){const t=[];return this.rigidBody.raycast(e,t),t.length>0}}class MeasureMinimumDistanceControl extends MeasrueControl{constructor(e){super(e),this.name="minimumDistance",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance,this.maxPointsNum=2,this.measurePoints=[],this.helper=e.helper,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e),this.endDraw(),this.unselect()}draw(e){}endDraw(){this.isEndDrawing=!0,this.line=new Line({helper:this.helper,control:this,name:"Line",viewer:this.viewer,points:[this.viewer.worldToScene(this.worldPositions[0]),this.viewer.worldToScene(this.worldPositions[1])],color:this.color,linewidth:this.linewidth}),this.add(this.line);let e=this.viewer.worldToClient({x:(this.worldPositions[0].x+this.worldPositions[1].x)/2,y:(this.worldPositions[0].y+this.worldPositions[1].y)/2,z:(this.worldPositions[0].z+this.worldPositions[1].z)/2});this.attachNotation([e,e]),this.lineTriangle1=new LineTriangle({control:this,name:"lineTriangle1",viewer:this.viewer,point:this.viewer.worldToScene(this.worldPositions[0]),direction:this.viewer.worldToScene(this.worldPositions[0]).sub(this.viewer.worldToScene(this.worldPositions[1])),color:this.color}),this.add(this.lineTriangle1),this.lineTriangle2=new LineTriangle({control:this,name:"lineTriangle2",viewer:this.viewer,point:this.viewer.worldToScene(this.worldPositions[1]),direction:this.viewer.worldToScene(this.worldPositions[1]).sub(this.viewer.worldToScene(this.worldPositions[0])),color:this.color}),this.add(this.lineTriangle2)}updateResult(){this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let e=this.viewer.worldToClient({x:(this.worldPositions[0].x+this.worldPositions[1].x)/2,y:(this.worldPositions[0].y+this.worldPositions[1].y)/2,z:(this.worldPositions[0].z+this.worldPositions[1].z)/2});this.attachNotation([e,e]),this.isSelected?this.select():this.unselect(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}setMinDistanceLine(e){this.minDistanceLine=e}clearMinDistanceLine(){}addPoint(e){var t=this.viewer;this.measurePoints.length==this.maxPointsNum&&this.reset();var i=!1;this.measurePoints.some((t=>(t.modelId===e.modelId&&t.userId===e.userId&&(i=!0),i))),i||(this.measurePoints.push(e),(e.modelId?t.getModel(e.modelId):t).addSelectedComponentsById([e.userId]),t.render())}reset(e){var t=this.viewer;!1!==e&&this.measurePoints.forEach((e=>{(e.modelId?t.getModel(e.modelId):t).removeSelectedId([e.userId])})),this.measurePoints=[],this.clearMinDistanceLine(),this.minDistanceLine=null,t.render()}redo(){var e=this.viewer;if(this.measurePoints.length>0&&this.measurePoints.length<this.maxPointsNum){var t=this.measurePoints.pop();(t.modelId?e.getModel(t.modelId):e).removeSelectedId([t.userId]),e.render()}else this.reset()}getInfo(){return{id:this.id,distance:this.measureResult,points:this.selectedComponentsId,type:this.type}}setData(e){this.info=e,this.id=e.id,this.selectedComponentsId=e.points,this.worldPositions=[e.start,e.end],this.measureResult=e.distance,this.setMeasureParams({precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit})}actionWhenSelected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).addSelectedComponentsById([e.userId])})),this.viewer.render()}actionWhenUnselected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).removeSelectedId([e.userId])})),this.viewer.render()}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatDistance(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!1),i.split(",").join("")}select(){super.select(),this.notation.select()}unselect(){super.unselect(),this.notation.unselect()}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize()),this.updateNotationPosition(),this.lineTriangle1&&this.lineTriangle1.updateScaleFactor(t,i),this.lineTriangle2&&this.lineTriangle2.updateScaleFactor(t,i)}updateNotationPosition(){this.isEndDrawing&&(this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,this.worldPositions))}}class Arc extends BaseItem{constructor(e){super(e)}init(){const{center:e,radius:t,thetaStart:i,thetaLength:n,material:o,quaternion:s}=this.getConfig();this.addArc(e,t,i,n,o,s),super.init()}addArc(e,t,i,n,o,s){const r=new THREE.EllipseCurve(0,0,t,t,i,i+n,!1,0).getPoints(128),a=[];r.forEach((e=>a.push(e.x||0,e.y||0,e.z||0)));const l=new THREE.LineGeometry;l.setPositions(a);let h=new THREE.LineMaterial({linewidth:o.linewidth||2,dashed:!1,depthTest:!1,transparent:!0,color:this.getLinearColor(o.color)});h.resolution.set(this.viewer.getViewer().domElement.clientWidth,this.viewer.getViewer().domElement.clientHeight);const d=new THREE.Line2(l,h);d.position.set(e.x,e.y,e.z),s&&d.quaternion.set(s.x,s.y,s.z,s.w),d.renderOrder=CLOUD.EnumRenderOrder.Effect+100,this.line=d,this.object3D.add(d)}updateMaterialResolution(){this.line.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.object3D.updateMatrixWorld()}}class MeasureAngleControl extends MeasrueControl{constructor(e){super(e),this.name="angle",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Angle,this.maxPointsNum=3,this.measurePoints=[],this.points=[],this.canEdit=!0,this.firstUpdate=!0,this.normalLength=70,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e);var t=new Point({control:this,name:"point1",viewer:this.viewer,point:this.viewer.worldToScene(this.worldPositions[0]),bgColor:this.color});this.point1=t,this.points.push(t),this.add(t),t=new Point({control:this,name:"point2",viewer:this.viewer,point:this.viewer.worldToScene(this.worldPositions[1]),bgColor:this.color}),this.point2=t,this.points.push(t),this.add(t),t=new Point({control:this,name:"point3",viewer:this.viewer,point:this.viewer.worldToScene(this.worldPositions[2]),bgColor:this.color}),this.add(t),this.point3=t,this.points.push(t),this.line1=new Line({control:this,name:"line1",viewer:this.viewer,points:[this.viewer.worldToScene(this.worldPositions[0]),this.viewer.worldToScene(this.worldPositions[1])],color:this.color,linewidth:this.linewidth}),this.add(this.line1),this.line2=new Line({control:this,name:"line2",viewer:this.viewer,points:[this.viewer.worldToScene(this.worldPositions[1]),this.viewer.worldToScene(this.worldPositions[2])],color:this.color,linewidth:this.linewidth}),this.add(this.line2),this.endDraw(),this.unselect()}draw(e){if(this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(e.clientPoints.length){case 3:let t=new Point({control:this,name:"point3",viewer:this.viewer,point:this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[2],["x","y","z"])),bgColor:this.color});this.add(t),this.point3=t,this.points.push(t),this.line2.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[1],["x","y","z"])),this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[2],["x","y","z"]))]),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render();break;case 2:if(!this.point2){let e=new Point({control:this,name:"point2",viewer:this.viewer,point:this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[1],["x","y","z"])),bgColor:this.color});this.point2=e,this.points.push(e),this.add(e)}this.line2?this.line2.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]):(this.line2=new Line({control:this,name:"line2",viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth}),this.add(this.line2)),this.line1.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[1],["x","y","z"]))]),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render();break;case 1:if(!this.point1){let t=new Point({control:this,name:"point1",viewer:this.viewer,point:this.viewer.worldToScene(e.worldPosition),bgColor:this.color});this.point1=t,this.points.push(t),this.add(t)}this.line1?this.line1.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]):(this.line1=new Line({control:this,name:"line1",viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth}),this.add(this.line1)),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}}endDraw(){this.isEndDrawing=!0,this.line1.update([this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1])]),this.line2.update([this.viewer.worldToScene(this.measurePoints[1]),this.viewer.worldToScene(this.measurePoints[2])]),this.addText(),this.addCurve(),this.updateScaleFactor(),this.viewer.getViewer().render()}addText(){this.notationGroup.length>0&&(this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear());var e=this.viewer.worldToScene(this.measurePoints[0]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone()),t=this.viewer.worldToScene(this.measurePoints[2]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone());let i=e.normalize().clone().add(t.normalize().clone()).normalize();var n=this.viewer.worldToScene(this.measurePoints[1]).clone().add(i.clone().multiplyScalar(this.normalLength));let o=this.viewer.worldToClient(this.viewer.sceneToWorld(n));this.attachNotation([o,o])}addCurve(){let e=(new THREE.Plane).setFromCoplanarPoints(this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1]),this.viewer.worldToScene(this.measurePoints[2])),t=e.normal.z<0?e.normal:new THREE.Vector3(-e.normal.x,-e.normal.y,-e.normal.z),i=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),t);var n=new THREE.Vector3(1,0,0).clone().applyQuaternion(i),o=this.viewer.worldToScene(this.measurePoints[0]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone()),s=n.angleTo(o);n.clone().cross(o).angleTo(t)<Math.PI/2<=0&&(s=2*Math.PI-s);var r=this.viewer.worldToScene(this.measurePoints[2]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone()),a=n.angleTo(r);var l;n.clone().cross(r).angleTo(t)<Math.PI/2<=0&&(a=2*Math.PI-a),l=0;let h=Math.min(s,a),d=Math.max(s,a);l=d-h<=Math.PI?h:d,this.curve&&this.remove(this.curve);let c=this.measurePoints[1].clone().sub(this.measurePoints[0].clone()).angleTo(this.measurePoints[1].clone().sub(this.measurePoints[2].clone()));c=c-.002<=0?0:c-.002,this.curve=new Arc({control:this,name:"arc",viewer:this.viewer,center:this.viewer.worldToScene(this.measurePoints[1]),radius:this.normalLength,thetaStart:l,thetaLength:c,material:{color:this.color},quaternion:i}),this.add(this.curve)}update(e){this.firstUpdate&&(this.select(),this.firstUpdate=!1),"point1"==this.selectChild.name?this.measurePoints[0]=e:"point2"==this.selectChild.name?this.measurePoints[1]=e:this.measurePoints[2]=e,this.selectChild.update(this.viewer.worldToScene(e)),this.line1.update([this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[1])]),this.line2.update([this.viewer.worldToScene(this.measurePoints[1]),this.viewer.worldToScene(this.measurePoints[2])]),this.calculate(),this.addText(),this.notation.select(),this.addCurve(),this.updateScaleFactor(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render(),this.measure.getEventManager().fireEvent(Glodon.Bimface.Plugins.Measure.MeasureEvent.MeasureResultUpdating,this.getInfo())}endUpdate(){this.firstUpdate=!0,this.calculate(),this.info.angle=this.measureAngle,this.info.points=this.worldPositions}calculate(){this.worldPositions=this.measurePoints;var e=new THREE.Vector3(this.worldPositions[0].x-this.worldPositions[1].x,this.worldPositions[0].y-this.worldPositions[1].y,this.worldPositions[0].z-this.worldPositions[1].z),t=new THREE.Vector3(this.worldPositions[2].x-this.worldPositions[1].x,this.worldPositions[2].y-this.worldPositions[1].y,this.worldPositions[2].z-this.worldPositions[1].z),i=e.angleTo(t);this.measureAngle=180*i/Math.PI}updateResult(){this.addText(),this.isSelected?this.select():this.unselect(),this.updateScaleFactor(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}getInfo(){return{id:this.id,points:this.worldPositions,angle:this.measureAngle,type:this.type}}setData(e){this.info=e,this.id=e.id,this.worldPositions=e.points,this.measurePoints=e.points;for(let e=0;e<this.measurePoints.length;e++)this.measurePoints[e]=new THREE.Vector3(this.measurePoints[e].x,this.measurePoints[e].y,this.measurePoints[e].z);this.measureAngle=e.angle,this.setMeasureParams({precision:e.precision})}getMeasureResult(){let e=this.measureAngle.toString();return MeasureResultFormat.formatPrecision(e,this.measureParams.precision).split(",").join("")+"°"}select(){super.select(),this.notation.select(),this.point1.object3D.visible=!0,this.point2.object3D.visible=!0,this.point3.object3D.visible=!0,this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}unselect(){super.unselect(),this.notation.unselect(),this.point1.object3D.visible=!1,this.point2.object3D.visible=!1,this.point3.object3D.visible=!1,this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize()),this.points.forEach((e=>e.updateScaleFactor(t,i))),this.updateCurveScaleFactor(t,i)}updateCurveScaleFactor(e,t){if(!this.isEndDrawing)return;var i=this.viewer.worldToScene(this.measurePoints[0]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone()),n=this.viewer.worldToScene(this.measurePoints[2]).clone().sub(this.viewer.worldToScene(this.measurePoints[1]).clone());let o=.9*i.length(),s=.9*n.length();e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var r=this.curve.line.position,a=e.clone().sub(r.clone()).length(),l=t.angleTo(this.curve.line.position.clone().sub(e.clone()));a=Math.sin(Math.PI/2-l)*a,this.getCloudViewer().camera.isPerspective||(a=this.getOrthogonalityCameraScaleValue());var h=.4*a/this.getCloudViewer().domElement.offsetHeight;h=Math.min(h*this.normalLength,o,s)/this.normalLength,this.curve.line.scale.set(h,h,h),this.curve.object3D.updateMatrixWorld();let d=i.normalize().clone().add(n.normalize().clone()).normalize();var c=this.viewer.worldToScene(this.measurePoints[1]).clone().add(d.clone().multiplyScalar(this.normalLength*h));let u=this.viewer.sceneToWorld(c);this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,[u,u])}reset(){this.children=[],this.measurePoints=[],this.points=[],this.line1=null,this.line2=null,this.point1=null,this.point2=null,this.point3=null,this.object3D.clear()}redo(){1==this.measurePoints.length?(this.remove(this.point1),this.remove(this.line1),this.point1=null,this.line1=null,this.points.pop()):2==this.measurePoints.length&&(this.remove(this.point2),this.remove(this.line2),this.point2=null,this.line2=null,this.points.pop()),super.redo()}}class MeasureElevationControl extends MeasrueControl{constructor(e){super(e),this.name="elevation",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Elevation,this.maxPointsNum=1,this.measurePoints=[],this.helper=e.helper,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e),this.endDraw(),this.unselect()}draw(e){}endDraw(){this.isEndDrawing=!0;let e=this.viewer.worldToClient(this.elevationPoint);this.attachNotation([e,e]),this.addPolyline()}addPolyline(){var e=new THREE.Vector3(this.elevationPoint.x,this.elevationPoint.y,this.elevationPoint.z);e=this.viewer.worldToClient(e);for(var t=[58,-12,-12,-12,0,0,12,-12],i="",n=0;n<t.length;n+=2)t[n]+=e.x,t[n+1]+=e.y,i+=t[n]+","+t[n+1]+" ";var o=MeasureUtil.makePolyline({color:this.color,width:2,points:i});this.elevationPolyline=o,this.attach([this.elevationPolyline])}updateResult(){this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let e=this.viewer.worldToClient(this.elevationPoint);this.attachNotation([e,e]),this.detach([this.elevationPolyline]),this.addPolyline(),this.isSelected?this.select():this.unselect()}getInfo(){return{id:this.id,points:[this.elevationPoint],initialElevation:this.initialElevation,elevation:this.elevation,type:this.type}}setData(e){this.info=e,this.id=e.id,this.elevationPoint=e.points[0],this.elevation="number"==typeof e.elevation?e.elevation:e.points[0].z,this.initialElevation=e.initialElevation,this.setMeasureParams({precision:e.precision,unit:e.unit,defaultUnit:e.defaultUnit})}getMeasureResult(){let e=this.measureParams.unit,t=this.elevation.toString(),i=MeasureResultFormat.formatDistance(t,this.measureParams);return i+=MeasureResultFormat.getPostFix(e,!1),i=i.split(",").join(""),0==i.split(" ")[0]&&(i=`±${i}`),i}select(){super.select(),this.notation.select()}unselect(){super.unselect(),this.notation.unselect()}updateScaleFactor(e){this.updateNotationPosition()}updateNotationPosition(){if(!this.isEndDrawing)return;this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,[this.elevationPoint,this.elevationPoint]);var e=new THREE.Vector3(this.elevationPoint.x,this.elevationPoint.y,this.elevationPoint.z);let t=this.viewer.worldToClient(e);this.viewer.isInViewFrustum(e)||(t={x:-100,y:-100});for(var i=[58,-12,-12,-12,0,0,12,-12],n="",o=0;o<i.length;o+=2)i[o]+=t.x,i[o+1]+=t.y,n+=i[o]+","+i[o+1]+" ";this.elevationPolyline.setAttribute("points",n)}hitTest(e,t){if(!this.isEndDrawing)return!1;var i=new THREE.Vector3(this.elevationPoint.x,this.elevationPoint.y,this.elevationPoint.z);i=this.viewer.worldToClient(i);let n=new THREE.Vector2(i.x-12,i.y-22),o=new THREE.Vector2(i.x+58,i.y-22);return MeasureUtil.distanceToSegment(t,n,o)<=22||this.notation.hitTest(t)}destroy(){super.destroy(),this.elevationPolyline&&(this.detach([this.elevationPolyline]),this.elevationPolyline=null)}}class MeasureVolumeControl extends MeasrueControl{constructor(e){super(e),this.name="volume",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Volume,this.maxPointsNum=1,this.measurePoints=[],this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e),this.endDraw(),this.unselect()}draw(e){}endDraw(){if(this.isEndDrawing=!0,!this.measureResult)return;let e=this.viewer.worldToClient(this.worldPosition);this.attachNotation([e,e])}updateResult(){if(!this.measureResult)return;this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let e=this.viewer.worldToClient(this.worldPosition);this.attachNotation([e,e]),this.isSelected?this.select():this.unselect()}getInfo(){return{id:this.id,volumeResult:this.measureResult,points:this.selectedComponentsId,volumePosition:this.viewer.worldToScene(this.worldPosition),type:this.type}}setData(e){this.info=e,this.id=e.id,this.selectedComponentsId=e.points,this.worldPosition=this.viewer.sceneToWorld(e.volumePosition),this.measureResult=e.volumeResult,this.setMeasureParams({precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit})}addPoint(e){var t=this._config.viewer;this.measurePoints.length==this.maxPointsNum&&this.reset();var i=!1;this.measurePoints.some((t=>(t.modelId===e.modelId&&t.userId===e.userId&&(i=!0),i))),i||(this.measurePoints.push(e),(e.modelId?t.getModel(e.modelId):t).addSelectedComponentsById([e.userId]),t.render())}reset(e){var t=this._config.viewer;!1!==e&&this.measurePoints.forEach((e=>{(e.modelId?t.getModel(e.modelId):t).removeSelectedId([e.userId])})),this.measurePoints=[],t.render()}actionWhenSelected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).addSelectedComponentsById([e.userId])})),this.viewer.render()}actionWhenUnselected(){this.selectedComponentsId.forEach((e=>{(e.modelId?this.viewer.getModel(e.modelId):this.viewer).removeSelectedId([e.userId])})),this.viewer.render()}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString(),i=MeasureResultFormat.formatCubic(t,this.measureParams);return i=i+MeasureResultFormat.getPostFix(e,!1)+"³",i.split(",").join("")}select(){super.select(),this.notation.select()}unselect(){super.unselect(),this.notation.unselect()}updateScaleFactor(e){this.updateNotationPosition()}updateNotationPosition(){this.isEndDrawing&&this.measureResult&&(this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,[this.worldPosition,this.worldPosition]))}}class LineArrow extends BaseItem{constructor(e){super(e)}init(){const{point:e,color:t,direction:i}=this.getConfig();this.dir=i,this.point=e,this.linewidth=this.getConfig().linewidth||1;this.line1=this.getLine([0,0,0,2,0,-4],{color:this.getLinearColor(t)}),this.object3D.add(this.line1);this.line2=this.getLine([0,0,0,-2,0,-4],{color:this.getLinearColor(t)}),this.object3D.add(this.line2),this.object3D.position.set(e.x,e.y,e.z),super.init(),this.updateScaleFactor()}getLine(e,t){const i=new THREE.LineGeometry;i.setPositions(e);let n=new THREE.LineMaterial({linewidth:this.linewidth,dashed:!1,depthTest:!1,...t});n.resolution.set(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.lineMaterial=n;const o=new THREE.Line2(i,this.lineMaterial);return o.computeLineDistances(),o.renderOrder=CLOUD.EnumRenderOrder.Effect+100,o}updateScaleFactor(e,t){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var i=this.object3D.position,n=e.clone().sub(i.clone()).length(),o=t.angleTo(this.object3D.position.clone().sub(e.clone()));n=Math.sin(Math.PI/2-o)*n,this.getCloudViewer().camera.isPerspective||(n=this.getOrthogonalityCameraScaleValue());var s=1.6*n/this.getCloudViewer().domElement.offsetHeight;this.object3D.scale.set(s,s,s),this.updateDirection(),this.object3D.updateMatrixWorld()}updateDirection(){let e=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();this.directionQuaternion=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,-1),this.dir.clone().normalize());const t=this.control.object3D.quaternion.clone().invert(),i=new THREE.Vector3(0,1,0).applyQuaternion(this.directionQuaternion),n=new THREE.Plane(new THREE.Vector3(...Object.values(this.dir)).normalize()),o=new THREE.Vector3;n.projectPoint(e.clone().applyQuaternion(t),o);const s=(new THREE.Quaternion).setFromUnitVectors(i,o.normalize()).multiply(this.directionQuaternion.clone());this.object3D.quaternion.set(s.x,s.y,s.z,s.w),this.object3D.updateMatrixWorld(!0)}updateMaterialResolution(){this.line1.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.line2.material.resolution=new THREE.Vector2(this.getCloudViewer().domElement.clientWidth,this.getCloudViewer().domElement.clientHeight),this.object3D.updateMatrixWorld()}}class MeasureLaserClearDistanceControl extends MeasrueControl{constructor(e){super(e),this.name="laserClearDistance",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance,this.maxPointsNum=1,this.lineArrowGroup={},this.lineGroup={},this.allNotationGroup={},this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)));const t=this.viewer.getDomElement();let i=document.getElementsByClassName("bf-measure-dragbutton")[0];if(!i){i=document.createElement("div"),i.innerHTML='\n <svg width="160px" height="160px" viewBox="0 0 160 160" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g>\n <g fill="#FFFFFF" fill-opacity="0.3" stroke="#999999" stroke-width="2">\n <path d="M80,1 C82.7908696,1 85.5479441,1.14468216 88.264129,1.4269862 C89.0464893,1.50830005 89.8254567,1.60103155 90.6008619,1.70501165 C95.2372276,2.32673796 99.7462267,3.35063053 104.091601,4.74047874 C109.461201,6.4579211 114.580945,8.73415789 119.382458,11.5007405 C131.430077,18.4424547 141.474355,28.4710659 148.435065,40.506339 C155.154653,52.1247049 159,65.6133154 159,80 C159,101.815248 150.157624,121.565248 135.861436,135.861436 C121.565248,150.157624 101.815248,159 80,159 C58.1847524,159 38.4347524,150.157624 24.1385643,135.861436 C9.84237619,121.565248 1,101.815248 1,80 C1,58.1847524 9.84237619,38.4347524 24.1385643,24.1385643 C38.4347524,9.84237619 58.1847524,1 80,1 Z" id="Oval-2"></path>\n </g>\n <circle fill-opacity="0.8" fill="#FFFFFF" cx="80" cy="80" r="40"></circle>\n <g transform="translate(58.000000, 58.000000)" fill="#32D3A6" fill-rule="nonzero">\n <path d="M23.2727273,27.1515152 L23.2727273,36.8484848 L29.0909091,36.8484848 L22.3030303,44.6060606 L15.5151515,36.8484848 L21.3333333,36.8484848 L21.3333333,27.1515152 L23.2727273,27.1515152 Z M36.8484848,15.5151515 L44.6060606,22.3030303 L36.8484848,29.0909091 L36.8484848,23.2707879 L27.1515152,23.2727273 L27.1515152,21.3333333 L36.8484848,21.3313939 L36.8484848,15.5151515 Z M7.75757576,15.5151515 L7.75757576,21.3333333 L17.4545455,21.3333333 L17.4545455,23.2727273 L7.75757576,23.2727273 L7.75757576,29.0909091 L0,22.3030303 L7.75757576,15.5151515 Z M22.3030303,0 L29.0909091,7.75757576 L23.2727273,7.75757576 L23.2727273,17.4545455 L21.3333333,17.4545455 L21.3333333,7.75757576 L15.5151515,7.75757576 L22.3030303,0 Z" id="形状"></path>\n </g>\n </g>\n </g>\n </svg>\n ',i.className="bf-measure-dragbutton",i.style.display="none";let e=this.dragEvents={touchmove:e=>{let{top:n,left:o}=t.getBoundingClientRect(),{clientX:s,clientY:r}=e.touches[0];this.setButtonPosition(i,s-o,r-n);const a=new Touch({identifier:Date.now(),target:t,clientX:s,clientY:r,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5}),l=new TouchEvent("touchstart",{touches:[a]});t.dispatchEvent(l);const h=new TouchEvent("touchend");t.dispatchEvent(h),e.stopPropagation(),e.preventDefault()}};for(let t in e)i.addEventListener(t,e[t]);t.appendChild(i)}this.dragButton=i,this.dragButtonPoint=null,this.dragButtonVisible=!1,this._result={};const n=this.nextButtons={},o=document.createElement("div");this.nextButtonContainer=o,t.appendChild(o),["positive_X","negative_X","positive_Y","negative_Y","positive_Z"].forEach((e=>{const t=document.createElement("div");t.addEventListener("touchstart",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("touchmove",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("touchend",(t=>{this.getNextResult(e),t.stopPropagation(),t.preventDefault()})),t.addEventListener("mousedown",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("mousemove",(e=>{e.stopPropagation(),e.preventDefault()})),t.addEventListener("mouseup",(t=>{this.getNextResult(e),t.stopPropagation(),t.preventDefault()})),t.className=`bf-measure-nextbutton ${e}`;const i={button:t};let s;Object.defineProperty(i,"position",{set:e=>{if(e){t.style.display="block";let{x:i,y:n}=this.viewer.worldToClient(e);i&&n&&this.setButtonPosition(t,i,n)}else t.style.display="none";s=e},get:()=>s}),o.appendChild(t),n[e]=i})),this.fun=()=>{if(this.dragButtonVisible&&this.dragButtonPoint){this.dragButton.style.display=this.viewer.isInViewFrustum(this.dragButtonPoint)?"block":"none";let{x:e,y:t}=this.viewer.worldToClient(this.dragButtonPoint);e&&t&&this.setButtonPosition(this.dragButton,e,t)}Object.values(n).forEach((e=>{e.position=e.position?e.position.clone():void 0,e.position&&!this.viewer.isInViewFrustum(e.position)&&(e.button.style.display="none")}))},this.viewer.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.CameraPositionChanged,this.fun)}initByData(e){this.id=e.id,this.setData(e),this.measurePoints.push({componentId:e.componentSelected.componentId,modelId:e.componentSelected.modelId,point:this.viewer.globalUnitUtil.translate(e.pointSelected,["x","y","z"])}),this.computeMeasureResult(e.intersectNormal),this.endDraw(),this.unselect()}draw(e){this.drawCaptureItem(e)}endDraw(){this.isEndDrawing=!0;const e=this.measure.getMeasureParams().laserXYZ,t={X:"#CC021B",Y:"#7CCF21",Z:"#4A90E2"},i=n=>{const o=this.data[`Laser${n}`];if(o&&-1!==e.indexOf(n)){const e=t[n],[i,s]=o.endPoints,r=new THREE.Vector3(i.x,i.y,i.z),a=new THREE.Vector3(s.x,s.y,s.z),l=o.distance;this.lineGroup[n]=new Line({control:this,name:"line",viewer:this.viewer,points:[this.viewer.worldToScene(r),this.viewer.worldToScene(a)],linewidth:this.lineWidth,isNotHitTest:!0,color:e}),this.add(this.lineGroup[n]),this.lineArrowGroup[n+"start"]=new LineArrow({control:this,name:n+"start",viewer:this.viewer,point:this.viewer.worldToScene(r),direction:this.viewer.worldToScene(a).sub(this.viewer.worldToScene(r)),linewidth:this.lineWidth,color:e}),this.add(this.lineArrowGroup[n+"start"]),this.lineArrowGroup[n+"end"]=new LineArrow({control:this,name:n+"end",viewer:this.viewer,point:this.viewer.worldToScene(a),direction:this.viewer.worldToScene(r).sub(this.viewer.worldToScene(a)),linewidth:this.lineWidth,color:e}),this.add(this.lineArrowGroup[n+"end"]);let h={x:(r.x+a.x)/2,y:(r.y+a.y)/2,z:(r.z+a.z)/2},d=this.viewer.worldToClient(h);if(!this.viewer.isInViewFrustum(h)){const{offsetHeight:e,offsetWidth:t}=this.viewer.getDomElement(),i=i=>i.x>0&&i.y>0&&i.x<t&&i.y<e;let n=new THREE.Vector3(this.data.pointSelected.x,this.data.pointSelected.y,this.data.pointSelected.z);if(this.viewer.isInViewFrustum(n)){let e=this.viewer.worldToClient(n),t=new THREE.Vector3(e.x,e.y,e.z),o=new THREE.Vector3(d.x,d.y,d.z);const s=100;d=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(s)),i(d)||(d=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(-s))),i(d)||(d={x:-100,y:-100})}else d={x:-100,y:-100}}let c=this.notation.drawAnnotation({x:d.x,y:d.y},this.getMeasureResultText(l),this.id,e);this.allNotationGroup[n]=c,this.attach(c)}return i};i("X")("Y")("Z")}updateResult(){const e={X:"#CC021B",Y:"#7CCF21",Z:"#4A90E2"},t=this.measure.getMeasureParams().laserXYZ;this.notation.clear();const i=n=>{const o=this.data[`Laser${n}`];if(o&&-1!==t.indexOf(n)){const t=e[n],[i,s]=o.endPoints,r=new THREE.Vector3(i.x,i.y,i.z),a=new THREE.Vector3(s.x,s.y,s.z),l=o.distance;let h={x:(r.x+a.x)/2,y:(r.y+a.y)/2,z:(r.z+a.z)/2},d=this.viewer.worldToClient(h);if(!this.viewer.isInViewFrustum(h)){const{offsetHeight:e,offsetWidth:t}=this.viewer.getDomElement(),i=i=>i.x>0&&i.y>0&&i.x<t&&i.y<e;let n=new THREE.Vector3(this.data.pointSelected.x,this.data.pointSelected.y,this.data.pointSelected.z);if(this.viewer.isInViewFrustum(n)){let e=this.viewer.worldToClient(n),t=new THREE.Vector3(e.x,e.y,e.z),o=new THREE.Vector3(d.x,d.y,d.z);const s=100;d=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(s)),i(d)||(d=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(-s))),i(d)||(d={x:-100,y:-100})}else d={x:-100,y:-100}}let c=this.notation.drawAnnotation({x:d.x,y:d.y},this.getMeasureResultText(l),this.id,t);this.detach(this.allNotationGroup[n]),this.allNotationGroup[n]=c,this.attach(c)}return i};i("X")("Y")("Z"),this.isSelected?this.select():this.unselect()}getInfo(){return{id:this.id,data:this.data,type:this.type}}setData(e){this.info=e,this.id=e.id,this.lineWidth=1,this.data=e,this.setMeasureParams({precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit})}getMeasureResultText(e){let t=this.measureParams.unit,i=e.toString(),n=MeasureResultFormat.formatDistance(i,this.measureParams);return n+=MeasureResultFormat.getPostFix(t,!1),n.split(",").join("")}computeMeasureResult(e){e=new THREE.Vector3(e.x,e.y,e.z),this.intersectNormal=e;let t=this.getPoints();const i=this.measure.getMeasureParams().laserXYZ;if(0===t.length)return;t[0].point=new THREE.Vector3(...Object.values(this.viewer.globalUnitUtil.revertTranslate(t[0].point,["x","y","z"])));let{point:n}=t[0];this._result.pointInfo=t[0];let o=this.viewer.globalUnitUtil.excute(1,"mm",this.viewer.getUnit());const s=n.clone().add(e.clone().multiplyScalar(o)),r=(e,t)=>{const n=this.viewer.getComponentsByRaycaster(s,t),o=this.viewer.getComponentsByRaycaster(s,t.clone().negate());return this._result[e]=n.length>0&&o.length>0?{enable:!0,direction:t,positiveIntersects:n,negativeIntersects:o,positiveIndex:0,negativeIndex:0}:{enable:!1},this.nextButtons[`positive_${e}`].position=n.length>1&&o.length>0&&-1!==i.indexOf(e)?n[0].position:void 0,"Z"!==e&&(this.nextButtons[`negative_${e}`].position=o.length>1&&n.length>0&&-1!==i.indexOf(e)?o[0].position:void 0),r};let a,l,h;return Math.abs(1-Math.abs(e.z))<.001?(a=new THREE.Vector3(1,0,0),l=new THREE.Vector3(0,1,0),h=new THREE.Vector3(0,0,1)):(a=e.clone().cross(new THREE.Vector3(0,0,1)),a.x<0&&a.negate(),l=e.clone().cross(a),l.y<0&&l.negate(),h=e),r("X",a)("Y",l)("Z",h),!Glodon.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.showDragButton(n),this.getMeasureResult()}getMeasureResult(){let e={},{componentId:t,modelId:i,point:n}=this._result.pointInfo;const o=this.measure.getMeasureParams().laserXYZ;e.pointSelected={x:n.x,y:n.y,z:n.z},e.componentSelected={componentId:t,modelId:i},e.type=this.type;const s=t=>{if(this._result[t].enable&&-1!==o.indexOf(t)){let{direction:i,positiveIntersects:n,negativeIntersects:o,positiveIndex:s,negativeIndex:r}=this._result[t],a=n[s],l=o[r];e[`Laser${t}`]={vector:{x:i.x,y:i.y,z:i.z},distance:a.distance+l.distance,endPoints:[{x:a.position.x,y:a.position.y,z:a.position.z,direction:"positive"},{x:l.position.x,y:l.position.y,z:l.position.z,direction:"negative"}],endComponents:[{componentId:a.id,modelId:a.modelId,direction:"positive"},{componentId:l.id,modelId:l.modelId,direction:"negative"}]}}return s};return s("X")("Y")("Z"),e.intersectNormal=this.intersectNormal,e}getNextResult(e){let[t,i]=e.split("_");if(!this._result[i]||!this._result[i].enable)return;let n=this._result[i][`${t}Intersects`],o=++this._result[i][`${t}Index`];n.length<=o&&(this._result[i][`${t}Index`]=o=0),this.data=this.getMeasureResult(),this.nextButtons[e].position=n[o].position,this.updateLinesPosition(),this.updateResult(),this.updateScaleFactor()}updateLinesPosition(){const e=this.measure.getMeasureParams().laserXYZ,t=i=>{const n=this.data[`Laser${i}`];if(n&&-1!==e.indexOf(i)){const[e,t]=n.endPoints,o=new THREE.Vector3(e.x,e.y,e.z),s=new THREE.Vector3(t.x,t.y,t.z);this.lineGroup[i].update([this.viewer.worldToScene(o),this.viewer.worldToScene(s)]),this.lineArrowGroup[i+"start"].object3D.position.copy(this.viewer.worldToScene(o)),this.lineArrowGroup[i+"end"].object3D.position.copy(this.viewer.worldToScene(s))}return t};t("X")("Y")("Z"),this.object3D.updateMatrixWorld(),this.viewer.render()}showDragButton(e){this.reset(),this.viewer.render(),this.dragButtonPoint=e,this.dragButtonVisible=!0;let{x:t,y:i}=this.viewer.worldToClient(e);this.dragButton.style.display="block",t&&i&&this.setButtonPosition(this.dragButton,t,i)}hideDragButton(){this.dragButtonVisible=!1,this.dragButton.style.display="none",Object.values(this.nextButtons).forEach((e=>e.position=void 0))}showNextButton(){this.nextButtonContainer.style.display="block"}hideNextButton(){this.nextButtonContainer.style.display="none"}clearNextButton(){Object.values(this.nextButtons).forEach((e=>e.position=void 0))}setButtonPosition(e,t,i){e.style.top=`${i}px`,e.style.left=`${t}px`}select(){super.select(),this.notation.select(),this.showNextButton()}unselect(){super.unselect(),this.notation.unselect(),Glodon.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.hideNextButton()}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize());for(let e in this.lineArrowGroup)this.lineArrowGroup[e]&&this.lineArrowGroup[e].updateScaleFactor(t,i);this.updateNotationPosition()}updateNotationPosition(){if(!this.isEndDrawing)return;this.notation.notationSegmentRects=[];const e=this.measure.getMeasureParams().laserXYZ,t=i=>{const n=this.data[`Laser${i}`];if(n&&-1!==e.indexOf(i)){const[e,t]=n.endPoints,o=new THREE.Vector3(e.x,e.y,e.z),s=new THREE.Vector3(t.x,t.y,t.z),r=n.distance;let a={x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2},l=this.viewer.worldToClient(a);if(!this.viewer.isInViewFrustum(a)){const{offsetHeight:e,offsetWidth:t}=this.viewer.getDomElement(),i=i=>i.x>0&&i.y>0&&i.x<t&&i.y<e;let n=new THREE.Vector3(this.data.pointSelected.x,this.data.pointSelected.y,this.data.pointSelected.z);if(this.viewer.isInViewFrustum(n)){let e=this.viewer.worldToClient(n),t=new THREE.Vector3(e.x,e.y,e.z),o=new THREE.Vector3(l.x,l.y,l.z);const s=100;l=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(s)),i(l)||(l=t.clone().add(o.clone().sub(t).normalize().multiplyScalar(-s))),i(l)||(l={x:-100,y:-100})}else l={x:-100,y:-100}}let h=this.notation.calcAnnotationStyle(this.getMeasureResultText(r),l);this.allNotationGroup[i][0].setAttribute("x",h.offsetRect.x),this.allNotationGroup[i][0].setAttribute("y",h.offsetRect.y),this.allNotationGroup[i][1].setAttribute("x",h.offsetRect.x-2),this.allNotationGroup[i][1].setAttribute("y",h.offsetRect.y-2),this.allNotationGroup[i][2].setAttribute("x",h.offsetText.x),this.allNotationGroup[i][2].setAttribute("y",h.offsetText.y);let d=new Vector2(h.offsetRect.x,h.offsetRect.y+this.notation.annotationStyle.height/2),c=new Vector2(h.offsetRect.x+h.width,d.y);this.notation.notationSegmentRects.push({start:d,end:c})}return t};t("X")("Y")("Z")}destroy(){super.destroy(),this.viewer.getDomElement().removeChild(this.nextButtonContainer),this.viewer.removeEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.CameraPositionChanged,this.fun)}removeAllSvg(){for(let e in this.allNotationGroup)this.detach(this.allNotationGroup[e]);this.allNotationGroup={}}}class Arrow extends BaseItem{constructor(e){super(e)}init(){const{point:e,color:t,direction:i}=this.getConfig();this.direction=i,this.arrow=this.getArrow(e,i,t),this.object3D.add(this.arrow),super.init()}getArrow(e,t,i){const n=new THREE.BufferGeometry,o=new Float32Array([-7,0,0,7,0,0,0,0,14]);n.setAttribute("position",new THREE.BufferAttribute(o,3));const s=new BasicMaterial({depthTest:!1,side:THREE.DoubleSide,color:this.getLinearColor(i)}),r=new THREE.Mesh(n,s),a=new THREE.Vector3(...Object.values(t)).normalize(),l=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),a);r.applyQuaternion(l);const h=new THREE.Vector3(...Object.values(e));return r.position.set(h.x,h.y,h.z),r.scale.set(.8,.8,.8),r.renderOrder=CLOUD.EnumRenderOrder.Effect+1e3,r.updateMatrixWorld(!0),r}updateScaleFactor(e,t){}updateDirection(e){if(!e)return;const t=this.control.object3D.quaternion.clone().invert();this.directionQuaternion=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),this.direction.clone().normalize());const i=new THREE.Vector3(0,1,0).applyQuaternion(this.directionQuaternion),n=new THREE.Plane(new THREE.Vector3(...Object.values(this.direction)).normalize()),o=new THREE.Vector3;n.projectPoint(e.clone().applyQuaternion(t),o);const s=(new THREE.Quaternion).setFromUnitVectors(i,o.normalize()).multiply(this.directionQuaternion.clone());this.arrow.quaternion.set(s.x,s.y,s.z,s.w),this.arrow.updateMatrixWorld(!0),this.object3D.updateMatrixWorld()}}const fragmentShader="\n uniform vec3 diffuse;\n uniform float opacity;\n\n void main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <alphatest_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n\n }\n ";class BasicMaterial{constructor(e){let t=new THREE.ShaderMaterial({type:"BasicMaterial",uniforms:THREE.UniformsUtils.clone(THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog])),fragmentShader:fragmentShader,clipping:!1});return Object.defineProperties(t,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}}}),t.setValues(e),t}}const ARROW_LENGTH=90;class MeasureSlopeControl extends MeasrueControl{constructor(e){super(e),this.name="slope",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Slope,this.maxPointsNum=1,this.measurePoints=[],this.helper=e.helper,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e),this.endDraw(),this.unselect(),this.updateScaleFactor()}draw(e){this.drawCaptureItem(e)}drawCaptureItem(e){let t=this.hoverPanel,i=this.hoverPanelSize;if("Panel"===e.hoverObjectType){let n=e.clientPts,o=n[0].distanceTo(n[1]),s=n[0].distanceTo(n[3]),r=o/i.width,a=s/i.height;if(1!=r){let e=this.stretchOnDirection(n[0],n[1],i.width),t=this.stretchOnDirection(n[2],n[3],i.width);n=e.concat(t)}if(1!=a){let e=this.stretchOnDirection(n[0],n[3],i.height),t=this.stretchOnDirection(n[1],n[2],i.height);n=[e[0],t[0],t[1],e[1]]}let l="";for(let e=0;e<n.length;e++)l+=n[e].x+",",l+=n[e].y+" ";t.setAttribute("points",l),e.svg.appendChild(t)}}endDraw(){this.isEndDrawing=!0,this.point=new Point({control:this,name:"point",viewer:this.viewer,point:this.viewer.worldToScene(this.slopePoint),bgColor:this.color}),this.add(this.point),this.pointUnselect=new Point({control:this,name:"pointUnselect",viewer:this.viewer,point:this.viewer.worldToScene(this.slopePoint),noBorder:!0,bgColor:this.color,borderColor:this.color}),this.add(this.pointUnselect);let e=new THREE.Object3D,t=this.viewer.worldToScene(this.slopePoint),i=this.viewer.worldToScene(this.slopeDir),n=new THREE.Vector3(0,0,0).clone().add(i.normalize().clone().multiplyScalar(90));this.line=new Line({control:this,name:"line",viewer:this.viewer,points:[new THREE.Vector3(0,0,0),n],color:this.color,linewidth:this.linewidth}),e.add(this.line.object3D),this.arrow=new Arrow({control:this,name:"arrow",viewer:this.viewer,point:n,direction:this.viewer.worldToScene(this.slopeDir),color:this.color}),e.add(this.arrow.object3D),this.obj3d=e,this.obj3d.position.set(t.x,t.y,t.z),this.object3D.add(e);let o=new THREE.Vector3(0,0,0).clone().add(i.normalize().clone().multiplyScalar(100)),s=new THREE.Vector3(o.x,0,o.z);o.angleTo(s)>.01&&(this.dashLine=new Line({control:this,name:"Line",viewer:this.viewer,isNotHitTest:!0,points:[new THREE.Vector3(0,0,0),s],color:"#7CCF21",linewidth:2,dashed:!0,dashSize:.4,gapSize:.4}),e.add(this.dashLine.object3D)),s.length()>20&&o.angleTo(s)>.01&&this.addCurve([o,new THREE.Vector3(0,0,0),s]);let r=this.viewer.worldToClient(this.slopePoint);this.attachNotation([r,r]),this.updateScaleFactor()}addCurve(e){let t=(new THREE.Plane).setFromCoplanarPoints(e[0],e[1],e[2]),i=t.normal.z<0?t.normal:new THREE.Vector3(-t.normal.x,-t.normal.y,-t.normal.z),n=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),i);var o=new THREE.Vector3(1,0,0).clone().applyQuaternion(n),s=e[0].clone().sub(e[1].clone()),r=o.angleTo(s);o.clone().cross(s).z>=0&&(r=2*Math.PI-r);var a,l=e[2].clone().sub(e[1].clone()),h=o.angleTo(l);(o.clone().cross(l).z>0&&(h=2*Math.PI-h),r>h)?a=l.clone().cross(s).z>=0?r:h:a=s.clone().cross(l).z>0?h:r;this.curve&&this.remove(this.curve);let d=e[1].clone().sub(e[0].clone()).angleTo(e[1].clone().sub(e[2].clone()));this.curve=new Arc({control:this,name:"arc",viewer:this.viewer,center:e[1],radius:18,thetaStart:a,thetaLength:d,material:{color:this.color},quaternion:n}),this.obj3d.add(this.curve.object3D)}updateResult(){this.isSelected?this.select():this.unselect()}getInfo(){return{id:this.id,slope:this.slope,point:this.slopePoint,normal:this.slopeNormal,type:this.type}}setData(e){this.info=e,this.id=e.id,this.slope=e.slope,this.slopePoint=e.point,this.slopeNormal=e.normal,this.slopeDir=e.slopeDir}getMeasureResult(){return this.slope+" %"}select(){super.select(),this.point.object3D.visible=!0,this.pointUnselect.object3D.visible=!1,this.notation.select(),this.dashLine&&(this.dashLine.object3D.visible=!0),this.curve&&(this.curve.object3D.visible=!0),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}unselect(){super.unselect(),this.point.object3D.visible=!1,this.pointUnselect.object3D.visible=!0,this.notation.unselect(),this.dashLine&&(this.dashLine.object3D.visible=!1),this.curve&&(this.curve.object3D.visible=!1),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}hitTest(e,t){let i=null;this.children.some((n=>{const o=n.hitTest(e,t);return o&&(i=n),o})),this.hoveredObject=i;let n=this.hitTestArrow(e,t);return this.hoveredObject?!!this.hoveredObject:n||this.notation.hitTest(t)}hitTestArrow(e,t){if(!this.slopePoint||!this.worldPoint2)return!1;let i=this.viewer.worldToClient(this.slopePoint),n=this.viewer.worldToClient(this.worldPoint2);var o=new Vector2(i.x,i.y),s=new Vector2(n.x,n.y);return MeasureUtil.distanceToSegment(t,o,s)<=10}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize()),this.point&&this.point.updateScaleFactor(t,i),this.pointUnselect&&this.pointUnselect.updateScaleFactor(t,i),this.arrow&&this.arrow.updateDirection(i),this.obj3d&&this.updateScaleFactorArrow(t,i)}updateScaleFactorArrow(e,t){e=e||this.getCloudViewer().camera.position.clone(),t=t||this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize();var i=this.viewer.worldToScene(this.slopePoint),n=e.clone().sub(i.clone()).length(),o=t.angleTo(i.clone().sub(e.clone()));n=Math.sin(Math.PI/2-o)*n,this.getCloudViewer().camera.isPerspective||(n=this.getOrthogonalityCameraScaleValue());var s=1*n/this.getCloudViewer().domElement.offsetHeight;this.obj3d.scale.set(s,s,s),this.obj3d.updateMatrixWorld();let r=this.viewer.worldToScene(this.slopePoint),a=this.viewer.worldToScene(this.slopeDir),l=r.clone().add(a.normalize().clone().multiplyScalar(90*s)),h=this.viewer.sceneToWorld(l);this.worldPoint2=h,this.updateNotationPosition({x:(this.slopePoint.x+h.x)/2,y:(this.slopePoint.y+h.y)/2,z:(this.slopePoint.z+h.z)/2})}updateNotationPosition(e){this.isEndDrawing&&(this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,[e,e]))}}class SpaceShape extends BaseItem{constructor(e){super(e)}init(){const{points:e,color:t,opacity:i}=this.getConfig();this.color=t,this.opacity=i||1,this.trangles=[],this.trangleArr=MeasureUtil.getAllTriangle(e);for(let e=0;e<this.trangleArr.length;e++)this.drawTrangle(this.trangleArr[e][0],this.trangleArr[e][1],this.trangleArr[e][2]);super.init()}drawTrangle(e,t,i){const n=new THREE.BufferGeometry,o=new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z,i.x,i.y,i.z]);n.setAttribute("position",new THREE.BufferAttribute(o,3)),n.computeVertexNormals();const s=new THREE.MeshBasicMaterial({color:this.getLinearColor(this.color),depthTest:!1,depthWrite:!0,side:2,transparent:!0,opacity:this.opacity}),r=new THREE.Mesh(n,s);r.renderOrder=CLOUD.EnumRenderOrder.Effect,r.position.set(0,0,0),r.name="drawTrangle",this.trangles.push(r),this.object3D.add(r),this.object3D.updateMatrixWorld()}updatePosition(e){this.getConfig().position=e,this.position.set(e.x,e.y,e.z),this.updateMatrixWorld(!0)}getArea(){let e=0;for(let t=0;t<this.trangleArr.length;t++){e+=(new THREE.Triangle).set(this.viewer.sceneToWorld(this.trangleArr[t][0]),this.viewer.sceneToWorld(this.trangleArr[t][1]),this.viewer.sceneToWorld(this.trangleArr[t][2])).getArea()}return e}update(e){this.trangles.length>0&&(this.trangles.forEach((e=>{this.object3D.remove(e),e.geometry.dispose()})),this.trangles=[]),this.getConfig().points=e,this.trangleArr=MeasureUtil.getAllTriangle(e);for(let e=0;e<this.trangleArr.length;e++)this.drawTrangle(this.trangleArr[e][0],this.trangleArr[e][1],this.trangleArr[e][2])}}class MeasureSpatialAreaControl extends MeasrueControl{constructor(e){super(e),this.name="spatialArea",this.type=Glodon.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea,this.maxPointsNum=1e4,this.points=[],this.unselectPoints=[],this.lines=[],this.lastLine=null,this.spaceShape=null,this.triangles=[],this.lastTriangles=null,this.measurePoints=[],this.canEdit=!0,this.firstUpdate=!0,this.addHelperEvent("CameraChanged",(e=>this.updateScaleFactor(e)))}initByData(e){this.id=e.id,this.setData(e);for(let e=0;e<this.measurePoints.length;e++){const t=new Point({control:this,name:"point-"+e,viewer:this.viewer,point:this.viewer.worldToScene(this.measurePoints[e]),bgColor:this.color});let i,n;this.add(t),this.points.push(t),e===this.measurePoints.length-1?(i=this.measurePoints[0],n=this.measurePoints[e]):(i=this.measurePoints[e],n=this.measurePoints[e+1]);const o=new Line({control:this,name:"line"+e,viewer:this.viewer,points:[this.viewer.worldToScene(i),this.viewer.worldToScene(n)],color:this.color,linewidth:this.linewidth});this.add(o),this.lines.push(o)}this.endDraw(),this.unselect()}draw(e){if(!this.getIsReserverd())switch(this._svg=e.svg,this.drawCaptureItem(e),e.clientPoints.length){case 0:break;case 1:if(!this.points[e.clientPoints.length-1]){const t=this.points[e.clientPoints.length-1]=new Point({control:this,name:"point-"+(e.clientPoints.length-1),viewer:this.viewer,point:this.viewer.worldToScene(e.worldPosition),bgColor:this.color});this.add(t)}if(this.lines[e.clientPoints.length-1])this.lines[e.clientPoints.length-1].update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[e.clientPoints.length-1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]);else{const t=this.lines[e.clientPoints.length-1]=new Line({control:this,name:"line"+e.clientPoints.length,viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[e.clientPoints.length-1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth});this.add(t)}this.object3D.updateMatrixWorld(),this.viewer.getViewer().render();break;default:if(!this.points[e.clientPoints.length-1]){const t=this.points[e.clientPoints.length-1]=new Point({control:this,name:"point-"+(e.clientPoints.length-1),viewer:this.viewer,point:this.viewer.worldToScene(e.worldPosition),bgColor:this.color});this.add(t)}if(this.lines[e.clientPoints.length-1])this.lines[e.clientPoints.length-1].update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[e.clientPoints.length-1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]);else{const t=this.lines[e.clientPoints.length-1]=new Line({control:this,name:"line"+e.clientPoints.length,viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[e.clientPoints.length-1],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth});this.add(t)}if(this.lastLine?this.lastLine.update([this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)]):(this.lastLine=new Line({control:this,name:"lastLine",viewer:this.viewer,points:[this.viewer.worldToScene(this.viewer.globalUnitUtil.revertTranslate(this.measurePoints[0],["x","y","z"])),this.viewer.worldToScene(e.worldPosition)],color:this.color,linewidth:this.linewidth}),this.add(this.lastLine)),e.clientPoints.length>=2){let t=[],i=[];if(this.measurePoints.map((e=>i.push(this.viewer.globalUnitUtil.revertTranslate(e,["x","y","z"])))),i.push(e.worldPosition),i.map((e=>t.push(this.viewer.worldToScene(e)))),this.spaceShape)this.spaceShape.update(t);else{let e=this.spaceShape=new SpaceShape({control:this,name:"spaceShape",viewer:this.viewer,points:t,color:this.color,linewidth:this.linewidth,opacity:.3});this.add(e)}let n=this.spaceShape.getArea();this.measureResult=n,this.notationGroup.length>0&&(this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear());let o=this.viewer.worldToClient(e.worldPosition);this.attachNotation([o,o]),this.notation.select()}this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}}endDraw(){this.isEndDrawing=!0,this.lastLine&&this.remove(this.lastLine),this.lines[this.lines.length-1].update([this.viewer.worldToScene(this.measurePoints[0]),this.viewer.worldToScene(this.measurePoints[this.measurePoints.length-1])]);let e=[];if(this.measurePoints.map((t=>e.push(this.viewer.worldToScene(t)))),this.spaceShape)this.spaceShape.update(e);else{let t=this.spaceShape=new SpaceShape({control:this,name:"spaceShape",viewer:this.viewer,points:e,color:this.color,linewidth:this.linewidth,opacity:.3});this.add(t)}this.measurePoints.map((e=>{let t=new Point({control:this,name:"pointUnselect",viewer:this.viewer,point:this.viewer.worldToScene(e),noBorder:!0,bgColor:this.color,borderColor:this.color});t.object3D.visible=!1,t.hitTest=()=>!1,this.add(t),this.unselectPoints.push(t)})),this.notationGroup.length>0&&(this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear());let t=this.viewer.worldToClient(this.measurePoints[this.measurePoints.length-1]);this.attachNotation([t,t]),this.notation.select()}update(e){this.firstUpdate&&(this.select(),this.firstUpdate=!1);let t=+this.selectChild.name.split("-")[1];this.measurePoints[t]=e,this.selectChild.update(this.viewer.worldToScene(e)),this.unselectPoints[t].update(this.viewer.worldToScene(e));for(let e=0;e<this.measurePoints.length;e++){let t,i;e===this.measurePoints.length-1?(t=this.measurePoints[0],i=this.measurePoints[e]):(t=this.measurePoints[e],i=this.measurePoints[e+1]),this.lines[e].update([this.viewer.worldToScene(t),this.viewer.worldToScene(i)])}let i=[];this.measurePoints.map((e=>i.push(this.viewer.worldToScene(e)))),this.spaceShape.update(i);let n=this.spaceShape.getArea();this.measureResult=n,this.notationGroup.length>0&&(this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear());let o=this.viewer.worldToClient(this.measurePoints[this.measurePoints.length-1]);this.attachNotation([o,o]),this.notation.select(),this.updateScaleFactor(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render(),this.measure.getEventManager().fireEvent(Glodon.Bimface.Plugins.Measure.MeasureEvent.MeasureResultUpdating,this.getInfo())}endUpdate(){this.firstUpdate=!0,this.info.area=this.measureResult,this.info.points=this.measurePoints}updateResult(){this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear();let e=this.viewer.worldToClient(this.measurePoints[this.measurePoints.length-1]);this.attachNotation([e,e]),this.isSelected?this.select():this.unselect(),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}getInfo(){return{id:this.id,area:this.measureResult,points:this.measurePoints,type:this.type}}setData(e){this.info=e,this.id=e.id,this.measureResult=e.area,this.measurePoints=e.points,this.setMeasureParams({precision:e.precision,scale:e.scale,unit:e.unit,defaultUnit:e.defaultUnit})}setMeasureParams(e){this.measureParams.precision=e.precision,this.measureParams.scale=e.scale,this.measureParams.unit=e.unit,this.measureParams.defaultUnit=e.defaultUnit}getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString();return t=MeasureResultFormat.formatArea(t,this.measureParams),t+=MeasureResultFormat.getPostFix(e,!0),`${BimfaceLanguage.bf_panel_measure_spatial_area}:`+t}select(){super.select(),this.notation.select(),this.points.forEach((e=>{e.object3D.visible=!0})),this.unselectPoints.forEach((e=>{e.object3D.visible=!1})),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}unselect(){super.unselect(),this.notation.unselect(),this.points.forEach((e=>{e.object3D.visible=!1})),this.unselectPoints.forEach((e=>{e.object3D.visible=!0})),this.object3D.updateMatrixWorld(),this.viewer.getViewer().render()}updateScaleFactor(e){let t,i;e?(t=e.cameraPosition,i=e.cameraDirection):(t=this.getCloudViewer().camera.position.clone(),i=this.getCloudViewer().camera.target.clone().sub(this.getCloudViewer().camera.position).normalize()),this.points.forEach((e=>e.updateScaleFactor(t,i))),this.unselectPoints.forEach((e=>e.updateScaleFactor(t,i))),this.updateNotationPosition()}updateNotationPosition(){this.isEndDrawing&&(this.notation.notationSegmentRects=[],this.updateNotationPositionFun(this.notationGroup,[this.measurePoints[this.measurePoints.length-1],this.measurePoints[this.measurePoints.length-1]]))}reset(){this.children=[],this.measurePoints=[],this.points=[],this.unselectPoints=[],this.lines=[],this.lastLine=null,this.spaceShape=null,this.triangles=[],this.lastTriangles=null,this.notationGroup.length>0&&(this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear()),this.notationGroup=[],this.object3D.clear()}redo(){this.measurePoints.length>0&&(this.measurePoints.length<=1&&this.reset(),this.remove(this.points[this.points.length-1]),this.remove(this.lines[this.lines.length-1]),this.lines.pop(),this.points.pop(),1===this.points.length&&(this.remove(this.lastLine),this.remove(this.spaceShape),this.detach(this.notationGroup),this.notationGroup=[],this.notation.clear(),this.spaceShape=null,this.lastLine=null)),super.redo()}}class MeasureItemManager{constructor(e,t,i){this.domContainer=e,this.viewer=t,this.measure=i,this.viewId=0,this.itemList=[],this.mapMeasureInfo={},this.initShadowManager(),this.drawableFactory=new MeasureItemFactory(t,i),this.hookViewer3DEvents(),this.controlObj={[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Distance]:MeasureDistanceControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance]:MeasureMinimumDistanceControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Angle]:MeasureAngleControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Elevation]:MeasureElevationControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Volume]:MeasureVolumeControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance]:MeasureLaserClearDistanceControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.Slope]:MeasureSlopeControl,[Glodon.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea]:MeasureSpatialAreaControl}}hookViewer3DEvents(){this.selectionControl=new SelectionControl(this.domContainer,this.itemList,this),this.selectionControl.selectionChanged=e=>{if(e){let t=this.mapMeasureInfo[e.getId()];if(t.type=e.getType(),this.eventListener.fireEvent("MeasureSelected",t),this.bringToFront(e),this.itemClickCallback){let t=this.mapMeasureInfo[e.getId()];this.itemClickCallback(t)}}else this.eventListener.fireEvent("MeasureUnselected",{})},this.selectionControl.hoverChanged=e=>{e?(this.measure.disableMeasureCursor(),this.measure.setIsEnableSnap(!1)):e&&!this.measure.isMeasureOpen()||(this.measure.enableMeasureCursor(),this.measure.setIsEnableSnap(!0))},this.viewer.addEventListener("Rendered",(()=>{this.update(),this.selectionControl&&this.selectionControl.measureUpdateManage.update()})),document.addEventListener("keyup",(e=>{if(46===e.keyCode){let e=this.selectionControl.getSelectedItem();e&&(this.eventListener.fireEvent("MeasureSelected",{type:e.getType(),isDataEmpty:!0}),this.removeItemById(e.getId()),this.selectionControl.setSelectedItem(null))}})),(!this.isViewer3D()||this.measure._opt.isCreateByUI)&&this.viewer.addEventListener("ButtonOnToolbarClicked",(e=>{if("LeftSubToolbar"===e.id&&(this.selectionControl.setSelectedItem(null),this.showExclusiveByViewId(e.viewId),this.viewId=e.viewId),"Measure"===e.id){let t=this.selectionControl.getSelectedItem();if(e.isChecked){if(this.showAll(),t){let e=this.mapMeasureInfo[t.getId()];e.type=t.getType(),t&&t.actionWhenSelected(),this.eventListener.fireEvent("MeasureSelected",e)}}else this.hideAll(),t&&t.actionWhenUnselected()}}))}addItem(e){let t=e.type,i=e.id;if(this.mapMeasureInfo[i])return;this.mapMeasureInfo[i]=e,e.filterUrl=this.dropShadowManager.getFilterUrl();const n=this.measure.getMeasureParams();for(let t in n)e.hasOwnProperty(t)||(e[t]=n[t]);if(this.isViewer3D())return this.measure.measureItem.setData(e),this.measure.measureItem.endDraw(),this.measure.measureItem.select(),this.selectionControl.setSelectedItem(this.measure.measureItem),void(n.minimumDistanceZoom&&"MinimumDistance"===t&&this.viewer.getCamera().zoomToBoundingBox(e.boundingBox));let o=this.drawableFactory.make(t,e,i,this.measure);"ViewerDrawing"===this.viewer.getViewerType()&&o.setViewId&&o.setViewId(this.viewId),o.attach(this.domContainer),o.select(),this.selectionControl.setSelectedItem(o),this.itemList.push(o)}removeItemById(e){this.mapMeasureInfo[e]&&(this.isViewer3D()&&this.measure.measureHelper.removeById(e),delete this.mapMeasureInfo[e]);for(var t=0;t<this.itemList.length;t++)if(this.itemList[t].getId()===e){this.itemList[t].clear(!0),this.itemList.splice(t,1);break}}removeItemsByType(e){if(this.isViewer3D())return this.measure.measureHelper.children.map((t=>{t.type==e&&delete this.mapMeasureInfo[t.id]})),void this.measure.measureHelper.removeByType(e);for(var t=0;t<this.itemList.length;t++)this.itemList[t].type===e&&(this.mapMeasureInfo[this.itemList[t].id]&&delete this.mapMeasureInfo[this.itemList[t].id],this.itemList[t].clear(!0),this.itemList.splice(t,1))}update(){this.clear();for(const e of this.itemList)e.initialize(),e.attach(this.domContainer),e.dropShadow(this.dropShadowManager.getFilterUrl());this.selectionControl.hasSelected()&&!this.isViewer3D()&&this.selectionControl.getSelectedItem().select()}clear(e){for(const t of this.itemList)t.clear(e);e&&(this.itemList.length=0,this.selectionControl.setSelectedItem(null),this.eventListener.fireEvent("MeasureUnselected",{}),this.mapMeasureInfo={}),e&&this.isViewer3D()&&this.measure.measureHelper.removeAllDrawFinished()}unselctedAll(){for(const e of this.itemList)e.unselect();this.isViewer3D()&&this.measure.measureHelper.unselctedAll(),this.selectionControl.selectedItem=null}isViewer3D(){return"Viewer3D"==this.measure._opt.viewer.viewerType}hideAll(){for(const e of this.itemList)e.measureSurfaceMesh&&e.measureSurfaceMesh.hide();this.domContainer.style.display="none",this.isViewer3D()&&this.measure.measureHelper.hideAll()}showAll(){for(const e of this.itemList)e.measureSurfaceMesh&&e.measureSurfaceMesh.show();this.domContainer.style.display="block",this.update(),this.isViewer3D()&&this.measure.measureHelper.showAll()}onClick(e){e&&(this.itemClickCallback=e)}save(){let e=[],t=Object.keys(this.mapMeasureInfo);for(const i of t)e.push(this.mapMeasureInfo[i]);return e}load(e){for(var t=0;t<e.length;t++){var i=e[t];this.isViewer3D()?this.addMeasureControl(i):this.addItem(i)}this.unselctedAll()}addMeasureControl(e){let t=e.type,i=e.id;if(this.mapMeasureInfo[i])return;this.mapMeasureInfo[i]=e;const n=this.measure.getMeasureParams();for(let t in n)e.hasOwnProperty(t)||(e[t]=n[t]);var o=Object.assign({measure:this.measure,helper:this.measure.measureHelper},this.measure._opt),s=new this.controlObj[t](o);s.initByData(e),this.measure.measureHelper.add(s)}setEventListener(e){this.eventListener=e,this.eventListener.addEvent("Measuring",(()=>{this.selectionControl.setSelectedItem(null),this.setIsEnableSelection(!1)})),this.eventListener.addEvent("Measured",(()=>{this.setIsEnableSelection(!0)})),this.eventListener.addEvent("Reset",(()=>{this.setIsEnableSelection(!0)})),this.eventListener.addEvent("MeasureParamsUpdated",(()=>{this.measure.measureItem&&this.measure.measureItem.setMeasureParams(this.measure.getMeasureParams());for(const e of this.itemList){let t=this.measure.getMeasureParams(e.type);e.setMeasureParams(t),this.mapMeasureInfo[e.id].precision=t.precision,this.mapMeasureInfo[e.id].scale=t.scale,this.mapMeasureInfo[e.id].unit=t.unit,this.mapMeasureInfo[e.id].enableAuxiliaryValue=t.enableAuxiliaryValue||!1,this.mapMeasureInfo[e.id].laserXYZ=t.laserXYZ,this.mapMeasureInfo[e.id].minimumDistanceZoom=t.minimumDistanceZoom}if(this.isViewer3D()&&this.measure.measureHelper.children.map((e=>{if(e.isEndDrawing){let t=this.measure.getMeasureParams(e.type);e.setMeasureParams(t),this.mapMeasureInfo[e.id].precision=t.precision,this.mapMeasureInfo[e.id].scale=t.scale,this.mapMeasureInfo[e.id].unit=t.unit,this.mapMeasureInfo[e.id].enableAuxiliaryValue=t.enableAuxiliaryValue||!1,this.mapMeasureInfo[e.id].laserXYZ=t.laserXYZ,this.mapMeasureInfo[e.id].minimumDistanceZoom=t.minimumDistanceZoom,e.updateResult()}})),this.update(),this.selectionControl.hasSelected()){let e=this.selectionControl.getSelectedItem(),t=this.mapMeasureInfo[e.getId()];t.type=e.getType(),this.eventListener.fireEvent("MeasureSelected",t)}}))}bringToFront(e){if(!this.isViewer3D()){for(var t=0;t<this.itemList.length;t++)if(this.itemList[t].getId()===e.getId()){this.itemList.splice(t,1);break}e.detach(),this.itemList.push(e),e.attach(this.domContainer)}}initShadowManager(){this.dropShadowManager=new DropShadow({filterId:"dropShadow",filterUnits:"userSpaceOnUse",stdDeviation:"2",feOffset1:{dx:5,dy:5},feOffset2:{dx:-5,dy:-5},opacity:"0.3"}),this.dropShadowManager.attach(this.domContainer)}getSelectedItem(){return this.selectionControl.getSelectedItem()}showExclusiveByViewId(e){for(const t of this.itemList)t.getViewId()===e?t.show():t.hide()}setIsEnableSelection(e){this.selectionControl.setIsEnableSelection(e)}}class MeasureHelper{constructor(e){this.group=new CLOUD.ObjectGroup,this.children=[],this.name="MeasureHelper",this.viewer=e,this.viewer.registerEventListener(CLOUD.EVENTS.ON_CAMERA_CHANGED_AND_RENDERED,this.cameraChangedUpdate.bind(this)),this.updateFun=this.updateMaterialResolution.bind(this),window.addEventListener("resize",this.updateFun)}cameraChangedUpdate(){const e=this.viewer.camera.target.clone().sub(this.viewer.camera.position).normalize(),t=this.viewer.camera.position.clone(),i=this.viewer.camera.fov;this.group.dispatchEvent({type:"CameraChanged",cameraDirection:e,cameraPosition:t,cameraFov:i})}add(e){this.children.push(e),this.group.add(e.object3D)}remove(e){for(let t=0;t<this.children.length;t++)if(this.children[t]===e){this.group.remove(e.object3D),e.destroy(),this.children.splice(t,1);break}}removeAllDrawFinished(){for(let e=0;e<this.children.length;e++)this.children[e].isEndDrawing&&(this.group.remove(this.children[e].object3D),this.children[e].destroy(),this.children.splice(e--,1));this.viewer.render()}removeNotDrawingFinished(){for(let e=0;e<this.children.length;e++)this.children[e].isEndDrawing||(this.group.remove(this.children[e].object3D),this.children[e].destroy(),this.children.splice(e--,1));this.viewer.render()}removeById(e){for(let t=0;t<this.children.length;t++)if(this.children[t].id==e){this.group.remove(this.children[t].object3D),this.children[t].destroy(),this.children.splice(t,1);break}this.viewer.render()}removeByType(e){for(let t=0;t<this.children.length;t++)this.children[t].isEndDrawing&&this.children[t].type==e&&(this.group.remove(this.children[t].object3D),this.children[t].destroy(),this.children.splice(t--,1));this.viewer.render()}showAll(){this.group.visible=!0,this.viewer.render(),this.showLaserClearDistance()}showLaserClearDistance(){this.children.map((e=>{e.isEndDrawing&&"LaserClearDistance"==e.type&&e.showNextButton()}))}hideAll(){this.group.visible=!1,this.viewer.render(),this.hideLaserClearDistance()}hideLaserClearDistance(){this.children.map((e=>{e.isEndDrawing&&"LaserClearDistance"==e.type&&e.hideNextButton()}))}hitTest(e,t){var i=new THREE.Vector2(e.x,e.y),n=this.viewer.cameraControl.getRaycaster(i.x,i.y);let o=n.ray.origin.clone(),s=n.ray.direction.clone();return n.set(o,s),this.children.find((e=>e.hitTest(n,t)))}hitTestPoint(e,t){var i=new THREE.Vector2(e.x,e.y),n=this.viewer.cameraControl.getRaycaster(i.x,i.y);let o=n.ray.origin.clone(),s=n.ray.direction.clone();return n.set(o,s),this.children.find((e=>e.hitTestPoint(n,t)))}unselctedAll(){this.children.map((e=>e.isEndDrawing&&e.unselect()))}updateMaterialResolution(){this.children.map((e=>{e.isEndDrawing&&e.children.map((e=>{e.updateMaterialResolution()}))}))}destroy(){for(;this.children.length>0;)this.children[0].destroy(),this.group.remove(this.children[0].object3D),this.children.splice(0,1);this.viewer.render(),window.removeEventListener("resize",this.updateFun)}}!function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=null,n=null,o=[],s=null,r=null,a=[],l=function(e){var i=e.viewer,n=this,o=new Glodon$1.Web.Lang.EventManager,s=t.create("div","bf-measure-conext");n.isOpen=!1,this.initialElevation=e.initialElevation,i.addEventListener("Rendered",(function(){n.isOpen&&n.update()})),this.measureHelper=new MeasureHelper(i.getViewer()),i.getViewer().getInteractionScene().add(this.measureHelper.group),i.addEventListener("MiniMapOperate",(()=>{this.measureHelper.cameraChangedUpdate()})),this.controlObj={[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Distance]:MeasureDistanceControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance]:MeasureMinimumDistanceControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Angle]:MeasureAngleControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Elevation]:MeasureElevationControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume]:MeasureVolumeControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance]:MeasureLaserClearDistanceControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Slope]:MeasureSlopeControl,[Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea]:MeasureSpatialAreaControl},this._measureItemMap={},this.context={rootDomElement:s},this._opt=e,this.getEventManager=function(){return o},this.isEnableSnap=!0,this._p1=new THREE.Vector3,this._p2=new THREE.Vector3;var r=i.getViewer();r.registerEventListener(CLOUD$1.EVENTS.ON_MEASURE_PICK,(function(e){n.isOpen&&n.measureByPoint(e)})),r.registerEventListener(CLOUD$1.EVENTS.ON_VOLUME_MEASURE_END,(function(e){n.isOpen&&n.measureByPoint(e)})),r.registerEventListener(CLOUD$1.EVENTS.ON_MEASURE_RESET,(function(e){if(n.isOpen){if(n.measureItem.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea&&n.measureItem&&n.measureItem.getPoints().length>2)return void n.measureByInfo(n.getInfo());n.measureItem.reset(),n.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset)}}))};l.prototype={init:function(){var e=this.context,i=this._opt.viewer;i.getDomElement().appendChild(e.rootDomElement);var n=t.createNS("svg","bf-measure-svg"),o=t.createNS("svg","bf-measure-svg");this.measureHelper.svgContainer=o;var s=t.create("div","bf-measure-text");e.rootDomElement.innerHTML="",e.rootDomElement.appendChild(n),e.rootDomElement.appendChild(o),this.drawableManager=new MeasureItemManager(o,i,this),this.drawableManager.setEventListener(this.getEventManager()),this.switchOn(),e.svg=n,e.text=s,i.render()},enableMeasureCursor(){this._opt.viewer.getDomElement().style.cursor=`url(${Cursor.measure}),auto`},disableMeasureCursor(){this._opt.viewer.getDomElement().style.cursor=""},hideDragButton(){!Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()&&this.measureItem&&this.measureItem.hideDragButton&&this.measureItem.hideDragButton()},activeByMeasureType:function(){Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()||(this.drawableManager.clear(!0),this.measureHelper.removeAllDrawFinished()),this.enableMeasureCursor();let e=this._opt.viewer.getViewer();if(this.type===Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume?(e.editorManager.disableTool(CLOUD$1.EditToolMode.PICK_BY_MEASURE),e.editorManager.enableTool(e,CLOUD$1.EditToolMode.VOLUME_MEASURE)):(e.editorManager.disableTool(CLOUD$1.EditToolMode.VOLUME_MEASURE),e.editorManager.enableTool(e,CLOUD$1.EditToolMode.PICK_BY_MEASURE)),this._measureItemMap[this.type])this.measureItem=this._measureItemMap[this.type];else{let e=new Glodon$1.Bimface.Plugins.Measure.MeasureItemConfig;e=Object.assign(e,this._opt,this.getMeasureParams()),e.measure=this,e.measureType=this.type,e.helper=this.measureHelper,this.measureItem=new this.controlObj[this.type](e),this.measureHelper.removeNotDrawingFinished(),this.measureHelper.add(this.measureItem)}},switchOn:function(){this.isOpen||(this.activeByMeasureType(),this.isOpen=!0,this.drawableManager.setIsEnableSelection(!0),this.context.rootDomElement.setAttribute("style","display: block"),this.context.rootDomElement.addClass("bf-measure-conext-open"),this.measureHelper.showAll())},switchOff:function(){if(this.isOpen){this.hideDragButton();var e=this,t=e._opt.viewer.getViewer();this.disableMeasureCursor(),t.editorManager.disableTool(CLOUD$1.EditToolMode.PICK_BY_MEASURE),t.editorManager.disableTool(CLOUD$1.EditToolMode.VOLUME_MEASURE),e.reset(),e.measureItem=null,this.isOpen=!1,this.drawableManager.setIsEnableSelection(!1)}},measureByPoint:function(e){var t=this,l=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop(),h=t.measureItem;if(e){i=e.pickPoint?e.pickPoint:null,e.pointType?s=e.pointType:e.pickPlane?(s="Panel",r=e.normal):e.pickLine?(s="Line",o=e.pickLine):s=e.pickPoint?"Point":null;var d=this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume;if(e.pick&&e.pickPoint||d){var c=this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Elevation,u=this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance;const i=this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance;if(c)h.redo(),h.addPoint(e.pickPoint),h.draw(this.context);else if(u&&e.userId&&e.modelId){const t=this.drawableManager.selectionControl.selectedItem;t&&t.name!==this.type&&this.drawableManager.selectionControl.setSelectedItem(null),h.addPoint({userId:e.userId,modelId:e.modelId})}else{if(!(!u||e.userId&&e.modelId))return void t.update();if(d&&e.objectId){for(let t in this.drawableManager.mapMeasureInfo){if(this.drawableManager.mapMeasureInfo[t].type!==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume)continue;let i=this.drawableManager.mapMeasureInfo[t].points[0];if(i.modelId===e.modelId&&i.userId===e.objectId){this.drawableManager.removeItemById(t);break}}this.volumeResult=e.volume,this.volumePosition=e.position,h.addPoint({userId:e.objectId,modelId:e.modelId})}else if(i)e.userId&&h.addPoint({componentId:e.userId,modelId:e.modelId,point:e.pickPoint});else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Slope){if(!e.pickPlane)return void t.update();h.addPoint({normal:e.normal,point:e.pickPoint})}else this.type,Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea,h.addPoint(this.context.footPoint?n:e.pickPoint),t.update()}var p=h.getPoints();a=h.getPoints(),p.length==h.maxPointsNum?this.measureByInfo(this.getInfo()):(l||(this.drawableManager.clear(!0),this.measureHelper.removeAllDrawFinished()),t.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measuring,t.getInfo()))}else this.isEnableSnap&&t.update()}},measureByInfo(e){const t=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();t?e.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance&&this.drawableManager.removeItemsByType(Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance):(this.drawableManager.clear(!0),this.measureHelper.removeAllDrawFinished()),this.drawableManager.addItem(e),t||this.drawableManager.unselctedAll(),this.measureItem.setIsReserverd(!0),this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measured,e);let i=new Glodon$1.Bimface.Plugins.Measure.MeasureItemConfig;i=Object.assign(i,this._opt,this.getMeasureParams()),i.measure=this,i.measureType=this.type,i.helper=this.measureHelper,this.measureItem=new this.controlObj[this.type](i),this.measureHelper.removeNotDrawingFinished(),this.measureHelper.add(this.measureItem)},measureMinimum:function(){},reset:function(){this.isOpen&&(this.measureItem.reset(),this.context.svg.innerHTML="",this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset))},measuringRedo(){this.redo(),this.getInfo().points&&!this.getInfo().points.length&&this.drawableManager.setIsEnableSelection(!0)},measuredRedo(e){if(this.isOpen){const t=this._opt.viewer,i=t.getSelectedComponents();if(this.measureItem.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance||this.measureItem.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume){const n=a.map((e=>e.userId)),o=i.reduce(((e,t)=>(n.includes(t)||e.push(t),e)),[]);o.length?(t.removeSelectedId(o),t.render()):(t.clearSelectedComponents(),e&&e())}else i.length?(t.clearSelectedComponents(),t.render()):e&&e()}},setIsEnableSnap:function(e){e||(this.context.svg.innerHTML=""),this.isEnableSnap=e},update:function(){var e=this.measureItem,t=this.context,a=this._opt.viewer,l=a.getDomElement(),h=l.getBoundingClientRect(),d=a.getViewer(),c=e.getPoints(),u=[],p=[];if(t.svg.innerHTML="",t.footPoint=null,i?(t.worldPosition=a.globalUnitUtil.revertTranslate(i,["x","y","z"]),t.hoverPosition=d.worldToCanvas(i),t.hoverPositionDS=d.getScene().worldToDrawing(i),0!=c.length&&(u=c.concat([i]))):(t.hoverPosition=null,0!=c.length&&(u=c.concat(c[c.length-1]))),t.hoverObjectType=s,"Line"==s&&2==o.length){t.lineStartPoint=d.worldToCanvas(o[0]),t.lineEndPoint=d.worldToCanvas(o[1]);var g=new THREE.Vector2(t.lineStartPoint.x,t.lineStartPoint.y),m=new THREE.Vector2(t.lineEndPoint.x,t.lineEndPoint.y),f=new THREE.Box2;f.min.set(l.clientLeft,l.clientTop),f.max.set(f.min.x+l.clientWidth,f.min.y+l.clientHeight);var w=!f.containsPoint(g),v=!f.containsPoint(m),y={start:g,end:m},b=CLOUD$1.CameraUtil.lineIntersectWithRect(y,f);if(w&&v)2==b.length&&(t.lineStartPoint=b[0],t.lineEndPoint=b[1]);else if(w||v)for(var E=new THREE.Vector2(t.hoverPosition.x,t.hoverPosition.y),x=w?m.clone():g.clone(),C=x.clone().sub(E).normalize(),M=0;M<b.length;M++){if(x.clone().sub(b[M]).normalize().dot(C)>0){t.lineStartPoint=x,t.lineEndPoint=b[M];break}}let e=c[c.length-1];if(e){const{x:i,y:s}=d.worldToCanvas(e),r=new THREE.Vector2(i,s),l=new THREE.Vector2(t.hoverPosition.x,t.hoverPosition.y);if(r.distanceTo(l)>5){let i=o[0].clone(),s=o[1].clone();const r=i.x-s.x,h=i.y-s.y,d=i.z-s.z;let c=(e.x-i.x)*(i.x-s.x)+(e.y-i.y)*(i.y-s.y)+(e.z-i.z)*(i.z-s.z);c/=Math.pow(r,2)+Math.pow(h,2)+Math.pow(d,2);let u=new THREE.Vector3(i.x+c*r,i.y+c*h,i.z+c*d),p=a.worldToClient(u);l.distanceTo(p)<=5&&(t.footPoint=p,t.hoverPosition=p,n=u)}}}if("Panel"==t.hoverObjectType){t.normal=d.getScene().worldToDrawing(r),t.normal.normalize();var P=d.cameraControl,T=new THREE.Plane;T.setFromNormalAndCoplanarPoint(t.normal,t.hoverPositionDS);var I=new THREE.Vector2(t.hoverPosition.x-10,t.hoverPosition.y-10),S=new THREE.Vector2(t.hoverPosition.x+10,t.hoverPosition.y-10),D=t.hoverPositionDS,B=P.getRaycaster(I.x,I.y);if(this._p1=B.ray.intersectPlane(T,this._p1),B=P.getRaycaster(S.x,S.y),this._p2=B.ray.intersectPlane(T,this._p2),null==this._p1||null==this._p2)return this._p1=new THREE.Vector3,void(this._p2=new THREE.Vector3);var A=new THREE.Vector3(1,0,0),_=new THREE.Vector3(0,1,0),L=new THREE.Vector3(0,0,1),k=Math.abs(t.normal.clone().dot(A))<=.0025,R=Math.abs(t.normal.clone().dot(L))<=.0025;if(k&&R)var V=A.clone(),G=L.clone();else V=_.clone().cross(t.normal).normalize(),G=t.normal.clone().cross(V).normalize();var U=this._p1.distanceTo(this._p2)/2,O=V.clone().multiplyScalar(U),H=G.clone().multiplyScalar(U),N=D.clone().sub(O).add(H),$=D.clone().add(O).add(H),z=D.clone().sub(O).sub(H),F=D.clone().add(O).sub(H),W=[];W.push(N,$,F,z);for(var j=[],Z=P.getContainerDimensions(),X=0;X<W.length;X++){var Y=CLOUD$1.CameraUtil.drawingToCanvas(P.camera,W[X],Z.width,Z.height);j.push(new THREE.Vector3(Y.x,Y.y,0))}t.clientPts=j}for(M=0;M<u.length-1;M++){if(te=d.worldPointsToClient(u[M],u[M+1])){var q={x:te.start.x-h.left,y:te.start.y-h.top};p.push(q)}}if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Distance&&c.length==e.maxPointsNum){var K={x:c[1].x,y:c[0].y,z:c[0].z},J={x:c[1].x,y:c[1].y,z:c[0].z},Q=[],ee=[c[0],K,J,c[1]];for(X=0;X<ee.length-1;X++){var te;(te=d.worldPointsToClient(ee[X],ee[X+1]))&&(te.start.x-=h.left,te.start.y-=h.top,te.end.x-=h.left,te.end.y-=h.top),Q.push(te)}t.auxLines=Q}t.clientPoints=p,!this.isSelectItem&&e.draw(t)},getInfo:function(){var e={},t=this.measureItem,i=this._opt.viewer,n=t.getPoints();if(e.type=this.type,e.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.LaserClearDistance&&1===n.length)r&&Object.assign(e,t.computeMeasureResult(r));else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.MinimumDistance){if(2==n.length){var o=i.getMinimumComponentDistanceById(`[${n[0].modelId}]${n[0].userId}`,`[${n[1].modelId}]${n[1].userId}`);e.distance=o.minDistance,e.start=o.start,e.end=o.end,e._start=o.start,e._end=o.end,e._distance=o.minDistance}if(e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"]),this.getMeasureParams().minimumDistanceZoom&&2==n.length){let t=[];t[0]=i.getModel(n[0].modelId).getBoundingBoxById(n[0].userId),t[1]=i.getModel(n[1].modelId).getBoundingBoxById(n[1].userId);let o={x:Math.min(t[0].min.x,t[1].min.x),y:Math.min(t[0].min.y,t[1].min.y),z:Math.min(t[0].min.z,t[1].min.z)},s={x:Math.max(t[0].max.x,t[1].max.x),y:Math.max(t[0].max.y,t[1].max.y),z:Math.max(t[0].max.z,t[1].max.z)},r=new THREE.Vector3(o.x,o.y,o.z),a=new THREE.Vector3(s.x,s.y,s.z);e.boundingBox=(new THREE.Box3).setFromPoints([r,a])}}else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume){let t=i.globalUnitUtil.revertTranslate.bind(i.globalUnitUtil);e.volumeResult=t(t(t(this.volumeResult))),e.volumePosition=t(this.volumePosition),e.notSupport=!this.volumeResult,e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"])}else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Elevation)e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"]),e.points.length>0&&(e.elevation=e.points[0].z-i.globalUnitUtil.excute(this.initialElevation,"m",this.getDefaultUnit())),e.initialElevation=this.initialElevation;else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Slope)if(n[0]){let t;if(0===n[0].normal.x&&0===n[0].normal.y)t=new THREE.Vector3(0,-1,0);else{let e=i.globalUnitUtil.revertVector(n[0].normal,["x","y","z"]).normalize(),o=i.globalUnitUtil.revertVector(n[0].point,["x","y","z"]),s=o.clone().add(e.clone().multiplyScalar(10)),r=o.clone().add(new THREE.Vector3(0,0,-1).clone().multiplyScalar(10));t=(new THREE.Plane).setFromCoplanarPoints(o,s,r).normal.clone().cross(e)}var s=t.angleTo(new THREE.Vector3(0,0,-1));s=s>Math.PI/2?Math.PI/2-(Math.PI-s):Math.PI/2-s;let o=Math.tan(s);o=o>10?9.9999:o,e.point=i.globalUnitUtil.revertVector(n[0].point,["x","y","z"]),e.normal=n[0].normal,e.slopeDir=t,e.slope=(100*o).toFixed(2)}else e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"]);else if(this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea){e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"]);let t=MeasureUtil.calcSpatialArea(e.points);e.area=t}else if(e.points=i.globalUnitUtil.revertTranslate(n,["x","y","z"]),this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Distance)n&&2==n.length&&(e.distanceX=Math.abs(e.points[1].x-e.points[0].x),e.distanceY=Math.abs(e.points[1].y-e.points[0].y),e.distanceZ=Math.abs(e.points[1].z-e.points[0].z),e.distance=Math.sqrt(Math.pow(e.distanceX,2)+Math.pow(e.distanceY,2)+Math.pow(e.distanceZ,2)));else if(3==n.length){var a=new THREE.Vector3(e.points[0].x-e.points[1].x,e.points[0].y-e.points[1].y,e.points[0].z-e.points[1].z),l=new THREE.Vector3(e.points[2].x-e.points[1].x,e.points[2].y-e.points[1].y,e.points[2].z-e.points[1].z),h=a.angleTo(l);e.angle=180*h/Math.PI}return e},redo:function(){this.measureItem.redo(),this.update(),this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measuring,this.getInfo())},exit:function(){this.switchOff(),this.context.rootDomElement.setAttribute("style","display: none"),this.context.rootDomElement.removeClass("bf-measure-conext-open"),this.measureHelper.hideAll()},setInitialElevation(e){"number"==typeof e?this.initialElevation=e:this._opt.viewer.console.warn("The data type of initialElevation is wrong")},getInitialElevation(){return this.initialElevation},isMeasureOpen:function(){return this.isOpen},getDefaultUnit:function(){return this._opt.viewer._defaultUnit},getEngineUnit:function(){return this._opt.viewer.globalUnitUtil.isBimtilesAsset()?"m":this._opt.viewer.globalUnitUtil.getDefaultUnit()}},e.MeasureViewer3D=l}(),function(){var e="Bimface.Plugins.Measure.MeasureDrawing",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){let t=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();this._opt=e,this.isOpen=!1;var i=e.viewer,o=i.getViewer();this.viewer=i,this.viewerDrawing=o,this.domElement=i.getDomElement();var s=new Glodon$1.Web.Lang.EventManager;let r=this;this.getEventManager=function(){return s},i.setSnapDistance(e.snapDistance);let a=n.createNS("svg","bf-measure-svg");a.style.position="absolute",a.style.left=0,a.style.top=0,a.style.width="100%",a.style.height="100%",o.dom.appendChild(a),this.drawableManager=new MeasureItemManager(a,i,this),this.drawableManager.setEventListener(s),i.addEventListener("Measured",(e=>{if(!e)return;t||this.drawableManager.clear(!0),e.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.drawableManager.addItem(e),t||this.drawableManager.unselctedAll();let n=e.type,{type:o,id:s,points:a}=e,l={type:o,id:s,points:a};l[n.toLowerCase()]=e[n.toLowerCase()],l.type=n,r.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measured,l),delete i.isMeasuring})),i.addEventListener("Measuring",(e=>{t||this.drawableManager.clear(!0),e.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),r.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measuring,e),i.isMeasuring=!0})),i.addEventListener("Reset",(()=>{this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset),delete i.isMeasuring}))};o.prototype={init:function(i){t.send(e,"init");i&&(this._callback=i),this.switchOn()},activeByMeasureType:function(){Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()||this.drawableManager.clear(!0);let e=this.viewerDrawing.mouseEditorMgr,t={color:`#${this._opt.color.getHEX()}`};this.type===Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.PolylineDistance&&(t.measureResultFormat=MeasureResultFormat,t.measure=this,t.totalLengthText=BimfaceLanguage.bf_panel_measure_total_distance),e.activeEditorByName(`${this.type}Measure`,t)},switchOn:function(){t.send(e,"switchOn"),this.isOpen||(this.isOpen=!0,this.enableMeasureCursor(),this.activeByMeasureType(),this.drawableManager.setIsEnableSelection(!0))},enableMeasureCursor:function(){this.domElement.firstElementChild.style.cursor=`url(${Cursor.measure}),auto`},enableOcclusionCursor:function(){this.domElement.firstElementChild.style.cursor=`url(${Cursor.occlusion}),auto`},disableMeasureCursor:function(){this.domElement.firstElementChild.style.cursor=""},switchOff:function(){t.send(e,"switchOff"),this.isOpen&&(this.isOpen=!1,this.disableMeasureCursor(),this.measureItem=null,this.viewerDrawing.mouseEditorMgr.editors.forEach((e=>{e.auxMobileMeasureTool&&(e.auxMobileMeasureTool.center=null)})),this.viewerDrawing.mouseEditorMgr.activeEditorByName("pick"),this.drawableManager.setIsEnableSelection(!1))},reset:function(){t.send(e,"reset");var i=this.viewerDrawing.mouseEditorMgr.getEditor();i.reset&&i.reset(),this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset),this.viewerDrawing.update()},update:function(){t.send(e,"update")},exit:function(){t.send(e,"exit"),this.switchOff()},isMeasureOpen:function(){return this.isOpen},setIsEnableSnap:function(e){let t=this.viewerDrawing.mouseEditorMgr.getEditor();t.setIsEnableSnap&&t.setIsEnableSnap(e)},getDefaultUnit:function(){return null}},i.MeasureDrawing=o}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e),this.measureEnd=!1,this.maxPointsNum=1/0,this.minPointsNum=2});e.Type.inheritPrototype(i,t.MeasureItem);var n={reset:function(){if(this.measurePoints=[],this.measureEnd=!1,this.maxPointsNum=1/0,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}},addPoint:function(e){if(this.hoverPositionUpdated=!1,!0!==this.measureEnd||this.measurePoints.length==this.maxPointsNum){if(this.measurePoints.length==this.maxPointsNum)this.reset();else if(this.measurePoints.length>0){let t=this.measurePoints.length,i=this.measurePoints[t-1];if(e.x===i.x&&e.y===i.y&&e.z===i.z)return}this.measurePoints.push(e),this.setIsReserverd(!1)}else this.maxPointsNum=this.measurePoints.length},draw:function(e,t){if(this.measureResult=t,this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(e.clientPoints.length){case 0:break;case 1:this.getMeasureResult();this.drawTerminalPoint(e.clientPoints[0]),e.hoverPosition&&this.drawLine([e.clientPoints[0],e.hoverPosition]),this.drawNotations();break;default:for(let t=1;t<e.clientPoints.length;t++)this.drawTerminalPoint(e.clientPoints[t-1]),this.drawLine([e.clientPoints[t-1],e.clientPoints[t]]),this.drawTerminalPoint(e.clientPoints[t]),e.hoverPosition&&t==e.clientPoints.length-1&&this.drawLine([e.clientPoints[t],e.hoverPosition]);this.drawNotations()}},drawNotations(){let e=[...this.measurePoints];this.hoverPositionUpdated&&this.nextMeasurePoint&&e.push(this.nextMeasurePoint);const t=e.length,i=this.getMeasureResult();for(let n=1;n<t;n++){let t={x:(e[n].x+e[n-1].x)/2,y:(e[n].y+e[n-1].y)/2,z:(e[n].z+e[n-1].z)/2},o=this.viewer.worldToClient(t);this.viewer.isInViewFrustum(t)&&this.drawNotation([o,o],i.distance[n-1])}let n={x:e[t-1].x,y:e[t-1].y,z:e[t-1].z},o=this.viewer.worldToClient(n);this.viewer.isInViewFrustum(n)&&this.drawNotation([o,o],`总长度:${i.totalDistance}`,!0),this.notation.dropShadow(this.filterUrl)},getMeasureResult(){let e=this.measureParams.unit,{distance:t,totalDistance:i}=this.measureResult,n=[],o=0;return t.forEach((t=>{o+=t;let i=t.toString();i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n.push(i)})),o=o.toString(),o=MeasureResultFormat.formatDistance(o,this.measureParams),o+=MeasureResultFormat.getPostFix(e,!1),{distance:n,totalDistance:o}}};i.prototype=Object.assign(i.prototype,n),t.MeasurePolylineDistanceItem=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),n=function(e){t.MeasureItem.call(this,e),this.viewer=e.viewer,this.maxPointsNum=1;var n=new Glodon$1.Web.Graphics.Color(17,218,183,.2),o=i.createNS("circle","bf-measure-handle");o.setAttribute("r",e.width),o.setAttribute("fill",n.getRGB()),o.style.fill=n.getRGB();var s=i.createNS("line","bf-measure-line");s.style.strokeWidth=2,s.style.stroke=n.getRGB();var r=i.createNS("polygon","bf-measure-rect");r.setAttribute("fill",n.getRGBA()),r.setAttribute("stroke",n.getRGB()),r.setAttribute("stroke-width",1),this.hoverLine=s,this.hoverPoint=o,this.hoverPanel=r,this.hoverPanelSize={width:20,height:20}};e.Type.inheritPrototype(n,t.MeasureItem);n.prototype=Object.assign(n.prototype,{draw:function(e){this.drawCaptureItem(e)}}),t.MeasurePositionItem=n}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e)});e.Type.inheritPrototype(i,t.MeasureItem);var n={draw:function(e,t){const i=this.measurePoints,n=this.nextMeasurePoint;if(this._svg=e.svg,this.measureResult={distance:t.distance,horizontalDistance:t.horizontalDistance,verticalDistance:t.verticalDistance},this.drawCaptureItem(e),this.getIsReserverd()||0==i.length)return;let o=i.concat([n]),s=this.getMeasureResult(),r=this.calcLine(o[0],o[1]);if(this.drawTerminalPoint(r[0]),this.drawBorderlineByPoints(o,s.distance),o[0].z!=o[1].z){let e=o[0].z<o[1].z?o[0]:o[1],t=o[0].z<o[1].z?o[1]:o[0],i=this.calcTrianglePoint(o);this.drawBorderlineByPoints([e,i],s.verticalDistance),this.drawBorderlineByPoints([t,i],s.horizontalDistance)}else this.drawBorderlineByPoints([o[0],o[0]],s.horizontalDistance)},calcTrianglePoint(e){if(e.length<2)return null;let t=new THREE.Vector3;return e[0].z<e[1].z?t.set(e[0].x,e[0].y,e[1].z):e[0].z>e[1].z&&t.set(e[1].x,e[1].y,e[0].z),t},drawBorderlineByPoints(e,t){let i=e[0],n=e[1],o=this.calcLine(i,n);this.drawLine(o);let s={x:(i.x+n.x)/2,y:(i.y+n.y)/2,z:(i.z+n.z)/2},r=this.viewer.worldToClient(s);this.viewer.isInViewFrustum(s)&&this.drawNotation([r,r],t)},drawNotation:function(e,t){if(0===e.length)return;let i=this.notation.drawAnnotation({x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},t,this.id);for(const e of i)this._svg.appendChild(e)},getMeasureResult:function(){const e=this.measureParams.unit;let{distance:t,horizontalDistance:i,verticalDistance:n}=this.measureResult;return t=t.toString(),t=MeasureResultFormat.formatDistance(t,this.measureParams),t+=MeasureResultFormat.getPostFix(e,!1),i=i.toString(),i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(e,!1),n=n.toString(),n=MeasureResultFormat.formatDistance(n,this.measureParams),n+=MeasureResultFormat.getPostFix(e,!1),{distance:t,horizontalDistance:i,verticalDistance:n}}};i.prototype=Object.assign(i.prototype,n),t.MeasureTriangleDistanceItem=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e),this.measureEnd=!1,this.minPointsNum=3,this.maxPointsNum=1/0});e.Type.inheritPrototype(i,t.MeasureItem);var n={addPoint:function(e){if(!0!==this.measureEnd||this.measurePoints.length==this.maxPointsNum){if(this.measurePoints.length==this.maxPointsNum)this.measureEnd=!1,this.maxPointsNum=1/0,this.measurePoints=[],this.reset();else if(this.measurePoints.length>0){let t=this.measurePoints.length,i=this.measurePoints[t-1];if(e.x===i.x&&e.y===i.y&&e.z===i.z)return}this.measurePoints.push(e),this.setIsReserverd(!1)}else this.maxPointsNum=this.measurePoints.length},reset:function(){if(this.measurePoints=[],this.measureEnd=!1,this.maxPointsNum=1/0,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}},draw:function(e,t){if(this.measureResult=t.area,this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(e.clientPoints.length){case 0:break;case 1:if(e.hoverPosition){let t=MeasureUtil.makeLine({start:e.clientPoints[0],end:e.hoverPosition,color:this.measureItemConfig.color.getRGBA(),lineWidth:this.measureItemConfig.width});e.svg.appendChild(t)}let t=MeasureUtil.makeCircle({strokeWidth:2,color:this.measureItemConfig.color.getRGBA(),radius:5,position:e.clientPoints[0]});t.setAttribute("filter",this.filterUrl),e.svg.appendChild(t);break;default:this.drawArea(e.clientPoints,e.hoverPosition),this.drawNotation(e.hoverPosition,`${this.getNotationTitle()}:${this.getMeasureResult()}`)}},drawArea:function(e,t){const i=t?e.concat(t):e;let n="";i.forEach((e=>{n+=e.x+","+e.y+" "}));let o=MeasureUtil.makePolygon({points:n,width:this.measureItemConfig.width,color:this.measureItemConfig.color.getRGBA(),fillColor:this.measureItemConfig.fillColor.getRGBA()});this._svg.appendChild(o),e.forEach((e=>{let t=MeasureUtil.makeCircle({strokeWidth:2,color:this.measureItemConfig.color.getRGBA(),radius:5,position:e});t.setAttribute("filter",this.filterUrl),this._svg.appendChild(t)}))},drawNotation:function(e,t){let i=this.notation.drawAnnotation({x:e.x,y:e.y},t,this.id,!0);for(const e of i)this._svg.appendChild(e)},getNotationTitle:()=>BimfaceLanguage.bf_tip_measure_spatial_area,getMeasureResult(){let e=this.measureParams.unit,t=this.measureResult.toString();return t=MeasureResultFormat.formatArea(t,this.measureParams),t+=MeasureResultFormat.getPostFix(e,!0),t}};i.prototype=Object.assign(i.prototype,n),t.MeasureSpatialAreaItem=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureSpatialAreaItem.call(this,e)});e.Type.inheritPrototype(i,t.MeasureSpatialAreaItem);let n={getNotationTitle:()=>BimfaceLanguage.bf_tip_measure_projected_area};i.prototype=Object.assign(i.prototype,n),t.MeasureProjectedAreaItem=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureSpatialAreaItem.call(this,e),this.defaultColor=e.color,this.fillColor=e.fillColor,this.borderWidth=e.width,this.measureSurfaceMesh=null});e.Type.inheritPrototype(i,t.MeasureSpatialAreaItem);let n={reset:function(){if(this.measurePoints=[],this.measureEnd=!1,this.maxPointsNum=1/0,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}this.measureSurfaceMesh&&(this.measureSurfaceMesh.dispose(),this.measureSurfaceMesh=null)},draw:function(e,t){if(this.measureResult=t.area,this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(this.measurePoints.length){case 0:this.measureSurfaceMesh&&this.measureSurfaceMesh.dispose();break;case 1:this.drawArea(this.measurePoints,e.hoverPosition),this.drawTerminals(e.clientPoints,e.hoverPosition);break;default:this.drawArea(this.measurePoints,e.hoverPosition),this.drawTerminals(e.clientPoints,e.hoverPosition),this.drawNotation(e.hoverPosition,`${this.getNotationTitle()}:${this.getMeasureResult()}`)}},drawArea(e,t){const i=this.viewer.getDomElement().getBoundingClientRect&&this.viewer.getDomElement().getBoundingClientRect(),n=i?i.x:0,o=i?i.y:0,s={x:t.x+n,y:t.y+o,z:t.z};let r=this.viewer.clientToWorld(s),a=[...e];a.push(r),this.measureSurfaceMesh||(this.measureSurfaceMesh=new MeasureSurfaceAreaMesh({fillColor:new Glodon$1.Web.Graphics.Color(255,157,11,.2),color:new Glodon$1.Web.Graphics.Color(255,157,11,1),width:this.borderWidth})),this.measureSurfaceMesh.setMeasurePoints(a),this.viewer.render()},drawTerminals(e,t){t&&e.concat(t);e.forEach((e=>{let t=MeasureUtil.makeCircle({strokeWidth:2,color:this.measureItemConfig.color.getRGBA(),radius:5,position:e});t.setAttribute("filter",this.filterUrl),this._svg.appendChild(t)}))},getNotationTitle:()=>BimfaceLanguage.bf_tip_measure_surface_area};i.prototype=Object.assign(i.prototype,n),t.MeasureSurfaceAreaItem=i}(),function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),new Glodon$1.Web.Graphics.Color(17,218,183,.2),function(e){t.MeasureItem.call(this,e),this.measureEnd=!1,this.maxPointsNum=1/0,this.minPointsNum=2,this.groundInfos=[],this.mesh=null,this.borderColor=e.color||new Glodon$1.Web.Graphics.Color(255,157,11,1),this.borderWidth=e.width||3,this.groundLineInfos=[],this.lastGroundLineMes={}});e.Type.inheritPrototype(i,t.MeasureItem);var n={reset:function(){if(this.measurePoints=[],this.measureEnd=!1,this.maxPointsNum=1/0,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}this.groundInfos=[],this.groundLineInfos=[],this.clearGroundLine()},redo(){this.measurePoints.length>0&&this.measurePoints.length<this.maxPointsNum?(this.measurePoints.pop(),this.groundLineInfos.pop()):this.measurePoints=[],this.groundInfos=[],this.clearGroundLine()},clear:function(){if(this.measurePoints=[],this.measureEnd=!1,this.maxPointsNum=1/0,this._svg){for(var e=this._svg.childNodes,t=e.length-1;t>-1;t--)this._svg.removeChild(e[t]);this._svg.innerHTML=""}this.groundInfos=[],this.groundLineInfos=[],this.clearGroundLine()},addPoint:function(e){if(this.hoverPositionUpdated=!1,!0===this.measureEnd&&this.measurePoints.length!=this.maxPointsNum)return this.maxPointsNum=this.measurePoints.length,this.groundInfos.length==this.measurePoints.length&&this.groundInfos.pop(),void this.clearGroundLine();if(this.measurePoints.length==this.maxPointsNum)this.reset();else if(this.measurePoints.length>0){let t=this.measurePoints.length,i=this.measurePoints[t-1];if(e.x===i.x&&e.y===i.y&&e.z===i.z)return}this.measurePoints.push(e),this.setIsReserverd(!1),this.measurePoints.length>1&&this.groundLineInfos.push(this.calculateGroundlineDistance(this.measurePoints[this.measurePoints.length-2],this.measurePoints[this.measurePoints.length-1]))},updateGroundLine(e){this.groundLine?this.groundLine.geometry.updateGeometry({points:e}):(this.groundLine=CLOUD$1.GroundPrimitiveManager.getInstance().createGroundCurve({points:e,color:this.borderColor,width:this.borderWidth,style:"Continuous",type:"polyline"}),this.groundLine.onAdded()),this.viewer.render()},clearGroundLine(){this.groundLine&&(this.groundLine.onRemoved(),this.groundLine.dispose(),this.groundLine=null)},calculateGroundlineDistance(e,t){if(!e||!t)return null;let i=this.viewer,n=new THREE.Vector3(e.x,e.y,e.z),o=new THREE.Vector3(t.x,t.y,t.z);if(n.equals(o))return null;if(this.lastPoint0&&this.lastPoint1&&n.equals(this.lastPoint0)&&o.equals(this.lastPoint1))return this.lastGroundInfo;let s,r=[];r.push(n),r.push(o),s=new THREE.CatmullRomCurve3(r),s.tension=0,s.type="catmullrom";var a=new CLOUD$1.Raycaster,l=new THREE.Vector3,h=i.getViewer().cameraControl.getIntersectContext(null),d=new CLOUD$1.IntersectHelper(i.getViewer());a.camera=h.camera,a.viewportSize=h.viewportSize;var c=[];s.getPoints(100).forEach((e=>{l.copy(e),(l=i.worldToScene(e)).y=1e4,a.set(l,new THREE.Vector3(0,-1,0));let t=d.getObjectsByRaycaster(h,a,!0);if(t.length>0){let e;e=i.sceneToWorld(t[0].point),c.push(e)}else c.push(e)})),s=null;let u=new Glodon$1.Bimface.Plugins.Geometry.SplineCurve(c);return u.projectToGround(!0),this.lastPoint0=n,this.lastPoint1=o,this.lastGroundInfo={length:u.length,midPoint:u.getPointByParameter(.5),endPoint:u.getPointByParameter(1),status:"finished"},this.lastGroundInfo},draw:function(e,t){if(this._svg=e.svg,this.drawCaptureItem(e),!this.getIsReserverd())switch(e.clientPoints.length){case 0:break;case 1:this.drawTerminalPoint(e.clientPoints[0]),e.hoverPosition&&this.nextMeasurePoint&&this.updateGroundLine([...this.measurePoints,this.nextMeasurePoint]),this.drawNotations();break;default:for(let t=1;t<e.clientPoints.length;t++)this.drawTerminalPoint(e.clientPoints[t-1]),this.drawTerminalPoint(e.clientPoints[t]);this.updateGroundLine([...this.measurePoints,this.nextMeasurePoint]),this.drawNotations()}},drawNotations(){let e=null,t=0,i=[...this.measurePoints,this.nextMeasurePoint];for(let n=0;n<this.groundInfos.length;n++){let o=this.groundInfos[n],s={x:(i[n].x+i[n+1].x)/2,y:(i[n].y+i[n+1].y)/2,z:(i[n].z+i[n+1].z)/2},r=this.viewer.worldToClient(s);this.viewer.isInViewFrustum(s)&&this.drawNotation([r,r],this.formatDistance(o.length)),t+=o.length,n===this.groundInfos.length-1&&(e=i[n+1])}if(e){let i={x:e.x,y:e.y,z:e.z},n=this.viewer.worldToClient(i);this.viewer.isInViewFrustum(i)&&this.drawNotation([n,n],`总长度:${this.formatDistance(t)}`,!0)}this.notation.dropShadow(this.filterUrl)},formatDistance(e){let t=this.measureParams.unit,i=e.toString();return i=MeasureResultFormat.formatDistance(i,this.measureParams),i+=MeasureResultFormat.getPostFix(t,!1),i}};i.prototype=Object.assign(i.prototype,n),t.MeasureGroundlineDistanceItem=i}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=null,n=[],o=null,s=null,r=function(e){this.viewer3D=e.viewer;var i=new Glodon$1.Web.Lang.EventManager,n=t.create("div","bf-measure-conext");this.isOpen=!1,this.context={rootDomElement:n},this._opt=e,this.type=e.measureType,this.getEventManager=function(){return i},this.isEnableSnap=!0,this._p1=new THREE.Vector3,this._p2=new THREE.Vector3};r.prototype={init:function(){var e=this.context,i=this._opt.viewer;i.getDomElement().appendChild(e.rootDomElement);var n=t.createNS("svg","bf-measure-svg"),o=t.createNS("svg","bf-measure-svg"),s=t.create("div","bf-measure-text");e.rootDomElement.innerHTML="",e.rootDomElement.appendChild(n),e.rootDomElement.appendChild(o),this.drawableManager=new MeasureItemManager(o,i,this),this.drawableManager.setEventListener(this.getEventManager()),this._hookEvents(),this.switchOn(),e.svg=n,e.text=s,i.render()},_onViewerRender(){this.isOpen&&this.update()},_onCloudViewerMeasuring(e){this.isOpen&&(this.measureItem.hoverPositionUpdated=!0,this.measureByPoint(e))},_onCloudViewerMeasureReset(e){if(!this.isOpen)return;const t=this.measureItem;this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Position||this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.TriangleDistance||this.type==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Angle||t.getPoints().length<t.minPointsNum?(t.reset(),this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset)):t.getPoints().length!=t.maxPointsNum&&(t.measureEnd=!0,this.measureByPoint(e))},_hookEvents(){const e=this.viewer3D,t=e.getViewer();this._onRenderBinded=this._onViewerRender.bind(this),this._onMeasuringBinded=this._onCloudViewerMeasuring.bind(this),this._onMeasureResetBinded=this._onCloudViewerMeasureReset.bind(this),e.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.Rendered,this._onRenderBinded),t.registerEventListener(CLOUD$1.EVENTS.ON_MEASURE_PICK,this._onMeasuringBinded),t.registerEventListener(CLOUD$1.EVENTS.ON_MEASURE_RESET,this._onMeasureResetBinded)},_unhookEvents(){const e=this.viewer3D,t=e.getViewer();e.removeEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.Rendered,this._onRenderBinded),t.unregisterEventListener(CLOUD$1.EVENTS.ON_MEASURE_PICK,this._onMeasuringBinded),t.unregisterEventListener(CLOUD$1.EVENTS.ON_MEASURE_RESET,this._onMeasureResetBinded)},enableMeasureCursor(){this._opt.viewer.getDomElement().style.cursor=`url(${Cursor.measure}),auto`},disableMeasureCursor(){this._opt.viewer.getDomElement().style.cursor=""},activeByMeasureType:function(){Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop()||this.drawableManager.clear(!0),this.enableMeasureCursor();let e,t=this._opt.viewer.getViewer();this.type===Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume?(t.editorManager.disableTool(CLOUD$1.EditToolMode.PICK_BY_MEASURE),t.editorManager.enableTool(t,CLOUD$1.EditToolMode.VOLUME_MEASURE)):(t.editorManager.disableTool(CLOUD$1.EditToolMode.VOLUME_MEASURE),t.editorManager.enableTool(t,CLOUD$1.EditToolMode.PICK_BY_MEASURE));let i=new Glodon$1.Bimface.Plugins.Measure.MeasureItemConfig;switch(i=Object.assign(i,this._opt,this.getMeasureParams()),this.type){case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Angle:e=new Glodon$1.Bimface.Plugins.Measure.MeasureAngleItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.PolylineDistance:e=new Glodon$1.Bimface.Plugins.Measure.MeasurePolylineDistanceItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Position:e=new Glodon$1.Bimface.Plugins.Measure.MeasurePositionItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.TriangleDistance:e=new Glodon$1.Bimface.Plugins.Measure.MeasureTriangleDistanceItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea:e=new Glodon$1.Bimface.Plugins.Measure.MeasureSpatialAreaItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.ProjectedArea:e=new Glodon$1.Bimface.Plugins.Measure.MeasureProjectedAreaItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SurfaceArea:e=new Glodon$1.Bimface.Plugins.Measure.MeasureSurfaceAreaItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.GroundlineDistance:e=new Glodon$1.Bimface.Plugins.Measure.MeasureGroundlineDistanceItem(i);break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Volume:e=new Glodon$1.Bimface.Plugins.Measure.MeasureVolumeItem(i)}this.measureItem=e},switchOn:function(){this.isOpen||(this.activeByMeasureType(),this.isOpen=!0,this.drawableManager.setIsEnableSelection(!0))},switchOff:function(){if(this.isOpen){var e=this,t=e._opt.viewer.getViewer();this.disableMeasureCursor(),t.editorManager.disableTool(CLOUD$1.EditToolMode.PICK_BY_MEASURE),t.editorManager.disableTool(CLOUD$1.EditToolMode.VOLUME_MEASURE),e.reset(),e.measureItem=null,this.isOpen=!1,this.drawableManager.setIsEnableSelection(!1)}},measureByPoint:function(e){var t=this,r=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop(),a=t.measureItem;e&&(i=e.pickPoint?e.pickPoint:null,e.pointType?o=e.pointType:e.pickPlane?(o="Panel",s=e.normal):e.pickLine?(o="Line",n=e.pickLine):o=e.pickPoint?"Point":null,!e.modelId&&(o=null),e.pick&&e.pickPoint?(a.addPoint(e.pickPoint),a.getPoints().length==a.maxPointsNum?(r||this.drawableManager.clear(!0),this.drawableManager.addItem(this.getInfo(!0,null,!0)),r||this.drawableManager.unselctedAll(),this.measureItem.setIsReserverd(!0),t.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measured,t.getInfo(!0,null,!0)),a.reset()):(r||this.drawableManager.clear(!0),t.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measuring,t.getInfo())),t.update()):this.isEnableSnap&&t.update())},reset:function(){this.isOpen&&(this.measureItem.reset(),this.context.svg.innerHTML="",this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Reset))},setIsEnableSnap:function(e){e||(this.context.svg.innerHTML=""),this.isEnableSnap=e},update:function(){var e=this.measureItem,t=this.context,r=this._opt.viewer,a=r.getDomElement(),l=a.getBoundingClientRect(),h=r.getViewer(),d=e.getPoints(),c=[],u=[];if(this.context.svg.innerHTML="",t.footPoint=null,i?(t.hoverPosition=r.worldToClient(i),t.hoverPositionDS=h.getScene().worldToDrawing(i),e.nextMeasurePoint=i):t.hoverPosition=e.nextMeasurePoint?r.worldToClient(e.nextMeasurePoint):null,0!=d.length&&(c=d.concat([e.nextMeasurePoint])),t.hoverObjectType=o,"Line"==o&&2==n.length){t.lineStartPoint=r.worldToClient(n[0]),t.lineEndPoint=r.worldToClient(n[1]);var p=new THREE.Vector2(t.lineStartPoint.x,t.lineStartPoint.y),g=new THREE.Vector2(t.lineEndPoint.x,t.lineEndPoint.y),m=new THREE.Box2;m.min.set(a.clientLeft,a.clientTop),m.max.set(m.min.x+a.clientWidth,m.min.y+a.clientHeight);var f=!m.containsPoint(p),w=!m.containsPoint(g),v={start:p,end:g},y=CLOUD$1.CameraUtil.lineIntersectWithRect(v,m);if(f&&w)2==y.length&&(t.lineStartPoint=y[0],t.lineEndPoint=y[1]);else if(f||w)for(var b=new THREE.Vector2(t.hoverPosition.x,t.hoverPosition.y),E=f?g.clone():p.clone(),x=E.clone().sub(b).normalize(),C=0;C<y.length;C++){if(E.clone().sub(y[C]).normalize().dot(x)>0){t.lineStartPoint=E,t.lineEndPoint=y[C];break}}let e=d[d.length-1];if(e){const{x:i,y:o}=r.worldToClient(e),s=new THREE.Vector2(i,o),a=new THREE.Vector2(t.hoverPosition.x,t.hoverPosition.y);if(s.distanceTo(a)>5){let i=n[0].clone(),o=n[1].clone();const s=i.x-o.x,l=i.y-o.y,h=i.z-o.z;let d=(e.x-i.x)*(i.x-o.x)+(e.y-i.y)*(i.y-o.y)+(e.z-i.z)*(i.z-o.z);d/=Math.pow(s,2)+Math.pow(l,2)+Math.pow(h,2);let c=new THREE.Vector3(i.x+d*s,i.y+d*l,i.z+d*h),u=r.worldToClient(c);a.distanceTo(u)<=5&&(t.footPoint=u,t.hoverPosition=u)}}}if("Panel"==t.hoverObjectType){t.normal=h.getScene().worldToDrawing(s),t.normal.normalize();var M=h.cameraControl,P=new THREE.Plane;P.setFromNormalAndCoplanarPoint(t.normal,t.hoverPositionDS);var T=new THREE.Vector2(t.hoverPosition.x-10,t.hoverPosition.y-10),I=new THREE.Vector2(t.hoverPosition.x+10,t.hoverPosition.y-10),S=t.hoverPositionDS,D=M.getRaycaster(T.x,T.y);if(this._p1=D.ray.intersectPlane(P,this._p1),D=M.getRaycaster(I.x,I.y),this._p2=D.ray.intersectPlane(P,this._p2),null==this._p1||null==this._p2)return this._p1=new THREE.Vector3,void(this._p2=new THREE.Vector3);var B=new THREE.Vector3(1,0,0),A=new THREE.Vector3(0,1,0),_=new THREE.Vector3(0,0,1),L=Math.abs(t.normal.clone().dot(B))<=.0025,k=Math.abs(t.normal.clone().dot(_))<=.0025;if(L&&k)var R=B.clone(),V=_.clone();else R=A.clone().cross(t.normal).normalize(),V=t.normal.clone().cross(R).normalize();var G=this._p1.distanceTo(this._p2)/2,U=R.clone().multiplyScalar(G),O=V.clone().multiplyScalar(G),H=S.clone().sub(U).add(O),N=S.clone().add(U).add(O),$=S.clone().sub(U).sub(O),z=S.clone().add(U).sub(O),F=[];F.push(H,N,z,$);for(var W=[],j=M.getContainerDimensions(),Z=0;Z<F.length;Z++){var X=CLOUD$1.CameraUtil.drawingToCanvas(M.camera,F[Z],j.width,j.height);W.push(new THREE.Vector3(X.x,X.y,0))}t.clientPts=W}for(C=0;C<c.length-1;C++){var Y=h.worldPointsToClient(c[C],c[C+1]);if(Y){var q={x:Y.start.x-l.left,y:Y.start.y-l.top};u.push(q)}}t.clientPoints=u;let K=this.getInfo(!0,c);e.draw(t,K)},getInfo:function(e,t,i){var n={},o=this.measureItem,s=this._opt.viewer;t=t||o.getPoints();switch(n.type=this.type,n.id=Glodon$1.Web.Lang.Utility.UUID.createUUID(),n.points=t,this.type){case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Angle:if(3==t.length){var r=new THREE.Vector3(t[0].x-t[1].x,t[0].y-t[1].y,t[0].z-t[1].z),a=new THREE.Vector3(t[2].x-t[1].x,t[2].y-t[1].y,t[2].z-t[1].z),l=r.angleTo(a);n.angle=180*l/Math.PI}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Position:if(1==t.length){n.coordinateSystem="GCJ-02";let e=s.worldToLatLon(t[0]);n.lonLat={longitude:e.lon,latitude:e.lat},n.altitude=t[0].z}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.PolylineDistance:if(t&&t.length>=2){let e=t.length;n.distance=[],n.totalDistance=0;for(let i=1;i<e;i++){let e=t[i].distanceTo(t[i-1]);n.distance.push(e),n.totalDistance+=e}}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.GroundlineDistance:if(t&&t.length>=2){n.distance=[],n.totalDistance=0,n.positions=[],n.groundInfos=o.groundInfos,o.lastGroundLineMes.point&&(o.lastGroundLineMes.point.x==o.nextMeasurePoint.x&&o.lastGroundLineMes.point.y==o.nextMeasurePoint.y&&o.lastGroundLineMes.point.z==o.nextMeasurePoint.z?(new Date).getTime()-o.lastGroundLineMes.time>300&&(this.groundLineInfo=o.calculateGroundlineDistance(o.measurePoints[o.measurePoints.length-1],o.nextMeasurePoint)):o.lastGroundLineMes.time=(new Date).getTime()),o.lastGroundLineMes.point=o.nextMeasurePoint,o.groundInfos=this.groundLineInfo&&!o.measureEnd?[...o.groundLineInfos,this.groundLineInfo]:o.groundLineInfos;for(let e=0;e<o.groundInfos.length;e++){let t=o.groundInfos[e];n.distance.push(t.length),n.totalDistance+=t.length;let i={midPoint:t.midPoint,endPoint:t.endPoint};n.positions.push(i)}}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.TriangleDistance:if(2==t.length){n.distance=n.points[0].distanceTo(n.points[1]);let e=t[0].clone(),i=0,o=0;t[0].z<t[1].z?(e.set(t[0].x,t[0].y,t[1].z),i=e.distanceTo(t[1]),o=e.distanceTo(t[0])):t[0].z>t[1].z&&(e.set(t[1].x,t[1].y,t[0].z),i=e.distanceTo(t[0]),o=e.distanceTo(t[1])),Object.assign(n,{horizontalDistance:i,verticalDistance:o})}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea:if(t.length>=3&&e){let e=MeasureUtil.calcSpatialArea(t);Object.assign(n,{area:e})}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.ProjectedArea:if(t.length>=3&&e){let e=MeasureUtil.calcProjectedArea(t);Object.assign(n,{area:e})}break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SurfaceArea:t.length>=3&&e&&(void 0===this.surfaceAreaValue||i?this.surfaceAreaValue=MeasureUtil.calcSurfaceArea(t,s,this.layerType):(this.surfaceAreaLastTime||(this.surfaceAreaLastTime=(new Date).getTime()),(new Date).getTime()-this.surfaceAreaLastTime>=300&&(this.surfaceAreaValue=MeasureUtil.calcSurfaceArea(t,s,this.layerType),this.surfaceAreaLastTime=(new Date).getTime())),Object.assign(n,{area:this.surfaceAreaValue,layerType:this.layerType}))}return n},redo:function(){this.measureItem.redo(),this.update(),this.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureEvent.Measuring,this.getInfo())},exit:function(){this.switchOff(),this._unhookEvents()},isMeasureOpen:function(){return this.isOpen},getDefaultUnit:function(){return"m"},getEngineUnit:function(){return this._opt.viewer.globalUnitUtil.isBimtilesAsset()?"m":this._opt.viewer.globalUnitUtil.getDefaultUnit()}},e.MeasureViewerGIS=r}(),function(){var e="Bimface.Plugins.Measure.Measure",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){var t=e.viewer;if(t){skipVueObserver(this);var o=new Glodon$1.Web.Lang.EventManager,s=n.create("div","bf-measure-conext");this.context={rootDomElement:s},this.id="Measure","ViewerGIS"===t.getViewerType()&&e.measureType==Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Distance&&(e.measureType=Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.PolylineDistance),this._opt=e,this.type=e.measureType,this.layerType=e.layerType,this.getEventManager=function(){return o},"Viewer3D"===t.getViewerType()?(i.MeasureViewer3D.call(this,e),this.inherit(Glodon$1.Bimface.Plugins.Measure.MeasureViewer3D.prototype)):"ViewerGIS"===t.getViewerType()?(i.MeasureViewerGIS.call(this,e),this.inherit(Glodon$1.Bimface.Plugins.Measure.MeasureViewerGIS.prototype)):(i.MeasureDrawing.call(this,e),this.inherit(Glodon$1.Bimface.Plugins.Measure.MeasureDrawing.prototype)),this._setDefaultUnits(e),this._setDefaultPrecisions(e),this.init()}};o.prototype={inherit:function(e){for(var t in e)this[t]=e[t]},addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},_setDefaultUnits:function(e){const t=e.viewer.getViewerType();if(null!=e.lengthUnits&&null==e.units){switch(t){case"Viewer3D":case"ViewerGIS":e.units={distance:e.lengthUnits,elevation:e.lengthUnits,area:e.lengthUnits};break;case"ViewerDrawing":e.units={distance:e.lengthUnits,area:e.lengthUnits}}return}const i=this.getDefaultUnit();"m"===i?e.lengthUnits=Glodon$1.Bimface.Common.Units.LengthUnits.Meter:"mm"===i&&(e.lengthUnits=Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter);const n=e.units&&e.units.distance||e.lengthUnits||Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter,o=e.units&&e.units.distance||e.lengthUnits||Glodon$1.Bimface.Common.Units.LengthUnits.None,s=e.units&&e.units.elevation||Glodon$1.Bimface.Common.Units.LengthUnits.Meter,r=e.units&&e.units.area||Glodon$1.Bimface.Common.Units.LengthUnits.Meter,a=e.units&&e.units.area||e.lengthUnits||Glodon$1.Bimface.Common.Units.LengthUnits.Millimeter,l=e.units&&e.units.area||Glodon$1.Bimface.Common.Units.LengthUnits.None;switch(t){case"Viewer3D":e.units={distance:n,elevation:s,area:a};break;case"ViewerGIS":e.units={distance:n,elevation:s,area:r};break;case"ViewerDrawing":e.units={distance:o,area:l}}},_setDefaultPrecisions:function(e){if("number"==typeof e.precision)e.obsoletePrecision=e.precision,e.precision={distance:e.obsoletePrecision,elevation:e.obsoletePrecision,area:e.obsoletePrecision,angle:e.obsoletePrecision,latLon:e.obsoletePrecision};else{let{distance:t=3,elevation:i=3,area:n=3,angle:o=2,latLon:s=9}=e.precision;e.precision={distance:t,elevation:i,area:n,angle:o,latLon:s}}},getMeasureType:function(){return this.type},setMeasureType:function(i){t.send(e,"setMeasureType"),this.hideDragButton&&this.hideDragButton(),this.type=i,this.reset(),this.activeByMeasureType(),this.getEventManager().fireEvent("typeChange",i)},setPrecision:function(e){"number"==typeof e||"string"==typeof e?(this._opt.obsoletePrecision=e,this._opt.precision={distance:e,elevation:e,area:e,angle:e,latLon:e}):this._opt.precision=Object.assign(this._opt.precision,e),this.getEventManager().fireEvent("MeasureParamsUpdated")},getPrecision:function(){return void 0!==this._opt.obsoletePrecision?this._opt.obsoletePrecision:this._opt.precision},setScale:function(e){this._opt.scale=e,this.getEventManager().fireEvent("MeasureParamsUpdated")},getScale:function(){return this._opt.scale},setLengthUnits:function(e){this._opt.lengthUnits=e;for(const t in this._opt.units)this._opt.units[t]=e;this.getEventManager().fireEvent("MeasureParamsUpdated")},getLengthUnits:function(){return this._opt.lengthUnits},setUnits:function(e){this._opt.units=Object.assign(this._opt.units,e),this.getEventManager().fireEvent("MeasureParamsUpdated")},getUnits:function(){return this._opt.units},getAllItems:function(){return this.drawableManager.save()},setItems:function(e){this.clear(),this.drawableManager.load(e)},clear:function(){this.drawableManager.clear(!0),this.hideDragButton&&this.hideDragButton()},hideAllItems:function(){this.drawableManager.hideAll()},showAllItems:function(){this.drawableManager.showAll()},onClick:function(e){this.drawableManager.onClick(e)},removeSelectedItem:function(){this.drawableManager.unselctedAll()},getSelectedItem:function(){return this.drawableManager.getSelectedItem()},setLayerType:function(e){this.layerType=e},getMeasureParams:function(e){let t={scale:this.getScale(),defaultUnit:this.getDefaultUnit(),laserXYZ:this.getLaserXYZ()};switch(e||this.type){case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Angle:t=Object.assign(t,{precision:this._opt.precision.angle,unit:"°"});break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Elevation:t=Object.assign(t,{precision:this._opt.precision.elevation,unit:this.getUnits().elevation});break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Area:case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SpatialArea:case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.ProjectedArea:case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.SurfaceArea:t=Object.assign(t,{precision:this._opt.precision.area,unit:this.getUnits().area});break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Position:t=Object.assign(t,{precision:{elevation:this._opt.precision.elevation,latLon:this._opt.precision.latLon},unit:this.getUnits().elevation});break;case Glodon$1.Bimface.Plugins.Measure.MeasureTypeOption.Slope:t=Object.assign(t,{unit:"%"});break;default:t=Object.assign(t,{precision:this._opt.precision.distance,unit:this.getUnits().distance,enableAuxiliaryValue:this._opt.enableAuxiliaryValue||!1,minimumDistanceZoom:this.getMinimumDistanceZoom()})}return t},enableAuxiliaryValue(i){t.send(e,"enableAuxiliaryValue"),this._opt.enableAuxiliaryValue=i,this.getEventManager().fireEvent("MeasureParamsUpdated")},isEnableAuxiliaryValue(){return t.send(e,"isEnableAuxiliaryValue"),this._opt.enableAuxiliaryValue},setLaserXYZ(i){t.send(e,"setLaserXYZ"),this._opt.laserXYZ=i,this.getEventManager().fireEvent("MeasureParamsUpdated")},getLaserXYZ(){return this._opt.laserXYZ},setMinimumDistanceZoom(i){t.send(e,"setMinimumDistanceZoom"),this._opt.minimumDistanceZoom=i,this.getEventManager().fireEvent("MeasureParamsUpdated")},getMinimumDistanceZoom(){return this._opt.minimumDistanceZoom}},i.Measure=o}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").MeasureRayConfig=function(){return{viewer:null,targetsHintColor:new Glodon$1.Web.Graphics.Color(245,127,35,.6)}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure").MeasureRayItemConfig=function(){return{id:null,color:new Glodon$1.Web.Graphics.Color(245,127,35,1),width:2,startPoint:new Glodon$1.Web.Geometry.Point3d(0,0,0),endPoint:new Glodon$1.Web.Geometry.Point3d(0,0,0),startObjectId:null,endObjectId:null}},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=function(e){this.id=e.id||Glodon$1.Web.Lang.Utility.UUID.createUUID();this.startPoint=e.startPoint,this.endPoint=e.endPoint;this.startComponentId=e.startComponentId,this.endComponentId=e.endComponentId;var i=t.createNS("defs","bf-defs");i.innerHTML=`\n <marker id="end" markerWidth="6" markerHeight="6" refx="5" refy="3" orient="auto" markerUnits="strokeWidth">\n <path d="M0,0 L0,6 L6,3 z" fill="${e.color.getRGBA()}" />\n </marker>`;var n=t.create("i","bf-measure-handle");n.style.width=12*e.width+"px",n.style.height=12*e.width+"px",n.style.backgroundColor=e.color.getRGBA(),n.style.lineHeight=12*e.width+"px";var o=t.createNS("line","bf-measure-line");o.style.stroke=e.color.getRGBA(),o.setAttribute("stroke-width",e.width);var s=t.create("span","bf-measure-number");s.style.backgroundColor=e.color.getRGBA(),this.domElement=i,this.line=o,this.circle=n,this.text=s};i.prototype={draw:function(e){var t=this.domElement,i=this.line,n=this.circle,o=this.text,s=Math.abs(e.endPoint.x-e.startPoint.x),r=Math.abs(e.endPoint.y-e.startPoint.y),a=Math.abs(e.endPoint.z-e.startPoint.z),l=Math.sqrt(Math.pow(s,2)+Math.pow(r,2)+Math.pow(a,2));i.setAttribute("x1",e.startPoint.x),i.setAttribute("y1",e.startPoint.y),i.setAttribute("x2",e.endPoint.x),i.setAttribute("y2",e.endPoint.y),n.style.left=`${e.startPoint.x}px`,n.style.top=`${e.startPoint.y}px`,e.isMove&&(n.style.border="2px solid #fff"),l<15?i.removeAttribute("marker-end"):i.setAttribute("marker-end","url(#end)"),o.innerText=e.distance,e.svg.appendChild(t),e.svg.appendChild(i),e.text.appendChild(n),0==e.distance?n.innerText="0":(o.style.left=(e.startPoint.x+e.endPoint.x)/2+"px",o.style.top=(e.startPoint.y+e.endPoint.y)/2+"px",o.style.transform="translate(-50%, 0)",o.style.marginTop="2px",e.text.appendChild(o))}},e.MeasureRayItem=i}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure");let t=Object.freeze({Measured:"Measured",Clear:"Clear"});e.MeasureRayEvent=t}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Measure"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=function(e){var i=e.viewer;if(i)if("Viewer3D"===i.viewerType){var n=this,o=new Glodon$1.Web.Lang.EventManager,s=t.create("div","bf-measure-conext");i.addEventListener("Rendered",(function(){n.measureItem&&n.update()})),this.context={rootDomElement:s},this._opt=e,this._enableMove=!1,this._events={mousedown:function(){this._startTime=(new Date).getTime()},mouseup:function(e){if(0==e.button||1==e.button)if(n._enableMove)n._enableMove=!1,n.measureByPoint(e);else{var t=this._startTime;(new Date).getTime()-t<300&&n.measureByPoint(e)}},mousemove:function(e){n._enableMove&&(e.stopPropagation(),n.measureByPoint(e))}},this.getEventManager=function(){return o}}else console.log("Viewer2D is not supported.")};i.prototype={addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},switchOn:function(e){var i=this.context,n=this;n._opt.viewer.getDomElement().appendChild(i.rootDomElement),e&&(n._callback=e),n._opt.viewer.getModels().forEach((e=>{e.setSelectedComponentsById()}));var o=t.createNS("svg","bf-measure-svg"),s=t.create("div","bf-measure-text");i.rootDomElement.appendChild(o),i.rootDomElement.appendChild(s),i.svg=o,i.text=s,i.rootDomElement.addEventListener("mousedown",n._events.mousedown),i.rootDomElement.addEventListener("mouseup",n._events.mouseup),i.rootDomElement.addEventListener("mousemove",n._events.mousemove)},switchOff:function(){var e=this.context.rootDomElement,t=this,i=t._opt.viewer;t.measureItem&&(i.restoreComponentsColorById([t.measureItem.startComponentId,t.measureItem.endComponentId]),i.render()),e.removeEventListener("mousedown",t._events.mousedown),e.removeEventListener("mouseup",t._events.mouseup),e.removeEventListener("mousemove",t._events.mousemove),e.innerHTML="",e.remove(),t.measureItem=null},reset:function(){this.clear()},clear:function(){var e=this.context,t=this,i=t._opt.viewer;t.measureItem&&(i.restoreComponentsColorById([t.measureItem.startComponentId,t.measureItem.endComponentId]),i.render()),e.svg.innerHTML="",e.text.innerHTML="",t.measureItem=null,t.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureRayEvent.Clear,data)},measureByPoint:function(e){var t=this,i=t._opt.viewer,n=i.getViewer().pickByPointWithNormal(e);if(n){t.measureItem&&i.restoreComponentsColorById([t.measureItem.startComponentId,t.measureItem.endComponentId]);Glodon$1.Bimface.Viewer.Viewer3DEvent;var o=t._getContextData(n),s=new Glodon$1.Bimface.Plugins.Measure.MeasureRayItemConfig;s.startComponentId=o.startComponentId,s.endComponentId=o.endComponentId,s.startPoint=o.startPoint,s.endPoint=o.endPoint;var r=new Glodon$1.Bimface.Plugins.Measure.MeasureRayItem(s);r.circle.addEventListener("mousedown",(function(e){2!=e.button&&(t._enableMove=!0)})),t.context.distance=o.distance,i.overrideComponentsColorById([o.startComponentId,o.endComponentId],t._opt.targetsHintColor),setTimeout((function(){t.update(),i.render()}),100),t.measureItem=r,t.getEventManager().fireEvent(Glodon$1.Bimface.Plugins.Measure.MeasureRayEvent.Measured,o)}},update:function(){var e=this.measureItem,t=this.context,i=this._opt.viewer;t.svg.innerHTML="",t.text.innerHTML="",t.isMove=this._enableMove;var n=i.worldToClient(e.startPoint),o=i.worldToClient(e.endPoint);n&&o&&(t.startPoint=new Glodon$1.Web.Geometry.Point3d(n.x,n.y,n.z),t.endPoint=new Glodon$1.Web.Geometry.Point3d(o.x,o.y,o.z),e.draw(t))},exit:function(){this.switchOff()},_getContextData:function(e){var t,i,n={};return t=i=e[0],e.length>1&&(i=e[1]),n.startComponentId=t.userId,n.startPoint=t.worldPosition,n.endComponentId=i.userId,n.endPoint=i.worldPosition,n.distanceX=Math.round(Math.abs(n.endPoint.x-n.startPoint.x)),n.distanceY=Math.round(Math.abs(n.endPoint.y-n.startPoint.y)),n.distanceZ=Math.round(Math.abs(n.endPoint.z-n.startPoint.z)),n.distance=Math.round(Math.sqrt(Math.pow(n.distanceX,2)+Math.pow(n.distanceY,2)+Math.pow(n.distanceZ,2))),n}},e.MeasureRay=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Marker3D").Marker3DContainerConfig=function(){return{viewer:null,type:null,layerId:null}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Marker3D").Marker3DConfig=function(){return{id:null,objectId:null,size:30,tooltip:"",tooltipStyle:{color:"#333",fontSize:"14px",borderWidth:"1px",borderColor:"#666",borderStyle:"solid",backgroundColor:"#fff"},src:null,canvas:null,worldPosition:new Glodon$1.Web.Geometry.Point3d(0,0,0),modelId:void 0,layerId:void 0,hoverAnimation:!0}},function(){var e="Bimface.Plugins.Marker3D.Marker3D",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Marker3D"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){var t=this;this.id=e.id||Glodon$1.Web.Lang.Utility.UUID.createUUID(),this.layerId=e.layerId,this.modelId=e.modelId,this.objectId=e.objectId,this.size=e.size,this.iconUrl=e.canvas?e.canvas.toDataURL():e.src,this.position={x:e.worldPosition.x,y:e.worldPosition.y,z:e.worldPosition.z},this.hoverAnimation=e.hoverAnimation,this.originalPosition=new THREE.Vector3(this.position.x,this.position.y,this.position.z),this.explosionOffset=new THREE.Vector3,this.tooltip=e.tooltip,this.tooltipElement=n.create("div","bf-tooltip"),this.tooltipElement.innerHTML=e.tooltip,this.tooltipElement.setCss(e.tooltipStyle),this.isHideByClustering=!1,this._tooltipCallback=function(e,i,n){var o=t.tooltipElement;n.appendChild(o);var s=o.offsetWidth,r=o.offsetHeight;o.style.left=i.x-s/2+"px",o.style.top=i.y-r-t.size+"px",t._hoverCallback&&t._hoverCallback(e)},this._config=e,this.scratchVector=new THREE.Vector3,this.scratchVector_2=new THREE.Vector3,skipVueObserver(this)};o.prototype={getId:function(){return this.id},getWorldPosition:function(){return this.container?this.container._viewer.globalUnitUtil.revertVector(this.position):this.position},setWorldPosition:function(i){t.send(e,"setWorldPosition"),this.position={x:i.x,y:i.y,z:i.z},this.originalPosition=new THREE.Vector3(this.position.x,this.position.y,this.position.z),this.update()},getSize:function(){return this.size},setSize:function(i){t.send(e,"setSize"),this.size=i,this.update()},getSrc:function(){return this.iconUrl},setSrc:function(i){t.send(e,"setSrc"),this.iconUrl=i,this.update()},getTooltip:function(){return this.tooltip},setTooltip:function(i){t.send(e,"setTooltip"),this.tooltip=i,this.tooltipElement.innerHTML=i},onClick:function(i){t.send(e,"onClick"),i&&(this._clickCallback=i)},onHover:function(i){t.send(e,"onHover"),i&&(this._hoverCallback=i)},onDoubleClick:function(i){t.send(e,"onDoubleClick"),i&&(this._doubleClickCallback=i)},onRightClick:function(i){t.send(e,"onRightClick"),i&&(this._rightClickCallback=i)},update:function(){t.send(e,"update"),this.container&&this.container.update()},isHideByClustering:function(){return this.isHideByClustering},hideByClustering:function(e){this.isHideByClustering=!!e},attachExplosionOffset:function(e,t){if(!this.getWorldPosition())return;let i=this._config.objectId;if(i){let n=e.modelManager.getBoundingBoxByIds([i]),o=this.assoiatedComponentBbox,s=n;if(o){let e=s.getCenter(this.scratchVector).clone();e.sub(o.getCenter(this.scratchVector_2).clone()),this.explosionOffset=e,this.explosionExtent>0&&0===t&&(this.originalPosition.x+=this.explosionDirection*e.x,this.originalPosition.y+=this.explosionDirection*e.y,this.originalPosition.z+=this.explosionDirection*e.z,this.explosionExtent=0,this.explosionOffset=new THREE.Vector3,this.assoiatedComponentBbox=s.clone())}}else{let i=e.getScene().getOriginalBoundingBoxWorld().getCenter(this.scratchVector),n=(new THREE.Box3).expandByPoint(this.getWorldPosition()),o=CLOUD.Utils.computeExplodeTranslation(i,n,t);this.explosionOffset=o}},updatePosition:function(){this.container?(this.position.x=this.container._viewer.globalUnitUtil.translate(this.originalPosition.x+this.explosionOffset.x),this.position.y=this.container._viewer.globalUnitUtil.translate(this.originalPosition.y+this.explosionOffset.y),this.position.z=this.container._viewer.globalUnitUtil.translate(this.originalPosition.z+this.explosionOffset.z)):(this.position.x=this.originalPosition.x+this.explosionOffset.x,this.position.y=this.originalPosition.y+this.explosionOffset.y,this.position.z=this.originalPosition.z+this.explosionOffset.z)},getOriginalPosition:function(){return this.originalPosition},setInitialExplosionInfo:function(e){if("Viewer3D"!==e.getViewerType()&&"ViewerGIS"!==e.getViewerType())return;let t=null;"Viewer3D"===e.getViewerType()?t=this.modelId?e.getModel(this.modelId):e.getDefaultModel():"ViewerGIS"===e.getViewerType()&&(t=e.getLayerManager().getLayer(this.layerId)),this.explosionExtent=null===t?t.getExplosionExtent():0;let i=this._config.objectId;if(i){let t=e.getViewer().modelManager.getBoundingBoxByIds([i]);t.isEmpty()?(this._config.objectId=null,console.log("Cannot find component with Id "+i)):this.assoiatedComponentBbox=t.clone()}},getCurrentPosition:function(){return this.container?this.container._viewer.globalUnitUtil.revertVector(this.position):this.position},getHoverAnimation:function(){return this.hoverAnimation},setHoverAnimation:function(e){null!=e&&(this.hoverAnimation=e,this.update())},setContainerVisible:function(e){this.hideByClustering(!e),this.update()},getOpacity:function(){return 1},setOpacity:function(e){},resetClientPosition:function(e){this.setWorldPosition(e)}},i.Marker3D=o}(),function(){var e="Bimface.Plugins.Marker3D.Marker3DContainer",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Marker3D");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");i.Marker3DContainer=class{constructor(e){Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();if(!e.viewer)return void console.log("viewer must not be empty.");this.isMarker3DContainer=!0;const t="Viewer3D"===e.viewer.viewerType,i=Glodon$1.Bimface.Viewer.ViewerGIS&&e.viewer instanceof Glodon$1.Bimface.Viewer.ViewerGIS;var n=e.viewer.getDomElement(),o=e.viewer.getViewer();if(!t&&!i)return void console.log("Viewer2D is not supported.");if(skipVueObserver(this),"ViewerGIS"===e.viewer.getViewerType()&&"ShpPoint"===e.type)this._helper=new CLOUD$1.ShpPointMarker(o,e.layerId);else{if(e.viewer.marker3DContainer)return e.viewer.marker3DContainer;e.viewer.marker3DContainer=this,this._helper=new CLOUD$1.Marker3D(o,!0)}var s=this;this._viewer=e.viewer,this._items=[],this._areaData={},this.loadAreas=void 0,this.getLevelCallback=[],this.boxMap={},this.hoverListenerAdded=!1,this._isViewerGIS=i,this._pick=e=>{if(!e.doubleClick&&2!==e.event.button){var t=e.intersectInfo;if(t&&t.objectType===CLOUD$1.PICKABLETYPE.Marker3d){var i=this.getItemById(t.selectedObjectId);i._clickCallback&&i._clickCallback(i)}}},this._doublePick=e=>{if(e.doubleClick){var t=e.intersectInfo;if(t&&t.objectType===CLOUD$1.PICKABLETYPE.Marker3d){var i=this.getItemById(t.selectedObjectId);i._doubleClickCallback&&i._doubleClickCallback(i)}}},this._rightPick=e=>{if(2==e.event.button){var t=e.intersectInfo;if(t&&t.objectType===CLOUD$1.PICKABLETYPE.Marker3d){var i=this.getItemById(t.selectedObjectId);i._rightClickCallback&&i._rightClickCallback(i)}}},this._hover=e=>{var t=this;t.tooltipElement&&n.contains(t.tooltipElement)&&(n.removeChild(t.tooltipElement),t.tooltipElement=null);var i=e.intersectInfo;if(i&&i.objectType===CLOUD$1.PICKABLETYPE.Marker3d){var o=t.getItemById(i.selectedObjectId);t.tooltipElement=o.tooltipElement,o._tooltipCallback&&""!=t.tooltipElement.innerHTML&&o._tooltipCallback(o,e.canvasPos,n)}},o.registerEventListener(CLOUD$1.EVENTS.ON_CLICK_MARKER3D_PICK,s._pick),o.registerEventListener(CLOUD$1.EVENTS.ON_CLICK_MARKER3D_PICK,s._rightPick),o.registerEventListener(CLOUD$1.EVENTS.ON_CLICK_MARKER3D_PICK,s._doublePick),t?(this.calculateViewer3dExplosionOffset=t=>{const i=t.modelId,n=t.floorInfos.length,o=e.viewer.getDefaultModel().modelId.toString(),r=e.viewer.getModel(i).getFloorExplosionExtent(),a=e.viewer.getModel(i).getFloorExplosionDirection();if(0===r)for(const t of s.getAllItems())t.setInitialExplosionInfo(e.viewer);let l=[];s.floorInfos=t;var h=function(){let e=s._items;for(let t=0,n=e.length;t<n;t++){let n=e[t].getWorldPosition();if(n)if(!0!==e[t]._isBindRoom)if(e[t].levelName){let i=l.getObjectByAttribute("floorName",e[t].levelName);i&&(e[t].explosionOffset={x:a.x*i.explodedOffset,y:a.y*i.explodedOffset,z:a.z*i.explodedOffset})}else if(i!==o)e[t].explosionOffset={x:e[t].explosionOffset.x,y:e[t].explosionOffset.y,z:e[t].explosionOffset.z};else{let i=!0;for(let o=0;o<l.length;o++){const s=l[o];if(s.box.min<n.z&&s.box.max>n.z){e[t].explosionOffset={x:a.x*s.explodedOffset,y:a.y*s.explodedOffset,z:a.z*s.explodedOffset},e[t].levelName=s.floorName,i=!1;break}}i&&(e[t].explosionOffset={x:0,y:0,z:0})}else{const i=s._viewer.getViewer().modelManager.modelCollection.getById("ExtrudeBodyManager").getNode(e[t]._config.objectId),n=i.explodedHeight,o=i.explodedDirection;e[t].explosionOffset={x:o.x*n,y:o.y*n,z:o.z*n}}}};if(n)for(var d=0;d<n;d++){let e=t.floorInfos[d],i=t.floorInfos[d+1],o=t.floorInfos[d-1];l.push({box:{min:o?e.boundingBox.min.z:-1/0,max:i?i.boundingBox.min.z:1/0},floorName:e.name,explodedOffset:e.explodedHeight-e.elevation}),l.length==n&&(h(),s.boxs=l)}s.update()},e.viewer.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.FloorExplosion,(e=>{this.calculateViewer3dExplosionOffset(e)}))):i&&(this.calculateViewerGISExplosionOffset=t=>{const i=e.viewer,n=i.getViewer(),o=t.modelId,r=t.floorInfos.length,a=n.getFloorExplosionExtent(o),l=n.getFloorExplosionDirection(o);if(0===a)for(const e of s.getAllItems())e.setInitialExplosionInfo(i);const h=t.floorInfos;let d=[];for(var c=0;c<r;c++){let e=h[c],t=h[c+1],i=h[c-1];if(d.push({box:{min:i?e.boundingBox.min.z:-1/0,max:t?t.boundingBox.min.z:1/0},floorName:e.name,explodedOffset:e.explodedHeight-e.elevation}),d.length==r){this.boxMap[o]=d;break}}const u=i.getLayerManager();let p=this._items;for(let e=0,t=p.length;e<t;e++){if(!p[e].getWorldPosition())continue;const t=u.getLayer(p[e].layerId);if(!t||!t.modelId)continue;if(t.modelId.toString()!==o||!p[e].levelName)continue;let i=d.getObjectByAttribute("floorName",p[e].levelName);i&&(p[e].explosionOffset={x:l.x*i.explodedOffset,y:l.y*i.explodedOffset,z:l.z*i.explodedOffset})}this.update()},e.viewer.addEventListener(Glodon$1.Bimface.Viewer.ViewerGISEvent.FloorExplosion,(e=>{this.calculateViewerGISExplosionOffset(e)}))),e.viewer.getViewer().registerEventListener(CLOUD$1.EVENTS.ON_EXPLOSION,(t=>{let i=this.getAllItems();for(const n of i)ExplosionHelper.attachExplosionOffset(e.viewer,t.extent,n);this.update()}))}addItem(i){t.send(e,"addItem"),i.container=this;let n=ExplosionHelper.ifExploded(this._viewer,i,this._isViewerGIS);n&&(n.setInitialExplosionInfo(this._viewer),n.updatePosition(),this._items.push(n),this._helper.add([n],(()=>{this._viewer.render()}))),this.addTipsHoverListener()}addTipsHoverListener(){if(!this.hoverListenerAdded){const t=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();var e=this._viewer.getViewer();t&&e.registerEventListener(CLOUD$1.EVENTS.ON_HOVER_PICK,this._hover),this.hoverListenerAdded=t}}getLevelNameById(e,t){if(!this._spatialRelation){let e=new Glodon$1.Bimface.Plugins.SpatialRelation.RoomConfig;e.viewer=this._viewer;let t=new Glodon$1.Bimface.Plugins.SpatialRelation.Room(e);this._spatialRelation=t}let i=this._spatialRelation.getBoundaryByRoomId(e);if(i){if(this._levelsInfo)return levelName=function(e,t){let i=e[0][2];for(let e=0;e<t.length;e++)if(Math.abs(i-t[e].elevation)<5)return t[e].name;return!1}(i,this._levelsInfo),levelName;this._viewer.getDefaultModel().getMapInfo((e=>{this._levelsInfo=e.axisGrid.Levels,this.addItem(t)}))}}addItems(i){t.send(e,"addItems");for(const e of i){let t=ExplosionHelper.ifExploded(this._viewer,e,this._isViewerGIS);t&&this._items.push(t),e.setInitialExplosionInfo(this._viewer),e.updatePosition()}this._helper.add(i),this.addTipsHoverListener()}removeItemById(i){t.send(e,"removeItemById"),this._items.removeObjectByAttribute("id",i),this._helper.removeById(i)}getItemById(e){return this._items.getObjectByAttribute("id",e)}getAllItems(){return[...this._items]}clear(){t.send(e,"clear");var i=this._viewer.getViewer();let n=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();i.unregisterEventListener(CLOUD$1.EVENTS.ON_CLICK_PICK,this._pick),n&&i.unregisterEventListener(CLOUD$1.EVENTS.ON_HOVER_PICK,this._hover),this.hoverListenerAdded=!1,this._items=[],this._helper.clear(!0),this._viewer.render()}update(){this._helper.clear();let e=this._items.slice();for(let t=0,i=e.length;t<i;t++){e[t].getWorldPosition()&&e[t].updatePosition()}let t=[];for(let i=0,n=e.length;i<n;i++)!1===e[i].isHideByClustering&&t.push(e[i]);this._helper.add(t),this._viewer.render()}hideItemsById(i){t.send(e,"hideItemsById"),this._helper.hideByIds(i),this._viewer.render()}hideAllItems(){t.send(e,"hideAllItems"),this._helper.hide(),this._viewer.render()}showItemsById(i){t.send(e,"showItemsById"),this._helper.showByIds(i),this._viewer.render()}showAllItems(){t.send(e,"showAllItems"),this._helper.show(),this._viewer.render()}}}(),function(){let e=Object.freeze({Forward:"Forward",Reverse:"Reverse"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionBoxDirection=e}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionBoxConfig=function(){return{viewer:null,direction:Glodon$1.Bimface.Plugins.Section.SectionBoxDirection.Forward,isHatchEnabled:!0,hatchByMaterial:!1,enableSnap:!0,isOutlineEnabled:!0,filter:null}},function(){let e=Object.freeze({SectionBoxUpdate:"SectionBoxUpdate",SectionBoxChanged:"SectionBoxChanged"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionBoxEvent=e}(),function(){var e,t,i="Bimface.Plugins.Section.SectionBox",n=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),o=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section"),s=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),function(i){var n=this,s=i.viewer;if(!s)return void console.log("domElement must not be empty.");const r="Viewer3D"===s.viewerType,a=s instanceof Glodon$1.Bimface.Viewer.ViewerGIS;if(r||a){if(skipVueObserver(this),s._sectionPlane&&(s._sectionPlane.hidePlane(),s._sectionPlane.exit()),i.hatchByMaterial&&s.getViewer().getClipCapsManager().enableHatchByMaterial(i.hatchByMaterial,!0),CLOUD$1.GlobalData.CalculateClippingLine=!!i.isOutlineEnabled,CLOUD$1.GlobalData.SnapClippingLine=!!i.enableSnap,e&&s==t)return e.id=i.id,e.reset(),e;if(e=this,t=s,s._sectionBox)return s._sectionBox.showBox(),s._sectionBox;s._sectionBox=this,this.sectionBoxEvent=o.SectionBoxEvent,this.eventManager=s.getEventManager(),n.id=i.id||"SectionBox",n._opt=i,n._viewer=s,n.boxState=!0,n._boxDirection=i.direction,n.init(),i.filter&&n.setFilter(i.filter),n.enableHatch(i.isHatchEnabled)}else console.log("Viewer2D is not supported.")});s.prototype={hookEvens:function(){var e=this._viewer.getViewer(),t=this._viewer.getDomElement();e.registerEventListener(CLOUD$1.EVENTS.ON_CLIP_HOVER,(function(e){e.onClipBox?t.style.cursor=`url(${Cursor.section}),auto`:t.style.removeProperty("cursor")}));var i=this;e.registerEventListener(CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE,(function(e){i.eventManager.fireEvent(i.sectionBoxEvent.SectionBoxChanged)}))},init:function(){n.send(i,"init");var e=this._opt.viewer.getViewer(),t=this;e.editorManager.enableTool(e,CLOUD$1.EditToolMode.CLIP_BY_BOX),this._sectionBox=new CLOUD$1.ClipPlaneService(e),CLOUD$1.ClipPlaneManager.getInstance(e.getScene()).observer=function(){t.eventManager.fireEvent(t.sectionBoxEvent.SectionBoxUpdate,t)},this._sectionBox.reset(),this._sectionBox.toggle(!0,!0),this._sectionBox.setVisible(!0),"Reverse"===t._boxDirection?this._sectionBox.changeDirection(!0):this._sectionBox.changeDirection(!1),e.getModelManager().updatePickingMaterial(),this.hookEvens(),this.fireSectionBoxVisibleChangedEvent(!0)},addEventListener:function(e,t){this.eventManager.addEvent(e,t)},removeEventListener:function(e,t){this.eventManager.removeEvent(e,t)},fireSectionBoxVisibleChangedEvent:function(e){requestAnimationFrame((()=>{this._opt.viewer.getEventManager().fireEvent("SectionBoxVisibleChanged",e)}))},setBox:function(e){n.send(i,"setBox");var t=this._sectionBox.getEditor();e=this._viewer.globalUnitUtil.translate(e,["x","y","z"]),t.calculateOffsetByBox(e.min,e.max),CLOUD$1.GlobalData.ClippingCapsType==CLOUD$1.EnumClippingCapsTypes.ClipBox&&this._sectionBox&&this._sectionBox.getEditor().clipPlanes.reCalculateClippingIds()},getBox:function(){},hideBox:function(){n.send(i,"hideBox"),this._sectionBox&&this._sectionBox.setVisible(!1),this._viewer.render()},showBox:function(){n.send(i,"showBox"),this._sectionBox&&this._sectionBox.setVisible(!0),this._viewer.render()},setProgress:function(e,t){var i={x:["Left","Right"],y:["Back","Front"],z:["Bottom","Top"]};t&&(this._sectionBox.setProcess(i[e][0],t[0]/100),2==t.length&&this._sectionBox.setProcess(i[e][1],1-t[1]/100))},getProgress:function(e){var t=[],i={x:["Left","Right"],y:["Back","Front"],z:["Bottom","Top"]};return t.push(100*this._sectionBox.getProcess(i[e][0])),t.push(100-100*this._sectionBox.getProcess(i[e][1])),t},reCalculateClippingIds(e){this._sectionBox.reCalculateClippingIds(e)},reset:function(){n.send(i,"reset"),this._sectionBox&&this._sectionBox.toggle(!0,!0),this._sectionBox&&this._sectionBox.reset("Rotate"),this.showBox()},enable:function(e){n.send(i,"enable");var t=this._opt.viewer,o=t.getViewer().getScene();CLOUD$1.ClipPlaneManager.getInstance(o).enable(e,e),t.getViewer().getModelManager().forceUpdateGTAOPass(),this.fireSectionBoxVisibleChangedEvent(e)},fitToModel:function(){n.send(i,"fitToModel"),this.reset();var e=this._sectionBox.recalculate().clone();e.isEmpty()&&e.expandByPoint(new THREE.Vector3),e=this._viewer.globalUnitUtil.revertTranslate(e,["x","y","z"]),this.setBox(e),this._sectionBox.getEditor()._isVisible()&&this.showBox(),this.eventManager.fireEvent(this.sectionBoxEvent.SectionBoxChanged)},isIncluded:function(e){var t=this._opt.viewer,i=t.getViewer().getScene(),n=CLOUD$1.ClipPlaneManager.getInstance(i).getClipBoundingBox(),o=t.worldToScene(e);return n.containsPoint(o)},exit:function(){n.send(i,"exit");var t=this._opt.viewer.getViewer(),o=this._viewer.getDomElement();this.clearFilter(),this.reset(),t.getModelManager().updatePickingMaterial(),t.editorManager.disableTool(CLOUD$1.EditToolMode.CLIP_BY_BOX),t.getClipCapsManager().resetClippingCapsStatus(),o.style.removeProperty("cursor"),this._sectionBox=null,this._opt.viewer._sectionBox=null,e=null,this.eventManager.fireEvent(this.sectionBoxEvent.SectionBoxUpdate,null),t.unregisterEventListener(CLOUD$1.EVENTS.ON_CLIP_HOVER,(function(e){e.onClipBox?o.style.cursor=`url(${Cursor.section}),auto`:o.style.removeProperty("cursor")})),CLOUD$1.GlobalData.SnapClippingLine=!1,CLOUD$1.GlobalData.CalculateClippingLine=!0,this.fireSectionBoxVisibleChangedEvent(!1)},lockBox:function(e){this._opt.viewer.getViewer().editorManager.getToolByName("clipByBox").lockBoxFaces(e)},unlockBox:function(){this._opt.viewer.getViewer().editorManager.getToolByName("clipByBox").unlockBox()},getState:function(){var e=this._opt.viewer,t=this._sectionBox.saveState(),i=t.boundingBox;return i.min=e.sceneToWorld(i.min),i.max=e.sceneToWorld(i.max),t.center=e.globalUnitUtil.revertVector(t.center),t.position=e.globalUnitUtil.revertVector(t.position),t},setState:function(e){var t=this._opt.viewer,i=Object.assign({},e.boundingBox),n=Object.assign({},e);n.cneter=Object.assign({},e.center),n.position=Object.assign({},e.position);var o=n.boundingBox;o.min=t.worldToScene(o.min),o.max=t.worldToScene(o.max),n.center=t.globalUnitUtil.translateVector(n.center),n.position=t.globalUnitUtil.translateVector(n.position),n.quaternion&&n.quaternion instanceof Array&&(n.quaternion=new THREE.Quaternion(...n.quaternion)),this._sectionBox.loadState(n),e.boundingBox=i},restore:function(){var e=this._sectionBox.getEditor()._isVisible();this._sectionBox.toggle(!0,e),this._sectionBox.reset("Rotate")},getSectionBox:function(){n.send(i,"getSectionBox");var e=this._opt.viewer,t=this._sectionBox.saveState().boundingBox,o=e.getViewer().getScene().getMatrixGlobal();return o.invert(),t=e.globalUnitUtil.revertTranslate(t,["x","y","z"]),(t=new THREE.Box3(new THREE.Vector3(t.min.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.max.z))).applyMatrix4(o),t},setSectionBox:function(e){n.send(i,"setSectionBox");var t=this._opt.viewer,o=t.getViewer().getScene(),s=CLOUD$1.ClipPlaneManager.getInstance(o);e=t.globalUnitUtil.translate(e,["x","y","z"]);var r=(o=t.getViewer().getScene()).getMatrixGlobal(),a=new THREE.Box3(new THREE.Vector3(e.min.x,e.min.y,e.min.z),new THREE.Vector3(e.max.x,e.max.y,e.max.z));a.isEmpty()?console.warn("The x,y,z of box.min must be smaller than box.max"):(a.applyMatrix4(r),s.setSectionBox(a.min,a.max))},update:function(){this._sectionBox.update()},setObjectsById(e){this._opt.viewer.getModels().forEach((t=>{t.localClippingComponentsById(e)})),this._sectionBox.update(),this._opt.viewer.render()},setObjectsByObjectData(e){this._opt.viewer.getModels().forEach((t=>{t.localClippingComponentsByObjectData(e)})),this._sectionBox.update(),this._opt.viewer.render()},restoreObjects(){this._opt.viewer.getModels().forEach((e=>{e.clearLocalClipping()})),this._sectionBox.update(),this._opt.viewer.render()},setFilter(e){if(!(e&&e instanceof Array))return void console.log("conditions should be Array.");const t=this._opt.viewer,i=t.getViewer();for(const i of e){if(i.layerId){const e=t.getLayerManager().getLayer(i.layerId);if(!e)continue;i.modelId=e.getModelId()}let e;if(i.modelId)e=t.getModel(i.modelId);else if(e=t.getModel(),void 0===e)continue;i.objectIds?e.localClippingComponentsById(i.objectIds):i.objectData?e.localClippingComponentsByObjectData(i.objectData):e.localClippingComponentsByObjectData([])}this._sectionBox.update(),i.getModelManager().updatePickingMaterial(),this.fireSectionBoxVisibleChangedEvent(!1),this._opt.viewer.render()},clearFilter(){this.restoreObjects(),this.fireSectionBoxVisibleChangedEvent(!0)},changeClipDirection(e){this._opt.viewer.getViewer().editorManager.getToolByName("clipByBox").changeDirection(e),this.fireSectionBoxVisibleChangedEvent(!e)},rotateByAxis(e,t){if(n.send(i,"rotateByAxis"),"XAxis"!==e&&"YAxis"!==e&&"ZAxis"!==e)return void console.warn("Rotate axis must be XAxis,YAxis or ZAxis.");if(isNaN(t))return void console.warn("the degree input is not a number");let o,s=THREE.Math.degToRad(t);switch(e){case"XAxis":o="x";break;case"YAxis":o="z",s=-s;break;case"ZAxis":o="y"}const r=this._opt.viewer;r.getViewer().editorManager.getToolByName("clipByBox").rotateSectionBox(o,s),r.render()},setBoxByVectors(e,t,o,s){n.send(i,"setBoxByVectors"),this.reset();let r=e=>void 0!==e.x&&void 0!==e.y&&void 0!==e.z;if(!(r(e)&&r(t)&&r(o)&&r(s)))return void console.warn("the object input is invalid.");const a=new THREE.Vector3(t.x,t.y,0),l=new THREE.Vector3(o.x,o.y,0),h=new THREE.Vector3(0,0,s.z),d=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2)),c=new THREE.Vector3(-a.y,a.x,0),u=Math.abs(l.dot(c)/c.length()),p=Math.abs(h.z);let g=new THREE.Box3;g.min=new THREE.Vector3(e.x-d,e.y-u,e.z-p),g.max=new THREE.Vector3(e.x+d,e.y+u,e.z+p),this.setBox(g),a.y<0&&(a.x=-a.x,a.y=-a.y);const m=THREE.Math.radToDeg(Math.acos(a.clone().normalize().dot(new THREE.Vector3(1,0,0))));this.rotateByAxis("ZAxis",m)},enableHatch(e){this._opt.viewer._sectionPlane||CLOUD$1.GlobalData.ClippingCapsType!=e&&CLOUD$1.GlobalData.ClippingCapsType!=CLOUD$1.EnumClippingCapsTypes.ClipPlane&&(CLOUD$1.GlobalData.ClippingCapsType=e?CLOUD$1.EnumClippingCapsTypes.ClipBox:CLOUD$1.EnumClippingCapsTypes.None,this._sectionBox&&this._sectionBox.visibleCapsWireframe(e),e&&this._sectionBox&&this._sectionBox.getEditor().clipPlanes.reCalculateClippingIds(),this._opt.viewer.render())},isHatchEnabled:()=>CLOUD$1.GlobalData.ClippingCapsType==CLOUD$1.EnumClippingCapsTypes.ClipBox,enableSnap(e){CLOUD$1.GlobalData.SnapClippingLine=!!e},enableOutline(e){CLOUD$1.GlobalData.CalculateClippingLine!==e&&(CLOUD$1.GlobalData.CalculateClippingLine=!!e,this._sectionBox.reCalculateClippingIds())}},o.SectionBox=s}(),function(){let e=Object.freeze({Forward:"Forward",Reverse:"Reverse"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionPlaneDirection=e}(),function(){let e=Object.freeze({X:"X",Y:"Y",Z:"Z"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionPlanePlane=e}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionPlaneConfig=function(){return{viewer:null,progress:50,plane:Glodon$1.Bimface.Plugins.Section.SectionPlanePlane.X,direction:Glodon$1.Bimface.Plugins.Section.SectionPlaneDirection.Forward,isHatchEnabled:!0,hatchByMaterial:!1,enableSnap:!0,isOutlineEnabled:!0,filter:null}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.CoordinateDrawer=class{constructor(e,t){this.coordinateSystem=e,this.viewer=t,this.container=this.viewer.domElement,this.mapDrawables={},this.initialize()}initialize(){this.xmlns="http://www.w3.org/2000/svg";var e=t.create("div","bf-coordinate-drawer");e.style.left="0px",e.style.top="0px",e.style.width=this.container.offsetWidth+"px",e.style.height=this.container.offsetHeight+"px",e.style.position="absolute",e.style.zIndex=5,this.group=document.createElementNS(this.xmlns,"svg"),this.group.setAttribute("width",this.container.offsetWidth+""),this.group.setAttribute("height",this.container.offsetHeight+""),e.appendChild(this.group),this.container.appendChild(e)}makeCircle(e,t){var i=this.mapDrawables;null==i[e]&&(i[e]=document.createElementNS(this.xmlns,"circle"),this.group.appendChild(i[e]));var n=i[e];n.style.fill=t.color||"#FF0000",n.setAttribute("r",t.radius+""),n.setAttribute("transform","translate("+t.center.x+","+t.center.y+")")}show(e,t){var i=this.getDrawable(e);i&&(i.style.display=t?"block":"none")}fill(e,t){this.getDrawable(e).style.fill=t?"block":"none"}makeLine(e,t){var i=this.mapDrawables;null==i[e]&&(i[e]=document.createElementNS(this.xmlns,"line"),this.group.appendChild(i[e]));var n=i[e];n.setAttribute("stroke",t.color||"#000000"),n.setAttribute("stroke-width",t.width||3),n.setAttribute("x1",t.start.x+""),n.setAttribute("y1",t.start.y+""),n.setAttribute("x2",t.end.x+""),n.setAttribute("y2",t.end.y+"")}makeDashLine(e,t){this.makeLine(e,t),this.mapDrawables[e].setAttribute("stroke-dasharray",t.dashArray)}makePolyline(e,t){var i=null,n=this.mapDrawables;null==n[e]&&(n[e]=document.createElementNS(this.xmlns,"polyline"),this.group.appendChild(n[e])),(i=n[e]).setAttribute("stroke",t.color||"#A9A9A9"),i.setAttribute("stroke-width",t.width||3),i.style.fill="none",i.setAttribute("points",t.points)}makeDefs(e){var t=this.mapDrawables;null==t[e]&&(t[e]=document.createElementNS(this.xmlns,"defs"),null==t.marker&&(t.marker=this.makeMarker(),t[e].appendChild(t.marker)),this.group.appendChild(t[e]))}makeMarker(){var e=document.createElementNS(this.xmlns,"marker");e.setAttribute("id","arrow"),e.setAttribute("viewBox","0 0 10 10"),e.setAttribute("refX","5"),e.setAttribute("refY","5"),e.setAttribute("markerWidth","6"),e.setAttribute("markerHeight","6"),e.setAttribute("orient","auto-start-reverse");var t=document.createElementNS(this.xmlns,"path");return t.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),t.style.fill="#11DAB7",this.mapDrawables.arrow=t,e.appendChild(t),e}getDrawable(e){return this.mapDrawables[e]}attach(){this.getDrawable("axisZ").setAttribute("marker-end","url(#arrow)")}setColor(e,t){this.getDrawable(e).setAttribute("stroke",t)}fill(e,t){this.getDrawable(e).style.fill=t}hideAll(e){let t=1==e?"none":"block";this.group.parentNode.style.display=t}destroy(){for(var e=this.group.children,t=0;t<e.length;t++)this.group.removeChild(e[t]);var i=this.group.parentNode;i&&i.removeChild(this.group)}}}(),function(){let e=Object.freeze({SectionPlaneUpdate:"SectionPlaneUpdate",SectionPlaneChanged:"SectionPlaneChanged"});Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionPlaneEvent=e}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.CoordinateAction=class{constructor(e,t){this.coordinateSystem=e,this.viewer=e.viewer.getViewer(),this.drawingImpl=t,this.viewportOffset=this.viewer.domElement.getBoundingClientRect(),this.cameraControl=this.viewer.cameraControl,this.fillClipPlane=CLOUD$1.FillClipPlaneManager.getInstance(this.viewer.getScene()),this.initialize(),this.eventManager=e.viewer.getEventManager()}initialize(){this.arrowMouseDown=!1,this.circleXMouseDown=!1,this.circleYMouseDown=!1,this.firstClickDown=!0,this.firstRotate=!0,this.lineOut=!0,this.arrowOut=!0,this.translateStartPt=new THREE.Vector2,this.translateEndPt=new THREE.Vector2,this.rotateAngleA=0,this.rotateAngleB=0,this.config=this.coordinateSystem.config,this.sectionPlaneEvent=Glodon$1.Bimface.Plugins.Section.SectionPlaneEvent}registerArrowEvents(){var e=this.drawingImpl.getDrawable("axisZ"),t=this,i=this.config.colors;e.onmouseover=function(){1!=t.circleXMouseDown&&1!=t.circleYMouseDown&&(t.drawingImpl.setColor("axisZ",i.highLight),t.drawingImpl.fill("arrow",i.highLight),t.drawingImpl.setColor("tipArcX",i.default),t.drawingImpl.fill("cubeX",i.default),t.drawingImpl.setColor("tipArcY",i.default),t.drawingImpl.fill("cubeY",i.default),t.lineOut=!1)},e.onmouseout=function(){1!=t.circleXMouseDown&&1!=t.circleYMouseDown&&0==t.arrowMouseDown&&1==t.arrowOut&&(t.drawingImpl.setColor("axisZ",i.arrow),t.drawingImpl.fill("arrow",i.arrow),t.drawingImpl.setColor("tipArcX",i.tipArcX),t.drawingImpl.fill("cubeX",i.cubeX),t.drawingImpl.setColor("tipArcY",i.tipArcY),t.drawingImpl.fill("cubeY",i.cubeY),t.lineOut=!0)},e.onmousedown=function(e){t.arrowMouseDown=!0,t.lineOut=!1;var i=t.config.colors;t.drawingImpl.setColor("axisZ",i.highLight),t.drawingImpl.fill("arrow",i.highLight),t.coordinateSystem.colorUpdate=!1,t.translateStartPt.set(e.clientX,e.clientY)};var n=this.drawingImpl.getDrawable("arrow");n.onmouseover=function(){if(1!=t.circleXMouseDown&&1!=t.circleYMouseDown){t.arrowOut=!1;var e=t.config.colors;t.drawingImpl.fill("arrow",e.highLight),t.drawingImpl.setColor("axisZ",e.highLight),t.drawingImpl.setColor("tipArcX",e.default),t.drawingImpl.fill("cubeX",e.default),t.drawingImpl.setColor("tipArcY",e.default),t.drawingImpl.fill("cubeY",e.default)}},n.onmouseout=function(){if(1!=t.circleXMouseDown&&1!=t.circleYMouseDown&&0==t.arrowMouseDown&&1==t.lineOut){t.arrowOut=!0;var e=t.config.colors;t.drawingImpl.setColor("axisZ",e.arrow),t.drawingImpl.fill("arrow",e.arrow),t.drawingImpl.setColor("tipArcX",e.tipArcX),t.drawingImpl.fill("cubeX",e.cubeX),t.drawingImpl.setColor("tipArcY",e.tipArcY),t.drawingImpl.fill("cubeY",e.cubeY)}},n.onmousedown=function(e){t.arrowMouseDown=!0,t.arrowOut=!1;var i=t.config.colors;t.drawingImpl.setColor("axisZ",i.highLight),t.drawingImpl.fill("arrow",i.highLight),t.translateStartPt.set(e.clientX,e.clientY)},document.onmousemove=function(e){if(1==t.arrowMouseDown){if(t.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1,t.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_PLANE_MOUSE_MOVE,onClipPlane:!0}),!(e.clientX==t.translateStartPt.x&&e.clientY==t.translateStartPt.y)){var i=t.fillClipPlane.renderClipPlane,n=i.normal.clone();n.w=i.constant;var o=t.cameraControl.movePlane(n,e,t.translateStartPt,!1,t.fillClipPlane.position.clone());null!=o&&t.fillClipPlane.offset(o),t.translateStartPt.set(e.clientX,e.clientY),t.cameraControl.setCameraChanging(!0),t.cameraControl.update(!0)}t.coordinateSystem.update();var s=t.config.colors;t.drawingImpl.setColor("axisZ",s.highLight),t.drawingImpl.fill("arrow",s.highLight),t.drawingImpl.setColor("tipArcX",s.default),t.drawingImpl.fill("cubeX",s.default),t.drawingImpl.setColor("tipArcY",s.default),t.drawingImpl.fill("cubeY",s.default),e.preventDefault(),e.stopPropagation(),t.fireSectionPlaneChangedEvent()}},document.onmouseup=function(){if(0==t.arrowMouseDown)return;t.arrowMouseDown=!1,t.coordinateSystem.colorUpdate=!0;var e=t.config.colors;t.drawingImpl.setColor("axisZ",e.arrow),t.drawingImpl.fill("arrow",e.arrow),t.drawingImpl.setColor("tipArcX",e.tipArcX),t.drawingImpl.fill("cubeX",e.cubeX),t.drawingImpl.setColor("tipArcY",e.tipArcY),t.drawingImpl.fill("cubeY",e.cubeY),CLOUD$1.GlobalData.ClippingCaps=!0,t.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE_END,onClipPlane:!0}),t.fillClipPlane.calculateClippingIds(),t.viewer.render()}}registerCircleXEvents(){var e=this,t=this.config.colors,i=this.drawingImpl.getDrawable("tipArcX");i.onmousedown=function(){e.circleXMouseDown=!0,e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.enableCircleXMovement()},i.onmouseout=function(){0==e.circleXMouseDown&&(e.drawingImpl.setColor("axisZ",t.arrow),e.drawingImpl.fill("arrow",t.arrow),e.drawingImpl.setColor("tipArcY",t.tipArcY),e.drawingImpl.fill("cubeY",t.cubeY),e.coordinateSystem.circleToArc("tipArcX"))},document.addEventListener("mouseup",(function(){if(1==e.circleXMouseDown){CLOUD$1.GlobalData.ClippingCaps=!0,e.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE_END,onClipPlane:!0}),e.fillClipPlane.calculateClippingIds(),e.viewer.render()}e.circleXMouseDown=!1,e.circleXMouseDown=!1,e.firstClickDown=!0,e.firstRotate=!1,e.lastRotateX=0,e.lastRotateY=0,e.drawingImpl.show("tipArcY",!0),e.drawingImpl.show("axisY",!0),e.drawingImpl.show("axisZ",!0),e.drawingImpl.show("cubeY",!0),e.coordinateSystem.update(),e.drawingImpl.show("dashLineX",!1),e.drawingImpl.setColor("axisZ",t.arrow),e.drawingImpl.fill("arrow",t.arrow)}))}registerCircleYEvents(){var e=this,t=this.config.colors,i=this.drawingImpl.getDrawable("tipArcY");i.onmousedown=function(){e.circleYMouseDown=!0,e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.enableCircleYMovement()},i.onmouseout=function(){0==e.circleYMouseDown&&(e.drawingImpl.setColor("axisZ",t.arrow),e.drawingImpl.fill("arrow",t.arrow),e.coordinateSystem.circleToArc("tipArcY"),e.drawingImpl.setColor("tipArcX",t.tipArcX),e.drawingImpl.fill("cubeX",t.cubeX))},document.addEventListener("mouseup",(function(){if(1==e.circleYMouseDown){CLOUD$1.GlobalData.ClippingCaps=!0,e.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE_END,onClipPlane:!0}),e.fillClipPlane.calculateClippingIds(),e.viewer.render()}e.circleYMouseDown=!1,e.drawingImpl.show("tipArcX",!0),e.drawingImpl.show("cubeX",!0),e.coordinateSystem.update(),e.drawingImpl.show("dashLineY",!1),e.drawingImpl.setColor("axisZ",t.arrow),e.drawingImpl.fill("arrow",t.arrow)}))}enableCircleXMovement(){var e=this,t=this.config.colors;document.addEventListener("mousemove",(function(i){if(1==e.circleXMouseDown){e.drawingImpl.show("dashLineX",!0),e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1,e.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_PLANE_MOUSE_MOVE,onClipPlane:!0});var n=e.fillClipPlane.normalIndex,o=e.viewportOffset,s=new THREE.Vector2(i.clientX-o.left,i.clientY-o.top),r=e.calcRotateAngleIndex(s,e.coordinateSystem.discretePointsX);1==e.firstClickDown&&(e.lastIndex=r);var a=2*(r-e.lastIndex);(n>3||"Reverse"==e.coordinateSystem.planeDirection)&&(a=-a),e.drawingImpl.show("tipArcY",!1),e.coordinateSystem.updateAxisZ();var l=e.fillClipPlane.renderClipPlane.normal.clone(),h=e.coordinateSystem.getCoordinateAxis(),d=e.config.styles;e.coordinateSystem.drawClipPlaneCircle("tipArcZ",h.start.clone(),d.auxCircleRadius,e.coordinateSystem.dirX,l);var c=e.coordinateSystem.drawingToCanvas(h.start.clone()),u=e.coordinateSystem.drawingToCanvas(h.endY.clone());e.coordinateSystem.drawAxisY(c,u,t.highLight),e.coordinateSystem.drawCubeX("cubeX",u,d.cubeRadius),e.drawingImpl.show("cubeY",!1);var p="x";n<2&&(p="y"),e.fillClipPlane.rotateAngleOffset(a,p),e.coordinateSystem.backwardCoordinate(),1==e.firstClickDown?e.firstClickDown=!1:e.lastIndex=r,e.translateStartPt.set(i.clientX,i.clientY),e.viewer.render(),i.preventDefault(),i.stopPropagation(),e.fireSectionPlaneChangedEvent()}}))}enableCircleYMovement(){var e=this,t=this.config.colors;document.addEventListener("mousemove",(function(i){if(1==e.circleYMouseDown){e.drawingImpl.show("dashLineY",!0),e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1,e.viewer.modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_PLANE_MOUSE_MOVE,onClipPlane:!0});var n=e.fillClipPlane.normalIndex,o=e.viewportOffset,s=new THREE.Vector2(i.clientX-o.left,i.clientY-o.top),r=e.calcRotateAngleIndex(s,e.coordinateSystem.discretePointsY);1==e.firstClickDown&&(e.lastIndex=r);var a=2*(r-e.lastIndex);n>3&&(a=-a,"Reverse"==e.coordinateSystem.planeDirection&&(a=-a)),e.drawingImpl.show("tipArcX",!1),e.coordinateSystem.updateAxisZ();var l=e.fillClipPlane.renderClipPlane.normal.clone(),h=e.coordinateSystem.getCoordinateAxis(),d=e.config.styles;e.coordinateSystem.drawClipPlaneCircle("tipArcZ",h.start.clone(),d.auxCircleRadius,e.coordinateSystem.dirX.clone(),l.clone());var c=e.coordinateSystem.drawingToCanvas(h.start.clone()),u=e.coordinateSystem.drawingToCanvas(h.endX.clone());e.coordinateSystem.drawAxisX(c,u,t.highLight),e.coordinateSystem.drawCubeY("cubeY",u,d.cubeRadius),e.drawingImpl.show("cubeX",!1);var p="z";n>3&&(p="y"),e.fillClipPlane.rotateAngleOffset(a,p),e.coordinateSystem.backwardCoordinate(),1==e.firstClickDown?e.firstClickDown=!1:e.lastIndex=r,e.translateStartPt.set(i.clientX,i.clientY),e.viewer.render(),i.preventDefault(),i.stopPropagation(),e.fireSectionPlaneChangedEvent()}}))}registerTipArcXEvents(){var e=this,t=this.config.colors,i=this.drawingImpl.getDrawable("tipArcX");i.onmouseover=function(){0==e.circleYMouseDown&&(e.coordinateSystem.arcToCircle("tipArcX"),e.drawingImpl.setColor("tipArcY",t.default),e.drawingImpl.fill("cubeY",t.default),e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.registerCircleXEvents())},i.onmouseout=function(){0==e.circleXMouseDown&&e.coordinateSystem.circleToArc("tipArcX")}}registerTipArcYEvents(){var e=this,t=this.config.colors,i=this.drawingImpl.getDrawable("tipArcY");i.onmouseover=function(){0==e.circleXMouseDown&&(e.coordinateSystem.arcToCircle("tipArcY"),e.drawingImpl.setColor("tipArcX",t.default),e.drawingImpl.fill("cubeX",t.default),e.drawingImpl.setColor("axisZ",t.default),e.drawingImpl.fill("arrow",t.default),e.registerCircleYEvents())},i.onmouseout=function(){0==e.circleYMouseDown&&e.coordinateSystem.circleToArc("tipArcY")}}calcRotateAngleIndex(e,t){for(var i=this.coordinateSystem.cOrigin,n=this.createLine(e,i),o=-1,s=Number.POSITIVE_INFINITY,r=0;r<90;r++){var a=t[r].clone(),l=this.disPointToLine(a,n);l<s&&(s=l,o=r)}var h=90+o;return t[o].clone().distanceTo(e)<t[h].clone().distanceTo(e)?o:h}createLine(e,t){var i={};if(e.x==t.x)i.A=1,i.B=0,i.C=-e.x;else{var n=(t.y-e.y)/(t.x-e.x),o=t.y-n*t.x;i.A=n,i.B=-1,i.C=o}return i}disPointToLine(e,t){return Math.abs(t.A*e.x+t.B*e.y+t.C)/Math.sqrt(t.A*t.A+t.B*t.B)}fireSectionPlaneChangedEvent(){const e=this.coordinateSystem.viewer._sectionPlane;this.eventManager.fireEvent(this.sectionPlaneEvent.SectionPlaneChanged,e.getSectionPlane())}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").CoordinateSystemConfig=function(){return{colors:{tipArcX:"#0000FF",cubeX:"#0000FF",tipArcY:"#FF0000",cubeY:"#FF0000",highLight:"#FFFF00",tipLine:"#11DAB7",arrow:"#11DAB7",default:"#A9A9A9"},styles:{dashArray:"10 8",originRadius:5,auxCircleRadius:100,tipLineLength:500,cubeRadius:5,axisXWidth:2,axisYWidth:2,axisZWidth:3,axisXLength:100,axisYLength:100,axisZLength:165,segments:180,tipArcLeftCounts:15,tipArcRightCounts:60}}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");const t="#A8A8A8",i="#F9E000",n="#32D3A6",o="#FFA200",s="#FF2905",r="#1922FB";class a{constructor(e){let t=new THREE.ShaderMaterial({type:"BasicMaterial",uniforms:THREE.UniformsUtils.clone(THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog])),fragmentShader:"\n uniform vec3 diffuse;\n uniform float opacity;\n\n void main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <alphatest_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n\n }\n ",clipping:!1});return Object.defineProperties(t,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}}}),t.setValues(e),t}}e.CoordinateControl=class{constructor(e){this.object3D=new THREE.Object3D,this.name="SectionPlaneControl",this._config=e,this.viewer=e.viewer,this.system=e.system,this.cameraControl=this.viewer.getViewer().cameraControl,this.fillClipPlane=CLOUD$1.FillClipPlaneManager.getInstance(this.viewer.getViewer().getScene()),this.eventManager=this.system.viewer.getEventManager(),this.sectionPlaneEvent=Glodon$1.Bimface.Plugins.Section.SectionPlaneEvent,this.viewportOffset=this.viewer.getViewer().domElement.getBoundingClientRect(),this.defaultDistance=1500,this.firstClickDown=!0,this.arrowMouseDown=!1,this.circleXMouseDown=!1,this.circleYMouseDown=!1,this.centerPosition=null,this.projectCenterPosition=new THREE.Vector3,this.planeMouseDown=!1,this.translateStartPt=new THREE.Vector2,this.object3D.visible=!1,this._destroyed=!1,this.raycaster=new THREE.Raycaster;let t=this;this.domElementEvents=[{element:this.viewer.getViewer().domElement,type:"mousemove",event:e=>{if(this.arrowMouseDown){if(t.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1,this.viewer.getViewer().modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_PLANE_MOUSE_MOVE,onClipPlane:!0}),!(e.clientX==t.translateStartPt.x&&e.clientY==t.translateStartPt.y)){var i=t.fillClipPlane.renderClipPlane,n=i.normal.clone();n.w=i.constant;var o=t.cameraControl.movePlane(n,e,t.translateStartPt,!1,t.fillClipPlane.state.position.clone());null!=o&&t.fillClipPlane.offset(o),t.translateStartPt.set(e.clientX,e.clientY),t.cameraControl.setCameraChanging(!0),t.cameraControl.update(!0)}this.centerPosition&&(this.centerPosition=this.fillClipPlane.state.position.clone().add(this.dirCenter.clone().multiplyScalar(this.lengthCenter||0)),this.fillClipPlane.updateBasePoint(this.centerPosition),this.fillClipPlane.update());let s=this.centerPosition?this.centerPosition:this.fillClipPlane.state?this.fillClipPlane.state.position:this.fillClipPlane.position;return this.object3D.position.set(s.x,s.y,s.z),t.update(),t.fireSectionPlaneChangedEvent(),e.preventDefault(),void e.stopPropagation()}if(this.circleYMouseDown){t.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1;let i=this.system.getCoordinateAxisForPoint(this.centerPosition);var s=t.fillClipPlane.normalIndex;let n=this.getIntersectPosition({x:e.clientX,y:e.clientY},this.intersectPlane);this.oldDir||(this.oldDir=n.clone().sub(i.start.clone()).normalize());let o=n.clone().sub(i.start.clone()).normalize();const r=this.oldDir.clone().cross(o);let a=o.angleTo(this.oldDir);r.angleTo(this.intersectPlane.normal)<Math.PI/2&&(a=-a);let l=new THREE.Vector3(0,0,1);0==s||1==s?(0==s&&(a=-a),l=new THREE.Vector3(0,0,1)):2==s||3==s?(2==s&&(a=-a),l=new THREE.Vector3(1,0,0)):4!=s&&5!=s||(l=new THREE.Vector3(1,0,0));const h=i.start.clone().sub(t.fillClipPlane.state.position);t.fillClipPlane.state.position.add(h);const d=t.fillClipPlane.state.quaternion.clone().invert(),c=(new THREE.Quaternion).setFromAxisAngle(l,a);t.fillClipPlane.state.quaternion.multiply(c),t.fillClipPlane.state.position.sub(h.applyQuaternion(d).applyQuaternion(t.fillClipPlane.state.quaternion)),t.fillClipPlane.update();let u=t.fillClipPlane.uniforms.vClipPlane.value[0],p=(new THREE.Plane).setComponents(-u.x,-u.y,-u.z,-u.w),g=p.distanceToPoint(t.fillClipPlane.center);return t.fillClipPlane.planeOffset=g,t.fillClipPlane.state.planeMeshCenter.copy(t.fillClipPlane.center).add(p.normal.clone().multiplyScalar(g)),this.oldDir=o,t.update(),t.viewer.render(),e.preventDefault(),e.stopPropagation(),void t.fireSectionPlaneChangedEvent()}if(this.circleXMouseDown){t.fillClipPlane.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1;var r=this.system.getCoordinateAxisForPoint(this.centerPosition);s=t.fillClipPlane.normalIndex;let i=this.getIntersectPosition({x:e.clientX,y:e.clientY},this.intersectPlane);this.oldDir||(this.oldDir=i.clone().sub(r.start.clone()).normalize());let n=i.clone().sub(r.start.clone()).normalize();const o=this.oldDir.clone().cross(n);let a=n.angleTo(this.oldDir);o.angleTo(this.intersectPlane.normal)<Math.PI/2&&(a=-a);let l=new THREE.Vector3(0,1,0);0==s||1==s||2==s||3==s?l=new THREE.Vector3(0,1,0):4!=s&&5!=s||(4==s&&(a=-a),l=new THREE.Vector3(0,0,1));const h=r.start.clone().sub(t.fillClipPlane.state.position);t.fillClipPlane.state.position.add(h);const d=t.fillClipPlane.state.quaternion.clone().invert(),c=(new THREE.Quaternion).setFromAxisAngle(l,a);t.fillClipPlane.state.quaternion.multiply(c),t.fillClipPlane.state.position.sub(h.applyQuaternion(d).applyQuaternion(t.fillClipPlane.state.quaternion)),t.fillClipPlane.update(),this.oldDir=n;let u=t.fillClipPlane.uniforms.vClipPlane.value[0],p=(new THREE.Plane).setComponents(-u.x,-u.y,-u.z,-u.w),g=p.distanceToPoint(t.fillClipPlane.center);return t.fillClipPlane.planeOffset=g,t.fillClipPlane.state.planeMeshCenter.copy(t.fillClipPlane.center).add(p.normal.clone().multiplyScalar(g)),t.update(),t.viewer.render(),e.preventDefault(),e.stopPropagation(),void t.fireSectionPlaneChangedEvent()}if(this.planeMouseDown){var a=new THREE.Vector2(e.clientX-this.offsetCenterPoint.x+t.viewportOffset.left,e.clientY-this.offsetCenterPoint.y+t.viewportOffset.top),l=this.viewer.getViewer().cameraControl.getRaycaster(a.x,a.y),h=[];if(this.fillClipPlane.planeMesh.raycast(l,h),h.length>0){const e=h[0].point;t.centerPosition=e,t.fillClipPlane.updateBasePoint(t.centerPosition)}let i=this.centerPosition?this.centerPosition:this.fillClipPlane.state?this.fillClipPlane.state.position:this.fillClipPlane.position;return this.object3D.position.set(i.x,i.y,i.z),t.update(),t.viewer.render(),e.preventDefault(),void e.stopPropagation()}a=new THREE.Vector2(e.clientX,e.clientY);let d=(l=this.viewer.getViewer().cameraControl.getRaycaster(a.x,a.y)).ray.origin.clone(),c=l.ray.direction.clone();this.raycaster.set(d,c),this.hitTest(this.raycaster)}},{element:this.viewer.getViewer().domElement,type:"mousedown",event:e=>{if(this.picked){if(this.centerPosition||(this.centerPosition=this.system.getCoordinateAxisForPoint().start),this.fillClipPlane.setBasePoint(this.centerPosition),"arrowRigidBody"==this.picked.name)this.arrowMouseDown=!0,t.translateStartPt.set(e.clientX,e.clientY),this.centerPosition&&(this.dirCenter=this.centerPosition.clone().sub(this.fillClipPlane.state.position.clone()).normalize(),this.lengthCenter=this.centerPosition.clone().sub(this.fillClipPlane.state.position.clone()).length());else if("circleEdgeRigidBodyX"==this.picked.name){this.circleXMouseDown=!0;var i=this.system.getCoordinateAxisForPoint(this.centerPosition);this.mouseDownQuaternion=this.object3D.quaternion.clone();let t=new THREE.Plane;t.setFromCoplanarPoints(i.start,i.endZ,i.endX),this.intersectPlane=t;let n=this.getIntersectPosition({x:e.clientX,y:e.clientY},t);this.oldDir=n.clone().sub(i.start.clone()).normalize()}else if("circleEdgeRigidBodyY"==this.picked.name){this.circleYMouseDown=!0;i=this.system.getCoordinateAxisForPoint(this.centerPosition);this.mouseDownQuaternion=this.object3D.quaternion.clone();let t=new THREE.Plane;t.setFromCoplanarPoints(i.start,i.endZ,i.endY),this.intersectPlane=t;let n=this.getIntersectPosition({x:e.clientX,y:e.clientY},t);this.oldDir=n.clone().sub(i.start.clone()).normalize()}else if("plane"==this.picked.name){this.planeMouseDown=!0;i=this.system.getCoordinateAxisForPoint(this.centerPosition);let t=this.viewer.worldToClient(this.viewer.sceneToWorld(i.start));this.offsetCenterPoint={x:e.clientX-t.x,y:e.clientY-t.y}}e.preventDefault(),e.stopPropagation()}}},{element:this.viewer.getViewer().domElement,type:"mouseup",event:e=>{if(t.update(),this.arrowMouseDown||this.circleXMouseDown||this.circleYMouseDown){CLOUD$1.GlobalData.ClippingCaps=!0,t.fillClipPlane.calculateClippingIds(),this.viewer.getViewer().modelManager.dispatchEvent({type:CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE_END,onClipPlane:!0})}this.arrowMouseDown=!1,this.circleXMouseDown=!1,this.circleYMouseDown=!1,this.planeMouseDown=!1,this.firstClickDown=!0,this.oldDir=null,t.viewer.render()}}],this.addDomElementEvents()}addDomElementEvents(){this.domElementEvents.forEach((({element:e,type:t,useCapture:i,event:n})=>{e.addEventListener(t,n,i)}))}getIntersectPosition(e,t){const i=this.viewer.getViewer().cameraControl.getRaycaster(e.x,e.y).ray.direction.clone().normalize(),n=this.viewer.getViewer().camera.position.clone(),o=new THREE.Ray(n,i),s=new THREE.Vector3;return o.intersectPlane(t,s),s}hitTest(e){if(this.picked=null,this.object3D.visible){if(this.object3D.children.some((t=>{const i=[];return t.canRaycast&&t.raycast(e,i),i.length>0&&(this.picked=t),i.length>0})),this.arrowHover=!1,this.planeHover=!1,this.circleEdgeXHover=!1,this.circleEdgeYHover=!1,this.picked)switch(this.lastPickedName&&this.lastPickedName==this.picked.name||this.highlightActionList.forEach((e=>e.stop())),this.lastPickedName=this.picked.name,this.picked.name){case"plane":this.planeHover=!0,this.handlePlaneHoverEvent();break;case"arrowRigidBody":this.arrowHover=!0,this.handleArrowHoverEvent();break;case"circleEdgeRigidBodyX":this.circleEdgeXHover=!0,this.handleCircleEdgeXHoverEvent();break;case"circleEdgeRigidBodyY":this.circleEdgeYHover=!0,this.handleCircleEdgeYHoverEvent()}else this.lastPickedName=null,this.handleNormaleEvent();this.viewer.render()}}handlePlaneHoverEvent(){this.axisX.visible=!0,this.axisY.visible=!0,this.axisZ.visible=!0,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!0,this.arrowHighlight.visible=!1,this.arrowGray.visible=!1,this.circleEdgeX.visible=!0,this.circleEdgeY.visible=!0,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!1,this.plane.visible=!0,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!0,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld(),this.highlightHandle([this.actionAxisZGray,this.actionSphereZGray,this.actionArrowGray,this.actionCircleEdgeXGray,this.actionCircleEdgeYGray,this.actionPlaneHightlight])}handlePlaneMoveEvent(){this.axisX.visible=!1,this.axisY.visible=!1,this.axisZ.visible=!1,this.axisDashedX.visible=!0,this.axisDashedY.visible=!0,this.axisDashedZ.visible=!0,this.axisZArrow.visible=!0,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!1,this.arrowHighlight.visible=!1,this.arrowGray.visible=!0,this.circleEdgeX.visible=!1,this.circleEdgeY.visible=!1,this.circleEdgeGrayX.visible=!0,this.circleEdgeGrayY.visible=!0,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!1,this.plane.visible=!1,this.planeGray.visible=!1,this.planeHighlight.visible=!0,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!1,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!0,this.object3D.updateMatrixWorld()}handleArrowHoverEvent(){this.axisX.visible=!0,this.axisY.visible=!0,this.axisZ.visible=!0,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!0,this.arrowHighlight.visible=!1,this.arrowGray.visible=!1,this.circleEdgeX.visible=!0,this.circleEdgeY.visible=!0,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!1,this.plane.visible=!0,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!0,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld(),this.highlightHandle([this.actionAxisZHightlight,this.actionSphereZHightlight,this.actionArrowHightlight,this.actionCircleEdgeXGray,this.actionCircleEdgeYGray,this.actionPlaneGray])}handleArrowMoveEvent(){this.axisX.visible=!1,this.axisY.visible=!1,this.axisZ.visible=!1,this.axisDashedX.visible=!0,this.axisDashedY.visible=!0,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!0,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!1,this.arrowHighlight.visible=!0,this.arrowGray.visible=!1,this.circleEdgeX.visible=!1,this.circleEdgeY.visible=!1,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!1,this.plane.visible=!1,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!1,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld()}handleCircleEdgeXHoverEvent(){this.axisX.visible=!0,this.axisY.visible=!0,this.axisZ.visible=!0,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!0,this.arrowHighlight.visible=!1,this.arrowGray.visible=!1,this.circleEdgeX.visible=!1,this.circleEdgeY.visible=!0,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!0,this.circleEdgeHoverY.visible=!1,this.plane.visible=!1,this.planeGray.visible=!0,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!0,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld(),this.highlightHandle([this.actionAxisZGray,this.actionSphereZGray,this.actionArrowGray,this.actionCircleEdgeYGray,this.actionPlaneGray,this.actionCircleEdgeHoverX])}handleCircleEdgeXMoveEvent(){this.axisX.visible=!1,this.axisY.visible=!1,this.axisZ.visible=!1,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!0,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!0,this.axisGrayZ.visible=!1,this.arrow.visible=!1,this.arrowHighlight.visible=!1,this.arrowGray.visible=!0,this.circleEdgeX.visible=!1,this.circleEdgeY.visible=!1,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!0,this.circleEdgeHoverY.visible=!1,this.plane.visible=!1,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!1,this.sphereY.visible=!1,this.sphereZ.visible=!1,this.sphereHighlightZ.visible=!0,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld()}handleCircleEdgeYHoverEvent(){this.axisX.visible=!0,this.axisY.visible=!0,this.axisZ.visible=!0,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!0,this.arrowHighlight.visible=!1,this.arrowGray.visible=!1,this.circleEdgeX.visible=!0,this.circleEdgeY.visible=!1,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!0,this.plane.visible=!1,this.planeGray.visible=!0,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!0,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld(),this.highlightHandle([this.actionAxisZGray,this.actionSphereZGray,this.actionArrowGray,this.actionCircleEdgeXGray,this.actionPlaneGray,this.actionCircleEdgeHoverY])}handleCircleEdgeYMoveEvent(){this.axisX.visible=!1,this.axisY.visible=!1,this.axisZ.visible=!1,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!0,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!0,this.axisGrayZ.visible=!1,this.arrow.visible=!1,this.arrowHighlight.visible=!1,this.arrowGray.visible=!0,this.circleEdgeX.visible=!1,this.circleEdgeY.visible=!1,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!1,this.circleEdgeHoverY.visible=!0,this.plane.visible=!1,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!1,this.sphereY.visible=!1,this.sphereZ.visible=!1,this.sphereHighlightZ.visible=!0,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld()}handleNormaleEvent(){this.axisX.visible=!0,this.axisY.visible=!0,this.axisZ.visible=!0,this.axisDashedX.visible=!1,this.axisDashedY.visible=!1,this.axisDashedZ.visible=!1,this.axisZArrow.visible=!1,this.axisHighlightZ.visible=!1,this.axisHighlightZPoint.visible=!1,this.axisGrayZ.visible=!1,this.arrow.visible=!0,this.arrowHighlight.visible=!1,this.arrowGray.visible=!1,this.circleEdgeX.visible=!0,this.circleEdgeY.visible=!0,this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX.visible=!0,this.circleEdgeHoverY.visible=!0,this.plane.visible=!0,this.planeGray.visible=!1,this.planeHighlight.visible=!1,this.sphereX.visible=!0,this.sphereY.visible=!0,this.sphereZ.visible=!0,this.sphereHighlightZ.visible=!1,this.sphereGrayZ.visible=!1,this.object3D.updateMatrixWorld(),this.cancelHighlight()}highlightHandle(e){this.highlightActionList=[],this.animationList=[],e.map((e=>{this.highlightActionList.push(e.action),this.addAnimation(e)})),this.setHighlight()}getLinearColor(e){const t=new THREE.Color(e),i=e=>{let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t},n=i(t.r),o=i(t.g),s=i(t.b);new THREE.Color(n,o,s);return t}createLine(e,i,n={}){const o=new THREE.LineGeometry;let s;o.setPositions(i),n.isDashed?(s=new THREE.LineMaterial({color:this.getLinearColor(n.color||t),linewidth:n.linewidth||2,dashed:!0,dashSize:1,gapSize:1,dashScale:.1,depthTest:!1}),s.defines.USE_DASH=""):s=new THREE.LineMaterial({color:this.getLinearColor(n.color||t),linewidth:n.linewidth||2,dashed:!1,depthTest:!1}),s.resolution.set(this.viewer.getViewer().domElement.clientWidth,this.viewer.getViewer().domElement.clientHeight);const r=new THREE.Line2(o,s);return r.computeLineDistances(),r.renderOrder=CLOUD$1.EnumRenderOrder.Effect+1e3,r.name=e,r}createArrow(e,t,i,n){const o=new THREE.BufferGeometry,s=new Float32Array([-7,0,0,7,0,0,0,0,14]);o.setAttribute("position",new THREE.BufferAttribute(s,3));const r=new a({depthTest:!1,color:this.getLinearColor(n)}),l=new THREE.Mesh(o,r),h=new THREE.Vector3(...Object.values(i)).normalize(),d=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),h);l.applyQuaternion(d);const c=new THREE.Vector3(...Object.values(t));return l.position.set(c.x,c.y,c.z),l.name=e,l.renderOrder=CLOUD$1.EnumRenderOrder.Effect+1e3,l.updateMatrixWorld(!0),l}createArrowRigidBody(e,t,i,n){const o=i.length(),s=new THREE.CylinderGeometry(5,5,o,3),r=CLOUD$1.MaterialUtil.createStandardMaterial(n);var a=new THREE.Mesh(s,r);a.name=e;const l=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,1,0),i.clone().normalize());return a.applyQuaternion(l),a.position.set(t.x,t.y,t.z),a.canRaycast=!0,a.updateMatrixWorld(),a.visible=!1,a}createCircleEdge(e,t,i,n,o,s,r){const a=new THREE.EllipseCurve(0,0,i,i,n,n+o,!1,0).getPoints(128),l=[];a.forEach((e=>l.push(e.x||0,e.y||0,e.z||0)));const h=new THREE.LineGeometry;h.setPositions(l);let d=new THREE.LineMaterial({linewidth:s.linewidth||2,dashed:!1,depthTest:!1,transparent:!0,color:this.getLinearColor(s.color)});d.resolution.set(this.viewer.getViewer().domElement.clientWidth,this.viewer.getViewer().domElement.clientHeight);const c=new THREE.Line2(h,d);return c.name=e,c.position.set(t.x,t.y,t.z),r&&c.quaternion.set(r.x,r.y,r.z,r.w),c.renderOrder=CLOUD$1.EnumRenderOrder.Effect+100,c}createCircleEdgeRigidBody(e,i,n,o){const s=new THREE.TorusGeometry(n,3,5,16,Math.PI/2);let r=new THREE.MeshBasicMaterial({color:t});const a=new THREE.Mesh(s,r);return a.canRaycast=!0,a.name=e,a.position.set(i.x,i.y,i.z),o&&a.quaternion.set(o.x,o.y,o.z,o.w),a.visible=!1,a}createPlane(e,t,i,n){const o=new THREE.BufferGeometry,s=new Float32Array([-10,0,-10,10,0,-10,10,0,10,10,0,10,-10,0,10,-10,0,-10]);o.setAttribute("position",new THREE.BufferAttribute(s,3));const r=new a({depthTest:!1,side:2,transparent:!0,color:this.getLinearColor(n)}),l=new THREE.Mesh(o,r);i=new THREE.Vector3(...Object.values(i)).normalize();const h=new THREE.Vector3(...Object.values(t));l.position.set(h.x,h.y,h.z);let d=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,1,0),new THREE.Vector3(1,0,0));return l.quaternion.set(d.x,d.y,d.z,d.w),l.name=e,l.canRaycast=!0,l.renderOrder=CLOUD$1.EnumRenderOrder.Effect+1e3,l.updateMatrixWorld(!0),l}createSphere(e,i,n={}){var o=new THREE.SphereGeometry(6,200,200);const s=new a({depthTest:!1,transparent:!0,color:this.getLinearColor(n.color||t)});var r=new THREE.Mesh(o,s);return r.name=e,r.renderOrder=CLOUD$1.EnumRenderOrder.Effect+100,r.position.set(i.x,i.y,i.z),r}createBasicMaterial(e,t){let i=new THREE.Color(t);return new THREE.ShaderMaterial({fragmentShader:`void main() {\n\tgl_FragColor = vec4( ${i.r}, ${i.g}, ${i.b}, 1 );\n}`,...e})}getPointFormDir(e,t){var i=this.system.config.styles;return e.clone().add(t.clone().multiplyScalar(i.axisXLength))}changeVisible(e){this.object3D.visible=e,this.object3D.updateMatrixWorld()}resetCenterPosition(){this.centerPosition=null,this.fillClipPlane.updateBasePoint(this.fillClipPlane.state.position),this.update()}centerPositionProjectionToClipPlane(){if(this.centerPosition){var e=this.system.getCoordinateAxisForPoint();let t=new THREE.Plane;t.setFromCoplanarPoints(e.start,e.endY,e.endX),t.projectPoint(this.centerPosition,this.projectCenterPosition),this.centerPosition.copy(this.projectCenterPosition),this.update()}}getCoordinateAxis(){var e=new THREE.Vector3(1,0,0),t=new THREE.Vector3(0,1,0),i=new THREE.Vector3(0,0,1),n=this.system.config.styles,o=new THREE.Vector3(0,0,0),s=o.clone().add(i.clone().multiplyScalar(n.axisXLength)),r=o.clone().add(t.clone().multiplyScalar(n.axisYLength)),a=o.clone().add(e.clone().multiplyScalar(n.axisZLength)),l=o.clone().add(e.clone().multiplyScalar(n.axisXLength)),h=o.clone().add(i.clone().multiplyScalar(n.axisXLength/5)),d=o.clone().add(t.clone().multiplyScalar(n.axisYLength/5));return{start:o,endX:s,endY:r,endZ:a,endZPoint:l,endPlaneX:h,endPlaneY:d}}init(){this.addItems(),this.update(),this.animationTimeScale=4,this.highlightActionList=[],this.animationList=[],this.clock=new THREE.Clock;const e=()=>{if(this._destroyed)return;const t=this.clock.getDelta();let i=!1;this.animationList.forEach((({mixer:e,action:n,object:o})=>{n.isRunning()&&(i=!0,e.update(t),o.updateMatrixWorld(!0))})),i&&this.viewer.getViewer().render(),requestAnimationFrame(e)};e(),this.initHighlightAnimation()}setCenterPosition(e){this.centerPosition=e,this.update()}update(){let e=this.centerPosition?this.centerPosition:this.fillClipPlane.state?this.fillClipPlane.state.position:this.fillClipPlane.position;this.object3D.position.set(e.x,e.y,e.z);var t=this.system.cameraControl.camera,n=this.centerPosition||this.fillClipPlane.state.position,o=t.position.clone().sub(n.clone()).length();this.viewer.getViewer().camera.isPerspective||(o=1/(this.viewer.getViewer().camera.zoom/this.viewer.getViewer().camera.position.clone().sub(this.viewer.getViewer().camera.target.clone()).length()));var s=o/this.defaultDistance;this.object3D.scale.set(s,s,s);let r,a=this.fillClipPlane.state.quaternion;if(0===this.fillClipPlane.normalIndex?r=null:1===this.fillClipPlane.normalIndex?r=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),new THREE.Vector3(-1,0,0)):2===this.fillClipPlane.normalIndex?r=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,-1)):3===this.fillClipPlane.normalIndex?r=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1)):4===this.fillClipPlane.normalIndex?r=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0)).multiply((new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),new THREE.Vector3(0,1,0))):5===this.fillClipPlane.normalIndex&&(r=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),new THREE.Vector3(0,-1,0)).multiply((new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1)))),r&&(a=a.clone().multiply(r)),this.object3D.quaternion.set(a.x,a.y,a.z,a.w),this.planeHover&&this.handlePlaneHoverEvent(),this.planeMouseDown&&this.handlePlaneMoveEvent(),this.arrowHover&&this.handleArrowHoverEvent(),this.arrowMouseDown&&this.handleArrowMoveEvent(),this.circleEdgeXHover&&this.handleCircleEdgeXHoverEvent(),this.circleXMouseDown&&this.handleCircleEdgeXMoveEvent(),this.circleEdgeYHover&&this.handleCircleEdgeYHoverEvent(),this.circleYMouseDown&&this.handleCircleEdgeYMoveEvent(),this.axisStartDir&&this.object3D.remove(this.axisStartDir),this.circleXMouseDown||this.circleYMouseDown){let e=new THREE.Vector3(0,0,0),t=this.getPointFormDir(e,new THREE.Vector3(1,0,0));this.axisStartDir=this.createLine("axisStartDir",[...Object.values(e),...Object.values(t)],{linewidth:1,color:i});let n=this.object3D.quaternion.clone().invert();n=n.clone().multiply(this.mouseDownQuaternion.clone()),this.axisStartDir.quaternion.multiply(n),this.object3D.add(this.axisStartDir)}this.updateArrowDirection(this.arrow),this.updateArrowDirection(this.arrowHighlight),this.updateArrowDirection(this.arrowGray),this.object3D.updateMatrixWorld()}updateArrowDirection(e){const t=this.object3D.quaternion.clone().invert();let i=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,1),new THREE.Vector3(1,0,0));const n=new THREE.Vector3(0,1,0).applyQuaternion(i),o=new THREE.Plane(new THREE.Vector3(...Object.values(new THREE.Vector3(1,0,0))).normalize()),s=new THREE.Vector3;let r=this.viewer.getViewer().camera.target.clone().sub(this.viewer.getViewer().camera.position).normalize();o.projectPoint(r.clone().applyQuaternion(t),s);const a=(new THREE.Quaternion).setFromUnitVectors(n,s.normalize()).multiply(i.clone());e.quaternion.set(a.x,a.y,a.z,a.w),e.updateMatrixWorld(!0)}addItems(){var e=this.getCoordinateAxis();this.axisX&&this.object3D.remove(this.axisX),this.axisY&&this.object3D.remove(this.axisY),this.axisZ&&this.object3D.remove(this.axisZ),this.axisX=this.createLine("axisX",[...Object.values(e.start),...Object.values(e.endX)]),this.axisY=this.createLine("axisY",[...Object.values(e.start),...Object.values(e.endY)]),this.axisZ=this.createLine("axisZ",[...Object.values(e.start),...Object.values(e.endZ)],{color:n}),this.object3D.add(this.axisX),this.object3D.add(this.axisY),this.object3D.add(this.axisZ),this.axisDashedX&&this.object3D.remove(this.axisDashedX),this.axisDashedX=this.createLine("axisDashedX",[...Object.values(e.start),...Object.values(e.endX)],{isDashed:!0}),this.object3D.add(this.axisDashedX),this.axisDashedX.visible=!1,this.axisDashedY&&this.object3D.remove(this.axisDashedY),this.axisDashedY=this.createLine("axisDashedX",[...Object.values(e.start),...Object.values(e.endY)],{isDashed:!0}),this.object3D.add(this.axisDashedY),this.axisDashedY.visible=!1,this.axisDashedZ&&this.object3D.remove(this.axisDashedZ),this.axisDashedZ=this.createLine("axisDashedZ",[...Object.values(e.start),...Object.values(e.endZPoint)],{isDashed:!0}),this.object3D.add(this.axisDashedZ),this.axisDashedZ.visible=!1,this.axisZArrow&&this.object3D.remove(this.axisZArrow),this.axisZArrow=this.createLine("axisZArrow",[...Object.values(e.endZPoint),...Object.values(e.endZ)]),this.object3D.add(this.axisZArrow),this.axisZArrow.visible=!1,this.axisHighlightZ&&this.object3D.remove(this.axisHighlightZ),this.axisHighlightZ=this.createLine("axisHighlightZ",[...Object.values(e.start),...Object.values(e.endZ)],{color:i}),this.object3D.add(this.axisHighlightZ),this.axisHighlightZ.visible=!1,this.axisHighlightZPoint&&this.object3D.remove(this.axisHighlightZPoint),this.axisHighlightZPoint=this.createLine("axisHighlightZPoint",[...Object.values(e.start),...Object.values(e.endZPoint)],{color:i}),this.object3D.add(this.axisHighlightZPoint),this.axisHighlightZPoint.visible=!1,this.axisGrayZ&&this.object3D.remove(this.axisGrayZ),this.axisGrayZ=this.createLine("axisGrayZ",[...Object.values(e.start),...Object.values(e.endZ)]),this.object3D.add(this.axisGrayZ),this.axisGrayZ.visible=!1,this.arrow&&this.object3D.remove(this.arrow),this.arrow=this.createArrow("arrow",e.endZ,e.endZ.clone().sub(e.start),n),this.object3D.add(this.arrow),this.arrowHighlight&&this.object3D.remove(this.arrowHighlight),this.arrowHighlight=this.createArrow("arrowHighlight",e.endZ,e.endZ.clone().sub(e.start),i),this.object3D.add(this.arrowHighlight),this.arrowHighlight.visible=!1,this.arrowGray&&this.object3D.remove(this.arrowGray),this.arrowGray=this.createArrow("arrowGray",e.endZ,e.endZ.clone().sub(e.start),t),this.object3D.add(this.arrowGray),this.arrowGray.visible=!1;let a=(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1)),l=e.start.clone().sub(e.endX.clone()).length();this.circleEdgeX&&this.object3D.remove(this.circleEdgeX),this.circleEdgeX=this.createCircleEdge("circleEdgeX",e.start,l,.015*Math.PI,.47*Math.PI,{color:s},a),this.object3D.add(this.circleEdgeX),this.circleEdgeY&&this.object3D.remove(this.circleEdgeY),this.circleEdgeY=this.createCircleEdge("circleEdgeY",e.start,l,.015*Math.PI,.47*Math.PI,{color:r}),this.object3D.add(this.circleEdgeY),this.circleEdgeGrayX&&this.object3D.remove(this.circleEdgeGrayX),this.circleEdgeGrayX=this.createCircleEdge("circleEdgeGrayX",e.start,l,.015*Math.PI,.47*Math.PI,{color:t},a),this.object3D.add(this.circleEdgeGrayX),this.circleEdgeGrayX.visible=!1,this.circleEdgeGrayY&&this.object3D.remove(this.circleEdgeGrayY),this.circleEdgeGrayY=this.createCircleEdge("circleEdgeGrayY",e.start,l,.015*Math.PI,.47*Math.PI,{color:t}),this.object3D.add(this.circleEdgeGrayY),this.circleEdgeGrayY.visible=!1,this.circleEdgeHoverX&&this.object3D.remove(this.circleEdgeHoverX),this.circleEdgeHoverX=this.createCircleEdge("circleEdgeHoverX",e.start,l,0,2*Math.PI,{color:i,linewidth:1},a),this.object3D.add(this.circleEdgeHoverX),this.circleEdgeHoverX.material.opacity=0,this.circleEdgeHoverY&&this.object3D.remove(this.circleEdgeHoverY),this.circleEdgeHoverY=this.createCircleEdge("circleEdgeHoverY",e.start,l,0,2*Math.PI,{color:i,linewidth:1}),this.object3D.add(this.circleEdgeHoverY),this.circleEdgeHoverY.material.opacity=0,this.circleEdgeRigidBodyX&&this.object3D.remove(this.circleEdgeRigidBodyX),this.circleEdgeRigidBodyX=this.createCircleEdgeRigidBody("circleEdgeRigidBodyX",e.start,l,a),this.object3D.add(this.circleEdgeRigidBodyX),this.circleEdgeRigidBodyY&&this.object3D.remove(this.circleEdgeRigidBodyY),this.circleEdgeRigidBodyY=this.createCircleEdgeRigidBody("circleEdgeRigidBodyY",e.start,l),this.object3D.add(this.circleEdgeRigidBodyY),this.plane&&this.object3D.remove(this.plane);let h=e.endPlaneX.clone().sub(e.start.clone()),d=e.endPlaneY.clone().sub(e.start.clone()),c=h.clone().add(d);this.plane=this.createPlane("plane",e.start.clone().add(c),e.start.clone().sub(e.endZ.clone()).normalize(),o),this.object3D.add(this.plane),this.planeGray&&this.object3D.remove(this.planeGray),this.planeGray=this.createPlane("planeGray",e.start.clone().add(c),e.start.clone().sub(e.endZ.clone()).normalize(),t),this.object3D.add(this.planeGray),this.planeGray.visible=!1,this.planeHighlight&&this.object3D.remove(this.planeHighlight),this.planeHighlight=this.createPlane("planeHighlight",e.start.clone().add(c),e.start.clone().sub(e.endZ.clone()).normalize(),i),this.object3D.add(this.planeHighlight),this.planeHighlight.visible=!1,this.sphereX&&this.object3D.remove(this.sphereX),this.sphereX=this.createSphere("sphereX",e.endX),this.object3D.add(this.sphereX),this.sphereY&&this.object3D.remove(this.sphereY),this.sphereY=this.createSphere("sphereY",e.endY),this.object3D.add(this.sphereY),this.sphereZ&&this.object3D.remove(this.sphereZ),this.sphereZ=this.createSphere("sphereZ",e.endZPoint,{color:n}),this.object3D.add(this.sphereZ),this.sphereHighlightZ&&this.object3D.remove(this.sphereHighlightZ),this.sphereHighlightZ=this.createSphere("sphereHighlightZ",e.endZPoint,{color:i}),this.object3D.add(this.sphereHighlightZ),this.sphereHighlightZ.visible=!1,this.sphereGrayZ&&this.object3D.remove(this.sphereGrayZ),this.sphereGrayZ=this.createSphere("sphereGrayZ",e.endZPoint,{color:t}),this.object3D.add(this.sphereGrayZ),this.sphereGrayZ.visible=!1,this.arrowRigidBody&&this.object3D.remove(this.arrowRigidBody);let u=new THREE.Vector3((e.start.x+e.endZ.x)/2,(e.start.y+e.endZ.y)/2,(e.start.z+e.endZ.z)/2);this.arrowRigidBody=this.createArrowRigidBody("arrowRigidBody",u,e.endZ.clone().sub(e.start),{color:n}),this.object3D.add(this.arrowRigidBody),this.object3D.updateMatrixWorld()}setHighlight(){this.highlightActionList.forEach((e=>{e.timeScale=this.animationTimeScale,e.paused=!1,e.play()}))}cancelHighlight(){this.highlightActionList.forEach((e=>{e.timeScale=-this.animationTimeScale,e.paused=!1,e.play()}))}initHighlightAnimation(){this.actionAxisZGray=this.getActionHightlight(this.axisZ,this.axisZ.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionSphereZGray=this.getActionHightlight(this.sphereZ,this.sphereZ.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionArrowGray=this.getActionHightlight(this.arrow,this.arrow.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionAxisZHightlight=this.getActionHightlight(this.axisZ,this.axisZ.material.color.toArray(),new THREE.Color(this.getLinearColor(i)).toArray()),this.actionSphereZHightlight=this.getActionHightlight(this.sphereZ,this.sphereZ.material.color.toArray(),new THREE.Color(this.getLinearColor(i)).toArray()),this.actionArrowHightlight=this.getActionHightlight(this.arrow,this.arrow.material.color.toArray(),new THREE.Color(this.getLinearColor(i)).toArray()),this.actionCircleEdgeXGray=this.getActionHightlight(this.circleEdgeX,this.circleEdgeX.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionCircleEdgeYGray=this.getActionHightlight(this.circleEdgeY,this.circleEdgeY.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionPlaneGray=this.getActionHightlight(this.plane,this.plane.material.color.toArray(),new THREE.Color(this.getLinearColor(t)).toArray()),this.actionPlaneHightlight=this.getActionHightlight(this.plane,this.plane.material.color.toArray(),new THREE.Color(this.getLinearColor(i)).toArray()),this.actionCircleEdgeHoverX=this.getActionHightlight(this.circleEdgeHoverX,[0],[1],"opacity"),this.actionCircleEdgeHoverY=this.getActionHightlight(this.circleEdgeHoverY,[0],[1],"opacity")}getActionHightlight(e,t,i,n){const o=new THREE.ColorKeyframeTrack(".material.color",[0,1],[...t,...i]),s=new THREE.NumberKeyframeTrack(".material.opacity",[0,1],[...t,...i]),r=new THREE.AnimationClip("Action",1,["opacity"==n?s:o]);let a=new THREE.AnimationMixer(e),l=a.clipAction(r);return l.setLoop(THREE.LoopOnce),l.timeScale=this.animationTimeScale,l.clampWhenFinished=!0,{mixer:a,action:l,object:e}}addAnimation({mixer:e,action:t,object:i}){this.animationList.push({mixer:e,action:t,object:i})}fireSectionPlaneChangedEvent(){const e=this.system.viewer._sectionPlane;this.eventManager.fireEvent(this.sectionPlaneEvent.SectionPlaneChanged,e.getSectionPlane())}destroy(){this.object3D.clear(),this._destroyed=!0,this.centerPosition=null}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.CoordinateSystem=class{constructor(e){this.viewer=e;let t=this.viewer.getViewer();this.cameraControl=t.cameraControl,this.fillClipPlane=CLOUD$1.FillClipPlaneManager.getInstance(t.getScene()),this.container=t.domElement,this.config=new Glodon$1.Bimface.Plugins.Section.CoordinateSystemConfig,this.updateBinded=this.update.bind(this),this.initialize(),this.coordinateControl=new Glodon$1.Bimface.Plugins.Section.CoordinateControl({viewer:e,system:this}),t.getInteractionScene().add(this.coordinateControl.object3D)}initialize(){this.enable=!0,this.boundingBox=new THREE.Box2}setDirection(e){this.planeDirection=e}saveTransform(e){this.savedCamera=e.clone()}getCoordinateAxisForPoint(e){var t=this.fillClipPlane.renderClipPlane.normal.clone(),i=this.fillClipPlane.getCoordinate(),n=i.axisY.clone(),o=t.clone().cross(n.clone());this.fillClipPlane.normalIndex>3&&(n=(o=i.axisX.clone()).clone().cross(t.clone()));var s=this.cameraControl.camera;this.defaultDistance=1500;var r=this.config.styles,a=e||this.fillClipPlane.state.position.clone(),l=s.position.clone().sub(a.clone()).length(),h=a.clone().add(o.clone().multiplyScalar(l/this.defaultDistance*r.axisXLength)),d=a.clone().add(n.clone().multiplyScalar(l/this.defaultDistance*r.axisYLength)),c=a.clone().add(t.clone().multiplyScalar(l/this.defaultDistance*r.axisZLength)),u=a.clone().add(t.clone().multiplyScalar(l/this.defaultDistance*r.axisXLength)),p=a.clone().add(o.clone().multiplyScalar(l/this.defaultDistance*r.axisXLength/5)),g=a.clone().add(n.clone().multiplyScalar(l/this.defaultDistance*r.axisYLength/5));return this.dirX=o,this.dirY=n,{start:a,endX:h,endY:d,endZ:c,endZPoint:u,endPlaneX:p,endPlaneY:g}}update(e){1!=e&&1==this.bIsCoordinateHided||(this.coordinateControl.update(),this.updateBbox())}hide(e){this.bIsCoordinateHided=e,this.coordinateControl.changeVisible(!e)}destroy(){this.coordinateControl.destroy()}updateBbox(){let e=this.getCoordinateAxisForPoint(this.coordinateControl.centerPosition),t=this.viewer.worldToClient(this.viewer.sceneToWorld(e.start.clone())),i=[this.viewer.worldToClient(this.viewer.sceneToWorld(e.endX.clone())),this.viewer.worldToClient(this.viewer.sceneToWorld(e.endY.clone())),this.viewer.worldToClient(this.viewer.sceneToWorld(e.endZ.clone()))],n=t.x,o=t.y,s=t.x,r=t.y;for(let e=0;e<i.length;e++)i[e].x<n&&(n=i[e].x),i[e].x>s&&(s=i[e].x),i[e].y<o&&(o=i[e].y),i[e].y>r&&(r=i[e].y);this.boundingBox=new THREE.Box2,this.boundingBox.min=new THREE.Vector2(n,o),this.boundingBox.max=new THREE.Vector2(s,r),this.boundingBox.expandByScalar(10)}insideBoundingBox(e){return this.boundingBox.containsPoint(e.clone())}backwardCoordinate(){var e=this.cameraControl.camera.position,t=this.cameraControl.camera.target.clone().sub(e.clone()).normalize(),i=this.fillClipPlane.renderClipPlane.normal.clone();t.angleTo(i);Math.PI}}}(),function(){var e="Bimface.Plugins.Section.SectionPlane",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");let n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility");var o={Forward:0,Reverse:1},s={X:0,Y:2,Z:4},r=function(e){var t=this,i=e.viewer;if(i)if("Viewer3D"===i.viewerType||i instanceof Glodon$1.Bimface.Viewer.ViewerGIS){if(skipVueObserver(this),i._sectionBox&&(i._sectionBox.hideBox(),!1!==e.exitSectionBox&&i._sectionBox.exit()),e.hatchByMaterial&&i.getViewer().getClipCapsManager().enableHatchByMaterial(e.hatchByMaterial,!1),CLOUD$1.GlobalData.CalculateClippingLine=!!e.isOutlineEnabled,CLOUD$1.GlobalData.SnapClippingLine=!!e.enableSnap,i._sectionPlane)return i._sectionPlane.showPlane(),i._sectionPlane;i._sectionPlane=this,t.id=e.id,t._opt=e,t.mode=e.mode,t._plane=e.plane,t._direction=e.direction,t._progress=-1,this.onFloorExplosionBinded=this.onFloorExplosion.bind(this),this.onClipMouseHoverBinded=this.onClipMouseHover.bind(this),this.onClipMouseMoveBinded=this.onClipMouseMove.bind(this),this.onEditorEndBinded=this.onEditorEnd.bind(this),t.init(),t.setPlane(e.plane),this._boxSize=new THREE.Vector3,e.filter&&t.setFilter(e.filter),t.enableHatch(e.isHatchEnabled)}else console.log("viewer should be Viewer3D or ViewerGIS.");else console.log("domElement must not be empty.")};r.prototype={init:function(){t.send(e,"init"),this.enableCoordinate=!0;var i=this._opt.viewer,n=i.getViewer(),o=this;this.coordinateSystem=new Glodon$1.Bimface.Plugins.Section.CoordinateSystem(i),this.coordinateSystem.setDirection(this._direction),CLOUD$1.GlobalData.ClippingCaps=!0,n.editorManager.enableTool(n,CLOUD$1.EditToolMode.CLIP_FILL),this._sectionTool=CLOUD$1.FillClipPlaneManager.getInstance(n.getScene()),this._sectionTool.observer=function(){var e=Glodon$1.Bimface.Plugins.Section.SectionPlaneEvent;i.getEventManager().fireEvent(e.SectionPlaneUpdate,o)},this._sectionTool.enable(!0,!0),n.getModelManager().updatePickingMaterial(),this.hookEvens(),this.coordinateSystem.coordinateControl.init(),this.fireSectionPlaneVisibleChangedEvent(!0)},hookEvens:function(){var e=this.coordinateSystem,t=this._opt.viewer.getViewer(),i=n.throttle;t.registerEventListener(CLOUD$1.EVENTS.ON_CLIP_HOVER,this.onClipMouseHoverBinded),t.registerEventListener(CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE,this.onClipMouseMoveBinded),t.registerEventListener(CLOUD$1.EVENTS.ON_EDITOR_ZOOM,i(e.updateBinded,50)),t.registerEventListener(CLOUD$1.EVENTS.ON_CAMERA_ANIMATION_UPDATE,i(e.updateBinded,50)),t.registerEventListener(CLOUD$1.EVENTS.ON_EDITOR_END,this.onEditorEndBinded),this._opt.viewer.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.FloorExplosion,this.onFloorExplosionBinded)},onFloorExplosion:function(){this.resetSectionTool(),this._opt.viewer.render()},onClipMouseHover:function(e){var t=this.coordinateSystem,i=this._opt.viewer.getDomElement();if(0!=this.enableCoordinate)if(t.update(!0),e.onClipPlane)t.hide(!1);else{i.style.cursor="";var n=new THREE.Vector2(e.event.offsetX,e.event.offsetY);t.insideBoundingBox(n)?t.hide(!1):t.hide(!0)}},onClipMouseMove:function(){this.coordinateSystem.update()},onEditorEnd:function(){this.coordinateSystem.update(!0)},fireSectionPlaneMobileChangedEvent:function(){this._opt.viewer.getEventManager().fireEvent("SectionPlaneMobileChanged",this.getSectionPlane())},fireSectionPlaneStateChangedEvent:function(){this._opt.viewer.getEventManager().fireEvent("SectionPlaneStateChanged",this.getSectionPlane())},fireSectionPlaneVisibleChangedEvent:function(e){requestAnimationFrame((()=>{this._opt.viewer.getEventManager().fireEvent("SectionPlaneVisibleChanged",e)}))},exit:function(){var e=this._opt.viewer.getViewer(),t=CLOUD$1.FillClipPlaneManager.getInstance(e.getScene());this.borderParamWidth&&this.borderParamHeight&&this.setBorder(this.borderParamWidth,this.borderParamHeight,!1),this.clearFilter(),e.getModelManager().updatePickingMaterial(),e.editorManager.disableTool(CLOUD$1.EditToolMode.CLIP_FILL),t.clearCapsWireframe(),CLOUD$1.GlobalData.ClippingCaps=!1,t.enable(!1,!1),this.coordinateSystem.destroy(),e.getScene().removeObjectGroup(t),e.getScene().fillClipPlane=null,e.getClipCapsManager().resetClippingCapsStatus();let i=Glodon$1.Bimface.Plugins.Section.SectionPlaneEvent;this._opt.viewer.getEventManager().fireEvent(i.SectionPlaneUpdate,null),this._sectionTool=null,this._opt.viewer._sectionPlane=null,e.unregisterEventListener(CLOUD$1.EVENTS.ON_CLIP_HOVER,this.onClipMouseHoverBinded),e.unregisterEventListener(CLOUD$1.EVENTS.ON_CLIP_MOUSE_MOVE,this.onClipMouseMoveBinded),e.unregisterEventListener(CLOUD$1.EVENTS.ON_EDITOR_END,this.onEditorEndBinded),this._opt.viewer.removeEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.FloorExplosion,this.onFloorExplosionBinded),CLOUD$1.GlobalData.SnapClippingLine=!1,CLOUD$1.GlobalData.CalculateClippingLine=!0,this.fireSectionPlaneVisibleChangedEvent(!1)},setProgress:function(i){if(t.send(e,"setProgress"),!1!==this._sectionTool.isEnabled()){var n=1-i/50;this._progress=i,this._sectionTool.setProcess(n),this.coordinateSystem.coordinateControl.update(),this._sectionTool.calculateClippingIds(),this.coordinateSystem.coordinateControl.centerPositionProjectionToClipPlane(),this.fireSectionPlaneStateChangedEvent()}},setOriginProgress:function(e){var t=e/100;this._progress=e,this._sectionTool.setProcess(t),this.coordinateSystem.coordinateControl.update(),this._sectionTool.calculateClippingIds(),this.coordinateSystem.coordinateControl.centerPositionProjectionToClipPlane()},getOriginProgress:function(){return 100*this._sectionTool.getProcess()},setDistanceProgress:function(e){if(!e.start||0==Math.abs(e.end.x-e.start.x)&&0==Math.abs(e.end.y-e.start.y))return;let t,i,n,o,s=1;n=this._sectionTool.renderClipPlane.normal.clone().normalize(),o=n.clone().negate();const r=this._opt.viewer;if(r.getCamera()._cloudCamera.position.clone().sub(r.getCamera()._cloudCamera.target.clone()).normalize().angleTo(n)<.2)return;const a=e=>{const t=r.getViewer().cameraControl.getRaycaster(e.x,e.y),i=t.ray.direction.clone().cross(t.ray.direction.clone().cross(n.clone())).normalize(),a=new THREE.Plane(i),l=-a.distanceToPoint(r.getCamera()._cloudCamera.position);a.set(i,l),s*=1;let h=new THREE.Vector3;if(new THREE.Ray(this._sectionTool.center,n).intersectPlane(a,h),0==h.x&&0==h.y&&0==h.z){let e=n.clone();n=o.clone(),o=e,s*=-1,new THREE.Ray(this._sectionTool.center,n).intersectPlane(a,h)}return h},l=r.getViewer().getBoundingBoxWorld(),h=r.getViewer().worldToDrawing(l.max),d=r.getViewer().worldToDrawing(l.min),c=a(e.start),u=a(e.end);t=h.clone().projectOnVector(n).distanceTo(d.clone().projectOnVector(n)),i=u.clone().projectOnVector(n).distanceTo(c.clone().projectOnVector(n));const p=e.progress/100*t,g=u.clone().sub(c.clone()).angleTo(n)<.001?1:-1;this._sectionTool.setProcess((p+s*g*i)/t),this._sectionTool.clearCapsWireframe(),this._sectionTool.calculateClippingIds(),this.fireSectionPlaneMobileChangedEvent()},getProgress:function(){return 50*(1-this._sectionTool.getProcess())},changeClipDirection(){let e=this.getSectionPlane();e.normal.x=-1*e.normal.x,e.normal.y=-1*e.normal.y,e.normal.z=-1*e.normal.z;let t=this.coordinateSystem.coordinateControl.centerPosition;this.setSectionPlane(e),t&&(this.coordinateSystem.coordinateControl.centerPosition=t),this.coordinateSystem.updateBinded()},setPlane:function(i){t.send(e,"setPlane");var n=o[this._direction]+s[i];if(this._plane=i,!1===this._sectionTool.isEnabled())return;this._sectionTool.changeNormal(n),this.setProgress(this._opt.progress),this.coordinateSystem.coordinateControl.resetCenterPosition();this._opt.viewer.getViewer().getModelManager().forceUpdateGTAOPass(),this.fireSectionPlaneStateChangedEvent()},getPlane:function(){return this._plane},setDirection:function(i){t.send(e,"setDirection");var n=o[i]+s[this._plane];this._direction=i,this._sectionTool.changeNormal(n),this.setProgress(this._opt.progress);this._opt.viewer.getViewer().getModelManager().forceUpdateGTAOPass(),this.fireSectionPlaneStateChangedEvent()},getDirection:function(){return this._direction},setRotateAngle:function(e,t){this._sectionTool.setRotateAngle(e,t)},getRotateAngle:function(){return this._sectionTool.getRotateAngle()},hidePlane:function(){t.send(e,"hidePlane"),this._sectionTool&&(this._sectionTool.visible=!1),this.enableCoordinate=!1,this.coordinateSystem.hide(!0);this._opt.viewer.getViewer().getModelManager().forceUpdateGTAOPass()},showPlane:function(){if(t.send(e,"showPlane"),this._sectionTool&&!1===this._sectionTool.isEnabled())return;this._sectionTool&&(this._sectionTool.visible=!0),this.enableCoordinate=!0;this._opt.viewer.getViewer().getModelManager().forceUpdateGTAOPass()},rotateByAxis:function(i,n,r=!0){if(t.send(e,"rotateByAxis"),"YAxis"===i||"ZAxis"===i){var a="",l=0,h=o[this.getDirection()]+s[this._plane];0==h||1==h?(l="YAxis"===i?-n:n,a="YAxis"===i?"y":"z"):2==h||3==h?(l="YAxis"===i?-n:n,a="YAxis"===i?"x":"z"):4!=h&&5!=h||(l="YAxis"===i?n:-n,a="YAxis"===i?"x":"y"),l="Reverse"===this._direction?n:l,this._sectionTool&&(this._sectionTool.rotateAngleOffset(l,a),r&&this._sectionTool.calculateClippingIds()),this.fireSectionPlaneStateChangedEvent()}else console.log("Rotate axis must be YAxis or ZAxis.")},reset:function(){t.send(e,"reset");var i=this;i.setPlane(i._opt.plane),i.setDirection(i._opt.direction),i.setProgress(i._opt.progress)},enable:function(i){t.send(e,"enable"),!i&&this._sectionTool.clearCapsWireframe(),this.borderParamWidth&&this.borderParamHeight&&this.setBorder(this.borderParamWidth,this.borderParamHeight,i),this._sectionTool.enable(i,i),i&&this._sectionTool.reCalculateClippingIds(),i?this.showPlane():this.hidePlane(),this._opt.viewer.render(),this.fireSectionPlaneVisibleChangedEvent(i)},getState:function(){return this._sectionTool.store()},isIncluded:function(e){var t=this._opt.viewer,i=t.getViewer().getScene(),n=CLOUD$1.FillClipPlaneManager.getInstance(i),o=n.renderClipPlane.normal.clone().normalize(),s=n.state.position,r=t.worldToScene(e),a=new THREE.Vector3;return a.subVectors(r,s).normalize(),o.angleTo(a)>Math.PI/2},setPositionByPlane:function(e,t,n){if(!1===this._sectionTool.isEnabled())return;var o=this._opt.viewer;e=o.worldToScene(e),t=o.getViewer().worldToDrawing(t),n=o.globalUnitUtil.translate(n);var s=new THREE.Vector3(e.x,e.y,e.z),r=new THREE.Vector3(t.x,t.y,t.z),a=s.clone().add(r.clone().multiplyScalar(n));this._opt.plane=i.SectionPlanePlane.X,this._opt.direction=i.SectionPlaneDirection.Forward,this.reset(),this._sectionTool.update();var l=new THREE.Vector3(1,0,0),h=new THREE.Vector3(0,1,0);let d=1,c=r.clone().projectOnPlane(h);if(c.length()>1e-6){c.normalize(),d=l.clone().cross(c).y>0?1:-1;let e=l.clone().angleTo(c);this.rotateByAxis("ZAxis",e*THREE.Math.RAD2DEG*d,!1)}let u=c.clone().angleTo(r.clone());if(d=r.y<0?1:-1,this.rotateByAxis("YAxis",u*THREE.Math.RAD2DEG*d,!1),"ViewerGIS"===o.viewerType)this._sectionTool.state.position.copy(a),this._sectionTool.state.planeMeshCenter.copy(a),this._sectionTool.updateBasePoint(a);else{const e=a.clone().sub(this._sectionTool.center).projectOnVector(r);let t=e.length();Math.abs(e.angleTo(r))>Math.PI/2&&(t*=-1);t+=.1,this._sectionTool.setOffset(t),this.coordinateSystem.coordinateControl.update()}this._sectionTool.update(),this._sectionTool.calculateClippingIds(),this.fireSectionPlaneStateChangedEvent()},setState:function(i){t.send(e,"setState");let n=i.quaternion;i.quaternion&&i.quaternion instanceof Array&&(n=new THREE.Quaternion(...i.quaternion)),this._sectionTool.restore({...i,quaternion:n}),this.coordinateSystem.coordinateControl.centerPosition=i.basePoint?new THREE.Vector3(i.basePoint.x,i.basePoint.y,i.basePoint.z):new THREE.Vector3(i.position.x,i.position.y,i.position.z),this.fireSectionPlaneStateChangedEvent()},restoreRotation:function(){this._sectionTool.restoreRotation(),this._sectionTool.update(),this.coordinateSystem.coordinateControl.setCenterPosition(this._sectionTool.state.position),this._sectionTool.clearCapsWireframe(),this._sectionTool.calculateClippingIds(),this.fireSectionPlaneStateChangedEvent()},getSectionPlane:function(){var e=this._opt.viewer,t=this._sectionTool.state.position.clone(),i=this._sectionTool.renderClipPlane.normal.clone();return t=e.sceneToWorld(t),i=e.sceneToWorld(i),(i=new THREE.Vector3(i.x,i.y,i.z)).normalize(),{position:t,normal:i}},setSectionPlane:function(e){var t=this._opt.viewer;this.coordinateSystem.coordinateControl.centerPosition;this.reset();var i=t.worldToScene(e.position),n=t.worldToScene(e.normal);(n=new THREE.Vector3(n.x,n.y,n.z)).normalize();var o=new THREE.Vector3(1,0,0),s=new THREE.Quaternion;s.setFromUnitVectors(o,n);var r=new THREE.Euler;r.setFromQuaternion(s),r.x=0,s.setFromEuler(r),s.x=-s.x;var a=this._sectionTool.uniforms.vClipPlane.value[0].clone(),l=new THREE.Vector3(a.x,a.y,a.z);l.normalize();var h=new THREE.Vector3(i.x,i.y,i.z).sub(this._sectionTool.center);this._sectionTool.planeOffset=h.x/l.x,this._sectionTool.state.quaternion.copy(s),this._sectionTool.state.position.copy(i),this._sectionTool.updateBasePoint(i),this._sectionTool.update(),this._sectionTool.calculateClippingIds(),this.fireSectionPlaneStateChangedEvent()},resetSectionTool:function(){var e=this._opt.viewer.getViewer().getScene(),t=e.getBoundingBox();t.getSize(this._boxSize),this._sectionTool.resize(this._boxSize.multiplyScalar(e.expandScalar)),t.getCenter(this._sectionTool.center),t.getCenter(this._sectionTool.state.position),this.coordinateSystem.coordinateControl.centerPosition=this._sectionTool.state.position.clone(),this._sectionTool.setBasePoint(this._sectionTool.state.position),this._sectionTool.update(),this._sectionTool.clearCapsWireframe(),this._sectionTool.calculateClippingIds(),this.fireSectionPlaneStateChangedEvent()},setObjectsById(e){this._opt.viewer.getModels().forEach((t=>{t.localClippingComponentsById(e)})),this._sectionTool.update(),this._opt.viewer.render()},setObjectsByObjectData(e){this._opt.viewer.getModels().forEach((t=>{t.localClippingComponentsByObjectData(e)})),this._sectionTool.update(),this._opt.viewer.render()},restoreObjects(){this._opt.viewer.getModels().forEach((e=>{e.clearLocalClipping()})),this._sectionTool.update(),this._opt.viewer.render()},setFilter(e){if(e&&e instanceof Array){var t=this._opt.viewer,i=t.getViewer();if("Viewer3D"===t.viewerType)for(var n=0;n<e.length;n++){let i=null;if((o=e[n]).modelId){let e=t.getModel(o.modelId);if(!e){console.warn("invalid modelId.");continue}i=e}else if(i=t.getModel(),!i){console.warn("invalid modelId.");continue}o.objectIds||o.objectData?o.objectIds?i.localClippingComponentsById(o.objectIds):o.objectData&&i.localClippingComponentsByObjectData(o.objectData):t.getViewer().modelManager.getModel(i.modelId).enableLocalClippingMode(!0)}else if(t instanceof Glodon$1.Bimface.Viewer.ViewerGIS)for(n=0;n<e.length;n++){var o;if(!(o=e[n]).layerId){console.warn("invalid layerId.");continue}var s=t.getLayerManager().getLayer(o.layerId);if(!s){console.warn("invalid layerId.");continue}const i=t.getModel(s.customId||s.modelId);i?o.objectIds||o.objectData?o.objectIds?i.localClippingComponentsById(o.objectIds):o.objectData&&i.localClippingComponentsByObjectData(o.objectData):t.getViewer().modelManager.getModel(i.modelId).enableLocalClippingMode(!0):console.warn("invalid layerId.")}this._sectionTool.update(),this._sectionTool.clearCapsWireframe(),this._sectionTool.calculateClippingIds(),i.getModelManager().updatePickingMaterial(),this.fireSectionPlaneVisibleChangedEvent(!1),this._opt.viewer.render()}else console.log("filter should be Array.")},clearFilter(){var e=this._opt.viewer;e.getModels().forEach((t=>{e.getViewer().modelManager.getModel(t.modelId).enableLocalClippingMode(!1)})),this.restoreObjects(),this.fireSectionPlaneVisibleChangedEvent(!0)},setBorder(e,t,i){this.borderParamWidth=e,this.borderParamHeight=t;var n=20,o=20;"Viewer3D"===this._opt.viewer.viewerType?(n=this._opt.viewer.worldToScene({x:e,y:0,z:0}).x,o=this._opt.viewer.worldToScene({x:t,y:0,z:0}).x):this._opt.viewer instanceof Glodon$1.Bimface.Viewer.ViewerGIS&&(n=e?this._opt.viewer.globalUnitUtil.translate(e):n,o=t?this._opt.viewer.globalUnitUtil.translate(t):o),n=Math.max(1,n),o=Math.max(1,o),this._sectionTool.setBorder(n,o,i),this.coordinateSystem.coordinateControl.setCenterPosition(this._sectionTool.state.position),this._sectionTool.calculateClippingIds()},drawComponentContours(){let e=this._opt.viewer.getViewer().getScene().getOrCreateObjectGroup(CLOUD$1.ObjectGroupType.CAPSWIREFRAME,{globalSpace:!0});const t=this._sectionTool.capsIntersectContour;for(const i in t){const n=t[i],o=this._opt.viewer.getModel(i).getModelTransformationAdaptedUnit();(new THREE.Matrix4).fromArray(o);for(const t in n){n[t].clippingContours.map((t=>{t.map((t=>{const i=new THREE.BufferGeometry;i.setFromPoints(t),i.computeBoundingSphere();let n=new THREE.Line(i,new THREE.LineBasicMaterial({color:16711680,depthTest:!1}));e.add(n),n.updateMatrixWorld(!0)}))}))}}},getComponentContours(e,t){if(!this._sectionTool)return void console.warn("The SectionPlane is unavailable");const i=this._opt.viewer;let n=e;if(i instanceof Glodon$1.Bimface.Viewer.ViewerGIS){const t=i.getLayerManager().getLayer(e);if(!t)return void console.warn("Parameter layerId is invalid.");n=t.getModelId()}const o=i.getModel(n);if(!o)return void console.warn("Parameter modelId is invalid.");let s=o.getComponentContours(t);if(i instanceof Glodon$1.Bimface.Viewer.ViewerGIS){const t=s.length;for(let i=0;i<t;++i)delete s[i].modelId,s[i].layerId=e}return s},enableHatch(e){this._opt.viewer._sectionBox||CLOUD$1.GlobalData.ClippingCapsType!=e&&CLOUD$1.GlobalData.ClippingCapsType!=CLOUD$1.EnumClippingCapsTypes.ClipBox&&(CLOUD$1.GlobalData.ClippingCapsType=e?CLOUD$1.EnumClippingCapsTypes.ClipPlane:CLOUD$1.EnumClippingCapsTypes.None,this._opt.viewer.render())},isHatchEnabled:()=>CLOUD$1.GlobalData.ClippingCapsType==CLOUD$1.EnumClippingCapsTypes.ClipPlane,enableSnap(e){CLOUD$1.GlobalData.SnapClippingLine=!!e},enableOutline(e){CLOUD$1.GlobalData.CalculateClippingLine!==e&&(CLOUD$1.GlobalData.CalculateClippingLine=!!e,this._sectionTool.calculateClippingIds())}},i.SectionPlane=r}();class SectionRegionConfig{constructor(){const e={viewer:null,boundary:null,height:0,enableSnap:!0,filter:null,isOutlineEnabled:!0};for(let t in e)this[t]=e[t]}}Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionRegionConfig=SectionRegionConfig;class SectionRegion{constructor(e){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance().send("Bimface.Plugins.Section.SectionRegion","bf_c_SectionRegion_new");let t=e.viewer;if(!t)return void console.log("domElement must not be empty.");const i="Viewer3D"===t.viewerType,n=t instanceof Glodon$1.Bimface.Viewer.ViewerGIS;if(i||n){if(skipVueObserver(this),CLOUD$1.GlobalData.CalculateClippingLine=!!e.isOutlineEnabled,CLOUD$1.GlobalData.SnapClippingLine=!!e.enableSnap,t._sectionPlane&&(t._sectionPlane.hidePlane(),t._sectionPlane.exit()),t._sectionBox&&(t._sectionBox.hideBox(),t._sectionBox.exit()),t._sectionRegion)return t._sectionRegion;t._sectionRegion=this,this.eventManager=t.getEventManager(),this._opt=e,this._viewer=t,this.cloudViewer=this._viewer.getViewer(),this._disableFilter=!0,this.reset(),e.filter&&this.setFilter(e.filter)}else console.log("Viewer2D is not supported.")}init(){const e=this.cloudViewer.getScene().getMatrixGlobal();let t=this.boundary[0].z;this.height<0&&(t+=this.height);let i=this.boundary.map((e=>new THREE.Vector3(e.x,e.y,t)));i.push(i[0]),SectionRegion.isClockwiseBoundary(i)||i.reverse(),CLOUD$1.ClipRegionManager.setEnableFilter(!1),i=this._viewer.globalUnitUtil.translate(i,["x","y","z"]);for(let t=0;t<i.length;t++)i[t]=new THREE.Vector3(i[t].x,i[t].y,i[t].z).applyMatrix4(e);let n=this._viewer.globalUnitUtil.translate(this.height);n=new THREE.Vector3(0,0,n).applyMatrix4(e).y,CLOUD$1.ClipRegionManager.setClipRegion(this.cloudViewer,i,Math.abs(n)),this._viewer.render()}changeClipDirection(e){this.clipDirection=e,CLOUD$1.ClipRegionManager.changeClipDirection(this.cloudViewer,e),this._viewer.render()}reset(){this.boundary=this._opt.boundary,Glodon$1.Bimface.Plugins.Geometry.PlaneBufferGeometry.checkIntersect(this.boundary)?console.warn("Failed to create plane, the plane border is self-intersecting."):(this.height=this._opt.height,this.init(),this.changeClipDirection(!1))}enable(e){e?(this.init(),this.changeClipDirection(this.clipDirection)):this.exit()}exit(){CLOUD$1.ClipRegionManager.exit(this.cloudViewer),this._viewer.render(),this._viewer._sectionRegion=null,CLOUD$1.GlobalData.SnapClippingLine=!1,CLOUD$1.GlobalData.CalculateClippingLine=!0}hide(){CLOUD$1.ClipRegionManager.hide(this.cloudViewer),this._viewer.render()}show(){CLOUD$1.ClipRegionManager.show(this.cloudViewer),this._viewer.render()}getBoundary(){return this.boundary}getHeight(){return this.height}setHeight(e){this.height=e,this.init()}setBoundary(e){Glodon$1.Bimface.Plugins.Geometry.PlaneBufferGeometry.checkIntersect(e)?console.warn("Failed to create plane, the plane border is self-intersecting."):(this.boundary=e,this.init())}setFilter(e){if(!(e&&e instanceof Array))return void console.log("conditions should be Array.");let t=!1;CLOUD$1.ClipRegionManager.setEnableFilter(!0);var i=this._opt.viewer,n=i.getViewer();if("Viewer3D"===i.viewerType)for(var o=0;o<e.length;o++){let n=null;if((s=e[o]).modelId){let e=i.getModel(s.modelId);if(!e){console.warn("invalid modelId.");continue}n=e}else if(n=i.getModel(),!n){console.warn("invalid modelId.");continue}t=!0,s.objectIds||s.objectData?s.objectIds?n.localClippingComponentsById(s.objectIds):s.objectData&&n.localClippingComponentsByObjectData(s.objectData):n.localClippingComponentsByObjectData([])}else if(i instanceof Glodon$1.Bimface.Viewer.ViewerGIS)for(o=0;o<e.length;o++){var s;if(!(s=e[o]).layerId){console.warn("invalid layerId.");continue}var r=i.getLayerManager().getLayer(s.layerId);if(!r){console.warn("invalid layerId.");continue}const n=i.getModel(r.customId||r.modelId);n?(t=!0,s.objectIds||s.objectData?s.objectIds?(i.getViewer().modelManager.getModel(n.modelId).enableLocalClippingMode(!0),n.localClippingComponentsById(s.objectIds)):s.objectData&&(i.getViewer().modelManager.getModel(n.modelId).enableLocalClippingMode(!0),n.localClippingComponentsByObjectData(s.objectData)):(i.getViewer().modelManager.getModel(n.modelId).enableLocalClippingMode(!0),n.localClippingComponentsByObjectData([]))):console.warn("invalid layerId.")}t||CLOUD$1.ClipRegionManager.setEnableFilter(!1),CLOUD$1.ClipRegionManager.setUpdateOnce(),n.getModelManager().updatePickingMaterial(),this._viewer.render()}clearFilter(){this._opt.viewer.getModels().forEach((e=>{e.clearLocalClipping()})),CLOUD$1.ClipRegionManager.setEnableFilter(!1),this._disableFilter=!0,CLOUD$1.ClipRegionManager.setUpdateOnce(),this._opt.viewer.render()}enableSnap(e){CLOUD$1.GlobalData.SnapClippingLine=!!e}enableOutline(e){CLOUD$1.GlobalData.CalculateClippingLine!==e&&(CLOUD$1.GlobalData.CalculateClippingLine=!!e)}static isClockwiseBoundary(e){let t=0;const i=e.length;for(let n=0;n<i-1;n++)t+=-.5*(e[n+1].y+e[n].y)*(e[n+1].x-e[n].x);return!(t>0)}}Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Section").SectionRegion=SectionRegion,Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Walkthrough").WalkthroughConfig=function(){return{viewer:null,time:10,stopCallback:null,camera:null}},function(){var e="Bimface.Plugins.Walkthrough",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Walkthrough");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");i.Walkthrough=class{constructor(e){var t=e.viewer,i=t.getViewer();t?"Viewer3D"===t.getViewerType()||"ViewerGIS"===t.getViewerType()?(skipVueObserver(this),this._viewer=t,this.bPause=!1,this.cameraStatus=null,this._walkthrough=new CLOUD$1.Walkthrough,this._player=new CLOUD$1.WalkthroughPlayer(i),this._player.setWalkthrough(this._walkthrough),e.stopCallback&&this._player.addStopPlayCallback(e.stopCallback),this.setWalkthroughTime(e.time),this.console=new Glodon$1.Web.Common.Console,this.camera=e.camera,this.nearPoint=null,this.farPoint=null):console.log("ViewerType is not supported."):console.log("viewer must not be empty.")}addKeyFrame(i){t.send(e,"addKeyFrame");var n=this._viewer,o=n.getViewer().camera,s={id:Glodon$1.Web.Lang.Utility.UUID.createUUID(),position:o.position.clone(),target:o.target.clone(),name:i};if(this._walkthrough.addKeyFrame(s),this._walkthrough.checkFrameTimeMode()){const e=this._walkthrough.getKeyFrames();e.length>1&&void 0===e[e.length-2].timeBetweenFrames&&(e[e.length-2].timeBetweenFrames=5)}var r=Object.assign({},s);return r.position=n.sceneToWorld(s.position),r.target=n.sceneToWorld(s.target),r.coordinateSystem="world",r}setKeyFrameCallback(i){t.send(e,"setKeyFrameCallback"),this._player.setKeyFrameCallback(i)}removeKeyFrame(i){t.send(e,"removeKeyFrame"),this._walkthrough.removeKeyFrame(i)}clearKeyFrames(){t.send(e,"clearKeyFrames"),this._walkthrough.clearFrames()}setKeyFrames(i){t.send(e,"setKeyFrames"),"string"==typeof i&&(i=JSON.parse(i));var n=[];i.forEach((e=>{var t=Object.assign({},e);"world"===t.coordinateSystem&&(t.position=this._viewer.worldToScene(e.position),t.target=this._viewer.worldToScene(e.target)),n.push(t)})),this._walkthrough.setKeyFrameList(n)}getKeyFrames(){var e=this._walkthrough.getKeyFrames(),t=[];return e.forEach((e=>{var i=Object.assign({},e);i.position=this._viewer.sceneToWorld(e.position),i.target=this._viewer.sceneToWorld(e.target),i.coordinateSystem="world",t.push(i)})),t}setWalkthroughTime(i){t.send(e,"setWalkthroughTime"),DataUtil.assertType(i,"obj")?i.frameTime?this._walkthrough.setWalkthroughTime(i.frameTime):this._walkthrough.setWalkthroughTime(i.totalTime):this._walkthrough.setWalkthroughTime(i)}setCamera(e){if(!e||!e.near&&!e.far)return;this.camera=e,this.cameraStatus=this._viewer.getCameraStatus();const t=this.cameraStatus.position,i=this.cameraStatus.target,n=new THREE.Vector3(i.x-t.x,i.y-t.y,i.z-t.z).normalize(),o=this._viewer.getViewer(),s=this._viewer.globalUnitUtil;if(this.camera.near){const e=this.camera.near;this.nearPoint={x:t.x+e*n.x,y:t.y+e*n.y,z:t.z+e*n.z},this.nearPoint=s.translateVector(this.nearPoint),this.nearPoint=o.worldToDrawing(this.nearPoint)}if(this.camera.far){const e=this.camera.far;this.farPoint={x:t.x+e*n.x,y:t.y+e*n.y,z:t.z+e*n.z},this.farPoint=s.translateVector(this.farPoint),this.farPoint=o.worldToDrawing(this.farPoint)}}getCamera(){return this.camera}setDisableAnimation(e){this.disableAnimation=e}play(i){if(!this.disableAnimation){t.send(e,"play");var n=this._viewer.getViewer();this.setCamera(this.camera),(this.nearPoint||this.farPoint)&&(n.calculateNearFar(void 0,this.nearPoint,this.farPoint),n.enableCameraNearFar=!1);var o=this._player,s=this.cameraStatus;if((r=n.cameraControl.camera).up.set(0,1,0),r.realUp.set(0,1,0),i&&o.startFrom(i),o.stop(!1),!0===this.bPause){var r=n.getCamera();s&&function(e){var t=(e=JSON.parse(e)).position,i=e.target,n={position:new THREE.Vector3(t.x,t.y,t.z),target:new THREE.Vector3(i.x,i.y,i.z)},o=s,r=n.position.clone().sub(o.position),a=n.target.clone().sub(o.target);return r.length()>0||a.length()>0}(r)&&(this._player.camera.position.copy(this._viewer.worldToScene(s.position)),this._player.camera.target.copy(this._viewer.worldToScene(s.target)))}o.walkthrough.keyFrameList&&o.walkthrough.keyFrameList.length>0?(o.play(),this.bPause=!1):this.console.warn("The parameter[keyFrames] cannot be null")}}pause(){this.disableAnimation||(t.send(e,"pause"),this.bPause=!0,this.cameraStatus=this._viewer.getCameraStatus(),this._player.pause())}setProgress(e){this.disableAnimation||"number"==typeof e&&(e<0||e>1||(this._player.setProgress(e),this.cameraStatus=this._viewer.getCameraStatus()))}stop(){this.disableAnimation||(t.send(e,"stop"),this._player.stop(!0),this.bPause=!1)}stopCallback(i){t.send(e,"stopCallback"),i&&(this._stopCallback=i,this._player.addStopPlayCallback(i))}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Segment").SegmentConfig=function(){return{viewer:null}},Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Segment").IsolateOption=Object.freeze({Hidden:"Hidden",Translucent:"Translucent",PartlyTranslucent:"PartlyTranslucent"}),function(){var e="Bimface.Plugins.Segment",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Segment");i.Segment=class{constructor(e){this._viewer=e.viewer,this._segmentInfoMap=null,this._segmentInfoArray=null,this._segmentIdArray=null,this._elementIdMap={},this._loading=!1,this._segmentInfoAcquired=!1,this._segmentIdMapFromComponentId={},this._traversedSegmentIdMap={},this._fullElementIdsLoadEnabled=!0,skipVueObserver(this)}destroy(){this._viewer=null,this._segmentInfoMap=null,this._segmentInfoArray=null,this._segmentIdArray=null,this._elementIdMap=null,this._segmentIdMapFromComponentId=null,this._traversedSegmentIdMap=null}_hasSegmentInfo(e){return!(!this._segmentInfoMap||!this._segmentInfoMap[e])}_getSegmentInfoById(e){return this._segmentInfoMap?this._segmentInfoMap[e]:null}_removeDuplication(e){for(var t={},i=0,n=e.length;i<n;i++)this._hasSegmentInfo(e[i])&&!t[e[i]]&&(t[e[i]]=!0);return Object.keys(t)}_getSegmentElementIdsByIdx(e,t,i){var n=this,o=this._viewer,s=e[t];n._elementIdMap[s]?i&&i():o.getSegmentElementIds(s,(function(e){e.data&&(n._elementIdMap[s]=e.data,n.segmentFileInfoMap[s].elementIds=n._elementIdMap[s]),i&&i()}),(function(){i&&i()}))}_getSegmentElementIds(e,t){e||(e=this._segmentIdArray);var i=e.length,n=this;i>0?requestAnimationFrame(function e(o,s){var r=s;return function(){n._getSegmentElementIdsByIdx(o,r,(function(){r<i-1?requestAnimationFrame(e(o,r+1)):t&&t()}))}}(e,0)):t&&t()}_getSegmentFullElementIds(e){const t=this;this._viewer.getSegmentElementIds("full",(function(i){const n=i.data;n&&n.forEach((e=>{t._elementIdMap[e.segmentId]=e.elementIds,t.segmentFileInfoMap[e.segmentId].elementIds=e.elementIds})),e&&e()}),(function(){e&&e()}))}_getSegmentMetadataByIdx(e,t,i){var n=this._viewer,o=e[t],s=this.segmentFilePathMap[o].metadata,r=this.segmentFilePathMap[o].databag;n.getSegmentManager().getSegmentMetadata(o,r,s,(function(){i&&i()}),(function(){i&&i()}))}_getSegmentMetadata(e){var t=Object.keys(this.segmentFilePathMap),i=t.length,n=this;i>0?requestAnimationFrame(function t(o,s){var r=s;return function(){n._getSegmentMetadataByIdx(o,r,(function(){r<i-1?requestAnimationFrame(t(o,r+1)):e&&e()}))}}(t,0)):e&&e()}_loadMetadata(e){for(var t=this._viewer,i=this._segmentIdArray,n=this.segmentFilePathMap={},o=this.segmentFileInfoMap={},s=0,r=i.length;s<r;s++){var a=i[s],l=this._getSegmentInfoById(a).partialElementFiles,h=[];if(l)for(var d=0,c=l.length;d<c;d++){var u=l[d].databagId;if(u){var p=null;n[u]?p=n[u]:(p={databag:t.getDatabagResource(u),metadata:t.getPartialElementsMetadataFile(u),fileId:l[d].fileId},n[u]=p),h.push(p)}}o[a]={id:a,paths:h}}this._getSegmentMetadata(e)}_loadSegments(e,t){if(e=e||this._segmentIdArray){for(var i=this._viewer,n=this._removeDuplication(e),o=[],s=0,r=n.length;s<r;s++){var a=this.segmentFileInfoMap[n[s]];a&&o.push(a)}0!==o.length?i.getSegmentManager().loadSegments(o,(function(){t&&t()})):t&&t()}else t&&t()}getSegmentInfo(i){function n(e,t){if(e.subGroups)for(var i=e.subGroups,o=0,s=i.length;o<s;o++)n(i[o],t);else if(e.segments)for(var r=0,a=e.segments.length;r<a;r++){var l=e.segments[r];t[l.id]=l}}if(t.send(e,"getSegmentInfo"),this._loading)return null;if(this._segmentInfoAcquired)return i&&i(this._segmentInfoArray),this._segmentInfoArray;var o=this;return this._loading=!0,this._viewer.getSegmentTree((function(e){for(var t=e.data,s=o._segmentInfoMap={},r=0,a=t.length;r<a;r++)n(t[r],s);o._segmentIdArray=Object.keys(o._segmentInfoMap),o._segmentInfoArray=[];for(var l=o._segmentInfoArray.length=o._segmentIdArray.length,h=0;h<l;h++)o._segmentInfoArray[h]=o._segmentInfoMap[o._segmentIdArray[h]];o._loadMetadata((function(){o._loading=!1,o._segmentInfoAcquired=!0,i&&i(o._segmentInfoArray)}))}),(function(e){console.error("request segment data error!")})),null}_loadSegmentsWithFullElementIds(e,t){this._fullElementIdsLoaded?this._loadSegments(e,t):this._getSegmentFullElementIds((()=>{this._fullElementIdsLoaded=!0,this._loadSegments(e,t)}))}loadSegments(i,n){t.send(e,"loadSegments");var o=this;this._fullElementIdsLoadEnabled?this._segmentInfoAcquired?this._loadSegmentsWithFullElementIds(i,n):this.getSegmentInfo((function(e){o._loadSegmentsWithFullElementIds(i,n)})):this._segmentInfoAcquired?o._getSegmentElementIds(i,(function(){o._loadSegments(i,n)})):this.getSegmentInfo((function(e){o._getSegmentElementIds(i,(function(){o._loadSegments(i,n)}))}))}unloadSegments(i){t.send(e,"unloadSegments"),(i=i||this._segmentIdArray)&&(this._viewer.getSegmentManager().unloadSegments(this._removeDuplication(i)),this._viewer.render())}hideComponentsBySegment(i){t.send(e,"hideComponentsBySegment"),this._viewer.getSegmentManager().hideComponentsBySegment(this._removeDuplication(i)),this._viewer.render()}showComponentsBySegment(i){t.send(e,"showComponentsBySegment"),this._viewer.getSegmentManager().showComponentsBySegment(this._removeDuplication(i)),this._viewer.render()}isolateComponentsBySegment(i,n){t.send(e,"isolateComponentsBySegment");var o=void 0,s=Glodon$1.Bimface.Plugins.Segment.IsolateOption;switch(n){case s.Hidden:o=this._viewer.getSegmentManager().getSegmentIsolateOption().HIDDEN;break;case s.Translucent:o=this._viewer.getSegmentManager().getSegmentIsolateOption().TRANSLUCENT;break;case s.PartlyTranslucent:o=this._viewer.getSegmentManager().getSegmentIsolateOption().PARTLYTRANSLUCENT}void 0!==o&&(this._viewer.getSegmentManager().isolateComponentsBySegment(this._removeDuplication(i),o),this._viewer.render())}disable(){this._viewer.getSegmentManager().disable(),this._viewer.render()}enable(){this._viewer.getSegmentManager().enable(),this._viewer.render()}getSegementIds(e){if(!this._segmentInfoAcquired)return console.error("Call the function getSegmentInfo() first!"),null;var t=this._segmentIdMapFromComponentId;if(t[e])return t[e];for(var i=Object.keys(this._elementIdMap),n=0,o=i.length;n<o;n++){var s=i[n];if(!this._traversedSegmentIdMap[s]){this._traversedSegmentIdMap[s]=!0;for(var r=this._elementIdMap[s],a=0,l=r.length;a<l;a++){var h=r[a];t[h]||(t[h]=[]),t[h].push(s)}}}var d=this._viewer.getSegmentManager().getSegmentIdsByPartialElementId(e);return d&&(t[e]=d),t[e]}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AxisGrid");t.HighlightBorderLines=class{constructor(e){this.svgContainer=e,this.initialize(),this.visibility=!1}initialize(){var t=e.createNS("line","bf-axisgrid-line"),i=t.cloneNode();i.style.strokeWidth=1,i.style.stroke="#ffffff",i.style.opacity=.5,this.svgContainer.appendChild(i),this.lineLeft=i;var n=t.cloneNode();n.style.strokeWidth=1,n.style.stroke="#ffffff",n.style.opacity=.5,this.svgContainer.appendChild(n),this.lineRight=n}updateBorderLeft(e,t){var i=new THREE.Vector2(e.x,e.y),n=new THREE.Vector2(t.x,t.y);e.y==t.y?(i.y-=2,n.y-=2):(i.x-=2,n.x-=2),this.moveLineTo(this.lineLeft,i,n)}updateBorderRight(e,t){var i=new THREE.Vector2(e.x,e.y),n=new THREE.Vector2(t.x,t.y);e.y==t.y?(i.y+=2,n.y+=2):(i.x+=2,n.x+=2),this.moveLineTo(this.lineRight,i,n)}hide(){this.lineLeft.style.display="none",this.lineRight.style.display="none",this.visibility=!1}show(){this.lineLeft.style.display="block",this.lineRight.style.display="block",this.visibility=!0}update(e,t){0!=this.visibility&&(this.updateBorderLeft(e,t),this.updateBorderRight(e,t))}moveLineTo(e,t,i){e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",i.x),e.setAttribute("y2",i.y)}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AxisGrid");t.HighlightLine=class{constructor(e,t){this.svgContainer=e,this.viewer=t,this.borderline=new Glodon$1.Bimface.Plugins.AxisGrid.HighlightBorderLines(e),this.initialize(),this.visibility=!1}initialize(){var t=e.createNS("line","bf-axisgrid-line");t.style.strokeWidth=2,t.style.stroke="#32D5A7",this.svgContainer.appendChild(t),this.line=t}hide(){this.line.style.display="none",this.borderline.hide(),this.visibility=!1}show(){this.line.style.display="block",this.borderline.show(),this.visibility=!0}setLine(e){this.highlightLine=e}setHeight(e){this.axisgridHeight=e}update(){if(0!=this.visibility){var e=this.highlightLine,t=new THREE.Vector3(e[0],e[1],this.axisgridHeight),i=new THREE.Vector3(e[3],e[4],this.axisgridHeight),n=this.worldPointsToClient(t,i);n&&(this.moveLineTo(this.line,n.start,n.end),this.borderline.update(n.start,n.end))}}worldPointsToClient(e,t){var i=this.viewer.getDomElement().getBoundingClientRect(),n=this.viewer.getViewer().worldPointsToClient(e,t);return n&&(n.start.x-=i.left,n.start.y-=i.top,n.end.x-=i.left,n.end.y-=i.top),n}moveLineTo(e,t,i){e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",i.x),e.setAttribute("y2",i.y)}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AxisGrid");t.HighlightIntersectLines=class{constructor(e,t){this.svgContainer=e,this.viewer=t,this.horizBorderline=new Glodon$1.Bimface.Plugins.AxisGrid.HighlightBorderLines(e),this.verticalBorderline=new Glodon$1.Bimface.Plugins.AxisGrid.HighlightBorderLines(e),this.initialize(),this.visibility=!1}initialize(){var t=e.createNS("line","bf-axisgrid-line"),i=t.cloneNode();i.style.strokeWidth=2,i.style.stroke="#32D5A7",this.svgContainer.appendChild(i),this.svgHorizLine=i;var n=t.cloneNode();n.style.strokeWidth=2,n.style.stroke="#32D5A7",this.svgContainer.appendChild(n),this.svgVerticalLine=n;var o=e.createNS("circle","bf-axisgrid-point");o.setAttribute("r",3),o.setAttribute("fill","#32D5A7"),this.svgContainer.appendChild(o),this.hoverPoint=o,this.hide()}setLine(e,t){this.horizLine=e,this.verticalLine=t}setPoint(e){this.intersectPoint=e}setHeight(e){this.axisgridHeight=e}update(){if(0!=this.visibility){var e=this.horizLine,t=this.verticalLine,i=this.viewer.worldToClient(this.intersectPoint),n=new THREE.Vector3(e[0],e[1],this.axisgridHeight),o=new THREE.Vector3(e[3],e[4],this.axisgridHeight),s=new THREE.Vector3(t[0],t[1],this.axisgridHeight),r=new THREE.Vector3(t[3],t[4],this.axisgridHeight),a=this.worldPointsToClient(n,o);a&&(this.moveLineTo(this.svgHorizLine,a.start,a.end),this.horizBorderline.update(a.start,a.end));var l=this.worldPointsToClient(s,r);l&&(this.moveLineTo(this.svgVerticalLine,l.start,l.end),this.verticalBorderline.update(l.start,l.end)),this.movePointTo(this.hoverPoint,i.x,i.y)}}worldPointsToClient(e,t){var i=this.viewer.getDomElement().getBoundingClientRect(),n=this.viewer.getViewer().worldPointsToClient(e,t);return n&&(n.start.x-=i.left,n.start.y-=i.top,n.end.x-=i.left,n.end.y-=i.top),n}hide(){this.svgHorizLine.style.display="none",this.svgVerticalLine.style.display="none",this.hoverPoint.style.display="none",this.horizBorderline.hide(),this.verticalBorderline.hide(),this.visibility=!1}show(){this.svgHorizLine.style.display="block",this.svgVerticalLine.style.display="block",this.hoverPoint.style.display="block",this.horizBorderline.show(),this.verticalBorderline.show(),this.visibility=!0}moveLineTo(e,t,i){e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",i.x),e.setAttribute("y2",i.y)}movePointTo(e,t,i){e.setAttribute("cx",t),e.setAttribute("cy",i)}}}(),function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AxisGrid");i.AxisGridManager=class{constructor(i){e.send("Bimface.Plugins.AxisGrid","AxisGridManager"),this.snapMinDistance=5,this.viewer=i.viewer,this.registerEvent(),this.domContainer=t.create("div","bf-axisgrid-conext"),this.domContainer.style.position="absolute",this.domContainer.style.left=0,this.domContainer.style.top=0,this.domContainer.style.width="100%",this.domContainer.style.height="100%",this.svgContainer=t.createNS("svg","bf-axisgrid-svg"),this.svgContainer.style.width="100%",this.svgContainer.style.height="100%",this.domContainer.appendChild(this.svgContainer),this.viewer.getDomElement().appendChild(this.domContainer);var n=Glodon$1.Bimface.Plugins.AxisGrid;this.highlightLine=new n.HighlightLine(this.svgContainer,this.viewer),this.highlightIntersectLines=new n.HighlightIntersectLines(this.svgContainer,this.viewer),skipVueObserver(this)}registerEvent(){var e=Glodon$1.Bimface.Viewer.Viewer3DEvent,t=this,i=this.viewer.getEventManager(),n=null;const o="AxisGrids";function s(e,t){if(!e)return;const i=new THREE.Line3(new THREE.Vector3(e[0],e[1],e[2]),new THREE.Vector3(e[3],e[4],e[5]));i.applyMatrix4(t);const n=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];return n.name=e.name,n}function r(r){if(!r.snapLines.gridLine)return!1;const a=t.viewer.getViewer(),l=CLOUD.AxisGridManager.getInstance(a.getScene(),r.modelId).modelTransformation;var h=!0,d=r.point,c=new THREE.Vector3(0,0,r.height).applyMatrix4(l).z,u=r.snapLines,p=r.nearestPoint,g=u.intersectLines,m=s(u.gridLine,l),f=a.worldToCanvas(d),w=a.worldToCanvas(p.toGridLine),v=a.worldToCanvas(p.toIntersection),y=t.distance(f,w),b=t.distance(f,v),E=null;if(b<=t.snapMinDistance&&void 0!==g){t.highlightIntersectLines.show(),t.highlightLine.hide();var x=s(g[0],l),C=s(g[1],l);E=x.name+"-"+C.name,t.highlightIntersectLines.setHeight(c),t.highlightIntersectLines.setLine(x,C),t.highlightIntersectLines.setPoint(p.toIntersection),t.highlightIntersectLines.update()}else y<=t.snapMinDistance?(E=m.name,t.highlightLine.show(),t.highlightIntersectLines.hide(),t.highlightLine.setHeight(c),t.highlightLine.setLine(m),t.highlightLine.update(c)):(n=null,t.highlightLine.hide(),t.highlightIntersectLines.hide(),h=!1);return n!=E&&(b<=t.snapMinDistance||y<=t.snapMinDistance)&&(i.fireEvent(e.Hover,{objectType:o,objectId:E,worldPosition:d}),n=E),h}this.viewer.addEventListener(e.AxisGridHover,(function(e){for(const t of e.snaps){if(r(t))break}})),this.viewer.addEventListener(e.Rendered,(function(){var e=e||window.event,i=t.viewer.getViewer(),n=i.getScene();if(!n.axisGridEnableHover)return t.highlightLine.hide(),void t.highlightIntersectLines.hide();t.viewer.getModels().forEach((o=>{let s=o.modelId;var a=CLOUD.AxisGridManager.getInstance(n,s);if(e&&"mousewheel"==e.type){var l=n.getMatrixGlobal(),h=new THREE.Vector2(e.clientX,e.clientY),d=i.cameraControl.getRaycaster(h.x,h.y),c=a.getIntersectPoints(d,l),u=a.snapOnFloors(c);if(u&&0==u.length)return t.highlightLine.hide(),void t.highlightIntersectLines.hide();for(const e of u){if(r(e))break}}})),t.highlightLine.update(),t.highlightIntersectLines.update()}))}distance(e,t){var i=e.x-t.x,n=e.y-t.y,o=e.z-t.z;return Math.sqrt(i*i+n*n+o*o)}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AxisGrid").AxisGridManagerConfig=function(){return{viewer:null}},function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.EditPoint=class{constructor(e,t,i){this.viewer3D=e,this.worldPosition=!0===i?null:t,this.clientPosition=!0===i?t:null,this.svgElement=null,this.xmlns="http://www.w3.org/2000/svg",this.glodonColor="#11DAB7",this.gridHighlightColor="#FF7F00",this.observer=function(){},this.uuid=-1,this.initialize()}initialize(){this.worldPosition?this.clientPosition=this.viewer3D.worldToClient(this.worldPosition):this.worldPosition=this.viewer3D.clientToWorld(this.clientPosition);let e=document.createElementNS(this.xmlns,"circle");e.setAttribute("r",3),e.setAttribute("style","stroke: "+this.glodonColor+"; stroke-width: 1; fill: #ffffff"),e.setAttribute("transform","translate("+this.clientPosition.x+","+this.clientPosition.y+")"),this.svgElement=e}setObserver(e){this.observer=e}hightlight(){this.svgElement.style.stroke=this.gridHighlightColor}cancelHightlight(){this.svgElement.style.stroke=this.glodonColor}distanceTo(e){let t=e.x-this.clientPosition.x,i=e.y-this.clientPosition.y;return Math.sqrt(t*t+i*i)}detach(){this.svgElement.parentNode.removeChild(this.svgElement)}update(e){1==e?this.worldPosition=this.viewer3D.clientToWorld(this.clientPosition):this.clientPosition=this.viewer3D.worldToClient(this.worldPosition),this.svgElement.setAttribute("transform","translate("+this.clientPosition.x+","+this.clientPosition.y+")")}isEqualWith(e){return e.uuid==this.uuid}getWorldPosition(){let e=this.worldPosition;return[e.x,e.y,e.z]}getClientPosition(){return new THREE.Vector2(this.clientPosition.x,this.clientPosition.y)}setClientPosition(e){this.clientPosition.x=e.x,this.clientPosition.y=e.y}getSvgElement(){return this.svgElement}}}(),function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.EditEdge=class{constructor(e){this.svgElement=null,this.xmlns="http://www.w3.org/2000/svg",this.gridHighlightColor="#FF7F00",this.editPoints=e,this.initialize(),this.hide()}initialize(){let e=this.editPoints[0],t=this.editPoints[1],i=document.createElementNS(this.xmlns,"line");i.setAttribute("stroke",this.gridHighlightColor),i.setAttribute("stroke-width",3),i.setAttribute("x1",e.getClientPosition().x+""),i.setAttribute("y1",e.getClientPosition().y+""),i.setAttribute("x2",t.getClientPosition().x+""),i.setAttribute("y2",t.getClientPosition().y+""),this.svgElement=i}show(){this.update(),this.svgElement.style.display="block"}hide(){this.svgElement.style.display="none"}update(){let e=this.editPoints[0],t=this.editPoints[1];this.svgElement.setAttribute("x1",e.getClientPosition().x+""),this.svgElement.setAttribute("y1",e.getClientPosition().y+""),this.svgElement.setAttribute("x2",t.getClientPosition().x+""),this.svgElement.setAttribute("y2",t.getClientPosition().y+"")}detach(){this.svgElement.parentNode.removeChild(this.svgElement)}startWithNull(){return null==this.editPoints[0]}endWith(e){return this.editPoints[1].isEqualWith(e)}distanceTo(e){let t=e.x-this.clientPosition.x,i=e.y-this.clientPosition.y;return Math.sqrt(t*t+i*i)}getSvgElement(){return this.svgElement}}}(),function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.Boundary=class{constructor(e){this.editPoints=e,this.polyline=null,this.xmlns="http://www.w3.org/2000/svg",this.glodonColor="#11DAB7",this.boundaryHighlightColor="#FF7F00",this.initialize()}initialize(){this.setObserver();let e=this.formatPolyline(this.editPoints),t=document.createElementNS(this.xmlns,"polyline");t.setAttribute("stroke",this.glodonColor),t.setAttribute("stroke-width",2),t.style.fill=this.glodonColor,t.style.fillOpacity="0.4",t.setAttribute("points",e),this.polyline=t}setObserver(){this.updateBinded=this.update.bind(this);for(const e of this.editPoints)e.setObserver(this.updateBinded)}formatPolyline(e){let t="";for(let i of e){let e=i.getClientPosition();t+=e.x+","+e.y,t+=" "}let i=e[0].getClientPosition();return t+=i.x+","+i.y,t+=" ",t}update(){let e=this.formatPolyline(this.editPoints);this.polyline.setAttribute("points",e)}rebuild(e){this.editPoints=e,this.initialize()}getSvgElement(){return this.polyline}}}();class RoomEditingUtil{constructor(){}}RoomEditingUtil.distanceToSegment=function(e,t,i){let n=this.nearestPointOnSegment(e,t,i);return e.distanceTo(n)},RoomEditingUtil.nearestPointOnSegment=function(e,t,i){var n=t.distanceToSquared(i);if(0==n)return e.distanceTo(t);var o=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/n;o=Math.max(0,Math.min(1,o));let s=new THREE.Vector2;return s.x=t.x+o*(i.x-t.x),s.y=t.y+o*(i.y-t.y),s};class Drawable{constructor(e){this.drawables=[],this.drawableStyle=e,this.style={},this.id="",this.hitTestEpsilon=10,this.highlightColor="#FFF227",this.grayColor="#BBBBBB"}attach(e){this.drawables.forEach((t=>{if(t instanceof Drawable)for(const i of t.getDrawables())e.appendChild(i);else e.appendChild(t)}))}detach(){for(const t of this.drawables){if(t instanceof Drawable)for(const i of t.getDrawables()){var e;(e=i.parentNode)&&e.removeChild(i)}else(e=t.parentNode)&&e.removeChild(t),this.drawables=[]}}hitTest(e){}setDefault(){}select(e){}setGray(){}magnify(){}resetSize(){}hide(){}show(){}isArrow(){return!1}getId(){return this.id}getDrawables(){return this.drawables}toVector2(e){return new THREE.Vector2(e.x,e.y)}toVector3(e){return new THREE.Vector3(e.x,e.y,e.z)}}class Arrow$1 extends Drawable{constructor(e){super(),this.id=e.id,this.color=e.color,this.length=e.length||130,this.markerWidth=e.markerWidth||4,this.markerHeight=e.markerHeight||4,this.lineWidth=e.lineWidth||4,this.start=null,this.target=null}update(e,t){this.drawables=[];let i=MeasureUtil.makeMarker({id:this.id,color:this.color,markerWidth:this.markerWidth,markerHeight:this.markerHeight});this.drawables.push(i);let n={color:this.color,lineWidth:`${this.lineWidth}px`,start:e,end:t};this.start=e,this.target=t;let o=MeasureUtil.makeLine(n);o.setAttribute("marker-end","url(#"+this.id+")"),this.drawables.push(o)}setDefault(){this.drawables[1].style.stroke=this.color;let e=document.getElementById(this.id)&&document.getElementById(this.id).children[0];e&&(e.style.fill=this.color)}setGray(){this.drawables[1].style.stroke=this.grayColor;let e=document.getElementById(this.id)&&document.getElementById(this.id).children[0];e&&(e.style.fill=this.grayColor)}select(){this.drawables[1].style.stroke=this.highlightColor;let e=document.getElementById(this.id)&&document.getElementById(this.id).children[0];e&&(e.style.fill=this.highlightColor)}hitTest(e){let t=this.hitTestEpsilon;const i=new THREE.Vector3(e.x,e.y,0),n=new THREE.Line3(new THREE.Vector3(this.start.x,this.start.y,0),new THREE.Vector3(this.target.x,this.target.y,0)),o=new THREE.Vector3;return n.closestPointToPoint(i,!0,o),o.distanceTo(i)<=t?this:null}hide(){let e=document.getElementById(this.id)&&document.getElementById(this.id).children[0];e&&(e.style.display="none"),this.drawables[1].style.display="none"}show(){this.drawables[1].style.display="block";let e=document.getElementById(this.id)&&document.getElementById(this.id).children[0];e&&(e.style.display="block")}getDirection(){let e=this.target.clone().sub(this.start).normalize();return new THREE.Vector3(e.x,e.y,0)}magnify(){let e=document.getElementById(this.id);e.setAttribute("markerWidth",6),e.setAttribute("markerHeight",6)}resetSize(){let e=document.getElementById(this.id);e.setAttribute("markerWidth",4),e.setAttribute("markerHeight",4)}isArrow(){return!0}}class EditHeight{constructor(){this.glodonColor="#32D3A6",this.highlightColor="#F99D0B",this.hitTestEpsilon=5,this.drawables=[],this.upSegment=[],this.downSegment=[]}update(e){this.drawables=[],this.upSegment=[],this.downSegment=[],this.points=e;for(let t=0;t<e.length;t++){let i=MeasureUtil.makeLine({start:e[t],end:e[(t+1)%4],lineWidth:"2px",color:this.glodonColor});this.drawables.push(i)}let t={},i=[...e,e[0]];t.points=MeasureUtil.calcPolylinePoints(i),t.width="1px",t.color="rgba(0,0,0,0)",t.fillColor="rgba(50, 211, 166, 0.1)";let n=MeasureUtil.makePolyline(t);this.drawables.push(n),this.upSegment.push(this.drawables[3]),this.downSegment.push(this.drawables[1]);let o=[new THREE.Vector2((e[0].x+e[3].x)/2,(e[0].y+e[3].y)/2),new THREE.Vector2((e[1].x+e[2].x)/2,(e[1].y+e[2].y)/2)],s=10,r=0,a=["1","2","3","4"];for(const e of o){let t=new Arrow$1({id:a[r++],color:this.glodonColor,length:8,lineWidth:3,markerWidth:4,markerHeight:4});t.update(e,e.clone().add(new THREE.Vector2(0,s))),s*=-1,t.getDrawables().forEach((e=>{this.drawables.push(e),r<=2&&this.upSegment.push(e),r>2&&this.downSegment.push(e)})),t.id=a[r++],t.update(e,e.clone().add(new THREE.Vector2(0,s))),s*=-1,t.getDrawables().forEach((e=>{this.drawables.push(e),r<=2&&this.upSegment.push(e),r>2&&this.downSegment.push(e)}))}}hitTest(e){let t=new THREE.Vector2(e.x,e.y),i=this.points[0],n=this.points[3],o=this.points[1],s=this.points[2],r=[];r.push(new THREE.Vector2(i.x,i.y)),r.push(new THREE.Vector2(n.x,n.y));let a=[];a.push(new THREE.Vector2(o.x,o.y)),a.push(new THREE.Vector2(s.x,s.y));let l=RoomEditingUtil.distanceToSegment(t,r[0],r[1]);return l<=this.hitTestEpsilon?"up-segment":(l=RoomEditingUtil.distanceToSegment(t,a[0],a[1]),l<=this.hitTestEpsilon?"down-segment":null)}detach(){for(const t of this.drawables){var e=t.parentNode;e&&e.removeChild(t),this.drawables=[]}}getDrawables(){return this.drawables}highlight(e){let t="up-segment"==e?this.upSegment:this.downSegment;for(const e of[0,2,4])t[e].style.stroke=this.highlightColor;let i="up-segment"==e?["1","2"]:["3","4"];for(const e of i){document.getElementById(e).children[0].style.fill=this.highlightColor}}cancelHighlight(){for(const e of[0,2,4])this.upSegment[e].style.stroke=this.glodonColor,this.downSegment[e].style.stroke=this.glodonColor;for(const e of["1","2","3","4"]){document.getElementById(e).children[0].style.fill=this.glodonColor}}}!function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing"));t.RoomData=class{constructor(t,i){e.send("Bimface.Plugins.RoomEditing","RoomData"),this.viewer=t,this.roomBoundary=i,this.editHeight=null,this.editPoints=[],this.editEdges=[],this.boundary=null,this.editPointUuid=0,this.onEditPointDeletion=null,this.onEditPointAddition=null,this.isEditHeightEnabled=!1,this.roomHeightOffset={from:0,to:0}}build(){if(this.isEditHeightEnabled)!this.editHeight&&this.makeHeight();else{let e;this.makeEditPoints(),this.makeEditEdges(),this.makeBoundary();let t=this.viewer.roomManager;if(t&&t.getRoomById(this.editRoomId)){e=t.getRoomById(this.editRoomId).getRoomBoundingBox()}else{e=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer}).getRoomBoundingBoxById(this.editRoomId)}this.roomHeightOffset.from=e.min.z,this.roomHeightOffset.to=e.max.z}}makeHeight(){let e;this.editHeight=new EditHeight;let t=this.viewer.roomManager;if(t&&t.getRoomById(this.editRoomId)){e=t.getRoomById(this.editRoomId).getRoomBoundingBox()}else{e=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer}).getRoomBoundingBoxById(this.editRoomId)}this.roomHeightOffset.from=e.min.z,this.roomHeightOffset.to=e.max.z}makeEditPoints(){for(let e=0;e<this.roomBoundary.length-1;e++){const i=this.roomBoundary[e];let n=new THREE.Vector3(i[0],i[1]),o=new t.EditPoint(this.viewer,n);o.uuid=this.editPointUuid++,this.editPoints.push(o)}}deleteEditPoint(e){for(let t=0;t<this.editPoints.length;t++){let i=this.editPoints[t];if(i.isEqualWith(e)){i.detach(),this.editPoints.splice(t,1),this.onEditPointDeletion(i);break}}}addEditPoint(e,i){let n=e.editPoints[0],o=e.editPoints[1];e.detach();let s=this.editEdges.findIndex((e=>e.endWith(o)));this.editEdges.splice(s,1);let r=this.editPoints.findIndex((e=>e.isEqualWith(n))),a=new THREE.Vector2(i.x,i.y),l=new t.EditPoint(this.viewer,a,!0);l.uuid=this.editPointUuid++,this.editPoints.splice(r+1,0,l);let h=new t.EditEdge([n,l]);this.editEdges.splice(s,0,h);let d=new t.EditEdge([l,o]);this.editEdges.splice(s+1,0,d),this.onEditPointAddition()}getEditPointCounts(){return this.editPoints.length}makeEditEdges(){for(let e=0;e<this.editPoints.length;e++){let i=[];i.push(this.editPoints[e]);let n=e==this.editPoints.length-1?0:e+1;i.push(this.editPoints[n]);let o=new t.EditEdge(i);this.editEdges.push(o)}}mergeEditEdges(e,i){i=null==i?2:i;let n=this.editEdges[e],o=this.editEdges[(e+i-1)%this.editEdges.length],s=[];s.push(n.editPoints[0]),s.push(o.editPoints[1]);let r=new t.EditEdge(s);this.editEdges.splice(e,0,r),this.editEdges.splice(e+1,i)}makeBoundary(){let e=this.editPoints;this.boundary=new t.Boundary(e)}getEditPoints(){return this.editPoints}getEditEdges(){return this.editEdges}getBoundary(){return this.boundary}getEditHeight(){return this.editHeight}setEditRoomId(e){this.editRoomId=e}getRoomSectionPoints(){let e,t=this.viewer.roomManager;if(t&&t.getRoomById(this.editRoomId)){e=t.getRoomById(this.editRoomId).getRoomBoundingBox()}else{e=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer}).getRoomBoundingBoxById(this.editRoomId)}e=this.viewer.globalUnitUtil.translateBBox(e);let i=e.min,n=e.max,o=[],s=(i.y+n.y)/2,r=this.viewer.globalUnitUtil.translate(this.roomHeightOffset,["from","to"]);o.push(new THREE.Vector3(i.x,s,r.to)),o.push(new THREE.Vector3(i.x,s,r.from)),o.push(new THREE.Vector3(n.x,s,r.from)),o.push(new THREE.Vector3(n.x,s,r.to));let a=[];for(const e of o)a.push(this.viewer.getViewer().worldToCanvas(e));return this.roomHeightOnCanvas=a[1].y-a[0].y,a}updateRoomHeightOffset(e,t){let i=this.roomHeightOnCanvas,n=(this.roomHeightOffset.to-this.roomHeightOffset.from)/i,o=100;"Meter"===this.viewer.globalUnitUtil.getGlobalUnit()&&(o/=1e3),"up-segment"===e?(this.roomHeightOffset.to-=t.y*n,this.roomHeightOffset.to<this.roomHeightOffset.from+o&&(this.roomHeightOffset.to=this.roomHeightOffset.from+o)):(this.roomHeightOffset.from-=t.y*n,this.roomHeightOffset.from>this.roomHeightOffset.to-o&&(this.roomHeightOffset.from=this.roomHeightOffset.to-o))}getRoomHeightOffset(){return[this.roomHeightOffset.from,this.roomHeightOffset.to]}updateRoomBoundary(e){const t=this.roomBoundary;let i=new THREE.Vector3;for(let n=0;n<t.length;n++)i.fromArray(t[n]).applyMatrix4(e),t[n]=i.toArray()}}}(),function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing"));t.RoomView=class{constructor(t,i){e.send("Bimface.Plugins.RoomEditing","RoomView"),this.roomData=t,this.svgContainer=i,this.eventManager=null;let n=this;this.roomData.onEditPointDeletion=function(e){n.detachDrawables(),n.updateBoundary(),n.updateEditEdges(e),n.attachDrawables()},this.roomData.onEditPointAddition=function(){n.detachDrawables(),n.updateBoundary(),n.attachDrawables()}}setEventManager(e){this.eventManager=e}getEventManager(){return this.eventManager}getData(){return this.roomData}attachDrawables(){if(this.roomData.isEditHeightEnabled){let e=this.roomData.getEditHeight().getDrawables();for(const t of e)this.svgContainer.appendChild(t);return}let e=this.roomData.getBoundary().getSvgElement();this.svgContainer.appendChild(e);for(const e of this.roomData.getEditEdges())this.svgContainer.appendChild(e.getSvgElement());for(const e of this.roomData.getEditPoints())this.svgContainer.appendChild(e.getSvgElement())}detachDrawables(){let e=this.svgContainer.children;for(;e.length>0;){let t=e[0];this.svgContainer.removeChild(t)}}update(){if(this.roomData.isEditHeightEnabled){return this.roomData.getEditHeight().update(this.roomData.getRoomSectionPoints()),this.detachDrawables(),void this.attachDrawables()}for(const e of this.roomData.getEditPoints())e.update();for(const e of this.roomData.getEditEdges())e.update();this.roomData.getBoundary().update()}updateBoundary(){let e=this.roomData.getBoundary();e.setObserver(),e.update()}updateEditEdges(e){let t=this.roomData.getEditEdges().findIndex((t=>t.endWith(e)));this.roomData.mergeEditEdges(t,2)}addCloudViewerEvents(e){this.updateBinded=this.update.bind(this),e.registerEventListener(CLOUD.EVENTS.ON_EDITOR_ZOOM,this.updateBinded),e.registerEventListener(CLOUD.EVENTS.ON_EDITOR_PANING,this.updateBinded)}removeCloudViewerEvents(e){e.unregisterEventListener(CLOUD.EVENTS.ON_EDITOR_ZOOM,this.updateBinded),e.unregisterEventListener(CLOUD.EVENTS.ON_EDITOR_PANING,this.updateBinded)}}}(),function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.PickEditor=class{constructor(e){this.roomView=e,this.roomData=e.getData(),this.snapEditPoint=null}begin(e){let t=new THREE.Vector3(e.x,e.y),i=this.snaping(t);this.snapEditPoint=i}onEditing(e){let t=new THREE.Vector3(e.x,e.y);if(null!=this.snapEditPoint)this.snapEditPoint.setClientPosition(t),this.snapEditPoint.update(!0),this.snapEditPoint.observer();else{let e=this.snaping(t);e?e.hightlight():this.cancelHightlight()}}end(e){this.snapEditPoint=null}snaping(e){for(const t of this.roomData.getEditPoints())if(t.distanceTo(e)<=5)return t;return null}cancelHightlight(){for(const e of this.roomData.getEditPoints())e.cancelHightlight()}}}(),function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.AdditionEditor=class{constructor(e){this.roomView=e,this.roomData=e.getData(),this.snapEditEdge=null,this.beginPoint=new THREE.Vector2,this.eventManager=this.roomView.getEventManager()}begin(e){this.beginPoint.set(e.x,e.y),this.snapEditEdge=this.snaping(this.beginPoint)}onEditing(e){let t=new THREE.Vector2(e.x,e.y);if(null==this.snapEditEdge){let e=this.snaping(t);e?(this.hideAllEdges(),e.show(),this.eventManager.fireEvent("RoomEditorAddEnter")):(this.hideAllEdges(),this.eventManager.fireEvent("RoomEditorAddExit"))}else this.eventManager.fireEvent("RoomEditorAddExit")}end(e){if(null==this.snapEditEdge)return;let t=new THREE.Vector2(e.x,e.y);if(!1===t.equals(this.beginPoint))return void(this.snapEditEdge=null);let i=this.snapEditEdge.editPoints[0].getClientPosition(),n=this.snapEditEdge.editPoints[1].getClientPosition();this.roomData.addEditPoint(this.snapEditEdge,RoomEditingUtil.nearestPointOnSegment(t,i,n)),this.snapEditEdge=null}hideAllEdges(){for(const e of this.roomData.getEditEdges())e.hide()}snaping(e){let t=null,i=Number.MAX_SAFE_INTEGER;for(const n of this.roomData.getEditEdges()){let o=n.editPoints[0].getClientPosition(),s=n.editPoints[1].getClientPosition(),r=RoomEditingUtil.distanceToSegment(e,o,s);r<i&&(i=r,t=n)}return i<=5?t:null}}}(),function(){Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");e.DeletionEditor=class{constructor(e){this.roomView=e,this.roomData=e.getData(),this.snapEditPoint=null,this.beginPoint=new THREE.Vector2,this.eventManager=this.roomView.getEventManager()}begin(e){this.beginPoint.set(e.x,e.y),this.snapEditPoint=this.snaping(this.beginPoint)}onEditing(e){let t=new THREE.Vector3(e.x,e.y);if(null==this.snapEditPoint){let e=this.snaping(t);e?(e.hightlight(),this.eventManager.fireEvent("RoomEditorDeleteEnter")):(this.cancelHightlight(),this.eventManager.fireEvent("RoomEditorDeleteExit"))}else this.eventManager.fireEvent("RoomEditorDeleteExit")}end(e){if(null==this.snapEditPoint)return;if(!1!==new THREE.Vector2(e.x,e.y).equals(this.beginPoint)){if(this.roomData.getEditPointCounts()<=3)return this.eventManager.fireEvent("DeletionError"),void(this.snapEditPoint=null);this.roomData.deleteEditPoint(this.snapEditPoint),this.snapEditPoint=null}else this.snapEditPoint=null}snaping(e){for(const t of this.roomData.getEditPoints())if(t.distanceTo(e)<=5)return t;return null}cancelHightlight(){for(const e of this.roomData.getEditPoints())e.cancelHightlight()}}}();class HeightAdjustmentEditor{constructor(e){this.roomView=e,this.roomData=e.getData(),this.snapSegmentId=null,this.lastPoint=new THREE.Vector2,this.beginPoint=new THREE.Vector2}begin(e){this.beginPoint.set(e.x,e.y),this.snapSegmentId=this.snaping(this.beginPoint),this.lastPoint.set(e.x,e.y)}onEditing(e){let t=new THREE.Vector2(e.x,e.y),i=this.roomData.getEditHeight();if(null==this.snapSegmentId){let e=this.snaping(t);e?i.highlight(e):i.cancelHighlight()}else{let e=t.clone().sub(this.lastPoint);this.roomData.updateRoomHeightOffset(this.snapSegmentId,e),this.roomView.update(),i.highlight(this.snapSegmentId),this.lastPoint.set(t.x,t.y)}}end(e){if(null==this.snapSegmentId)return;new THREE.Vector2(e.x,e.y).equals(this.beginPoint),this.snapSegmentId=null}snaping(e){return this.roomData.getEditHeight().hitTest(e)}cancelHightlight(){this.roomData.getEditHeight().cancelHightlight()}}!function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing");i.RoomEditor=class{constructor(t){e.send("Bimface.Plugins.RoomEditing","RoomEditor"),skipVueObserver(this),this.bIsOnEditing=!1,this.viewer=t.viewer,this.roomEditorToolBar=t.roomEditorToolBar,this.lastAnimationState=null,this.restoreCameraStatus=null,this.roomId=t.roomId;let i=this.viewer.roomManager;if(i&&i.getRoomById(this.roomId)){let e=i.getRoomById(this.roomId);this.roomInfo=e.roomInfo}else this.roomInfo=this.viewer.mapCustomizedRoom[t.roomId];this.restoreStates={camera:null,sectionPlane:null},this.mapUIVisibility={"bf-tree-toolbar":"none","bf-modelTree-panel":"none","bf-toolbar-bottom":"none","bf-property-panel":"none","bf-measurement-panel":"none","bf-sectionPlane-panel":"none","bf-pickSectionPlane-panel":"none","bf-sectionBox-panel":"none","bf-settings-panel":"none","bf-basicInfo-panel":"none","bf-map-panel":"none"},this.initialize(),this.scratchVector=new THREE.Vector3,this.scratchVector_1=new THREE.Vector3}initialize(){this.domContainer=t.create("div","bf-RoomEditor-conext"),this.domContainer.style.position="absolute",this.domContainer.style.left=0,this.domContainer.style.top=0,this.domContainer.style.width="100%",this.domContainer.style.height="100%",this.svgContainer=t.createNS("svg","bf-RoomEditor-svg"),this.svgContainer.style.width="100%",this.svgContainer.style.height="100%",this.domContainer.appendChild(this.svgContainer),this.viewer.getDomElement().appendChild(this.domContainer),this.addDomEventListeners(),this.offset=this.viewer.getDomElement().getBoundingClientRect();let e,n=this.viewer.getEventManager(),o=this.viewer.roomManager;if(o&&o.getRoomById(this.roomId)){e=o.getRoomById(this.roomId).getOldBoundary()}else{e=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer,hasInitialized:!0}).getBoundaryByRoomId(this.roomId)}for(let t=0;t<e.length;t++){let i=(new THREE.Vector3).fromArray(e[t]);e[t]=i.toArray()}this.roomData=new i.RoomData(this.viewer,e),this.roomData.setEditRoomId(this.roomId),this.roomView=new i.RoomView(this.roomData,this.svgContainer),this.roomView.setEventManager(n),this.activeEditor=new i.PickEditor(this.roomView)}updateRoomData(){const e=this.getBindedModelTransform();this.roomData.updateRoomBoundary(e)}getBindedModelId(){return CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).getBindedModelId(this.roomId)}getBindedModelTransform(){const e=this.getBindedModelId(),t=this.viewer.getModel(e)._getModelTransformation();let i=(new THREE.Matrix4).fromArray(t),n=new THREE.Vector3,o=new THREE.Quaternion,s=new THREE.Vector3;return i.decompose(n,o,s),n=this.viewer.globalUnitUtil.revertVector(n),i.compose(n,o,s),i}getBindedModelTransformInv(){const e=this.getBindedModelId(),t=this.viewer.getModel(e)._getModelTransformation();let i=(new THREE.Matrix4).fromArray(t),n=new THREE.Vector3,o=new THREE.Quaternion,s=new THREE.Vector3;return i.decompose(n,o,s),n=this.viewer.globalUnitUtil.revertVector(n),i.compose(n,o,s),i.invert()}onEnter(){let e=this.viewer.getViewer();this.bIsOnEditing=!0,this.restoreCameraStatus=this.viewer.getCameraStatus(),this.lastAnimationState=this.viewer.getCameraAnimation(),this.recordUIVisibility(),this.viewer.setCameraAnimation(!0),this.updateRoomData();let t,i=this,n=this.viewer.roomManager;if(n&&n.getRoomById(this.roomId)){t=n.getRoomById(this.roomId).getRoomBoundingBox().applyMatrix4(this.viewer.getViewer().getScene().getMatrixGlobal().clone())}else{t=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer}).getRoomBoundingBoxById(this.roomId).applyMatrix4(this.viewer.getViewer().getScene().getMatrixGlobal().clone())}t=this.viewer.globalUnitUtil.translateBBox(t),this.setBimfaceUIVisibility(!1),this.viewer.getViewer().setStandardView(CLOUD.EnumStandardView.Top,1,null,(()=>{i.viewHouseVisibility=i.viewer._getViewHouseVisibility(),i.viewHouseVisibility&&i.viewer.hideViewHouse(),i.viewer._enableCursor(!1),e.getFilter().deactivateAll(),i.viewer._enableSelectionChanged(!1),i.viewer.setCameraAnimation(!1),i.viewer.setCameraType("OrthographicCamera"),i.viewer.enableOrbit(!1),i.viewer.hideRoomsById([this.roomId]),i.roomData.build(),i.roomView.attachDrawables(),i.roomView.addCloudViewerEvents(e),i.roomEditorToolBar.show(),i.viewer.render()}),t)}recordUIVisibility(){let e=Object.keys(this.mapUIVisibility);for(const t of e){let e=document.getElementsByClassName(t);e.length>0&&(this.mapUIVisibility[t]=e[0].style.display)}}save(){let e=this.roomInfo.boundary.offsetZ||0,t=[],i=[];const n=this.getBindedModelTransformInv(),o=new THREE.Vector3;let s=this.roomData.getRoomHeightOffset(),r=new THREE.Vector3(0,0,s[0]).applyMatrix4(this.viewer.getViewer().getModelManager().getModel(this.getBindedModelId()).transformMatrix.clone().invert()).z;for(const s of this.roomData.getEditPoints()){let a=s.getWorldPosition();o.fromArray(a).applyMatrix4(n),a=o.toArray();let l=a;l[2]=e,t.push(l),i.push({x:l[0],y:l[1],z:r})}return{boundary:this.viewer.createBoundary(t),outerBoundary:i,height:s[1]-s[0],id:this.roomId}}checkIntersect(){let e=new THREE.Vector3,t=new THREE.Vector3(10,10),i=[];i.push(e,new THREE.Vector3(10,0),t,new THREE.Vector3(0,10));new Glodon$1.Bimface.Plugins.Geometry.PlaneBufferGeometry(i);let n=[];for(const e of this.roomData.getEditPoints()){let t=e.getWorldPosition(),i=new THREE.Vector2(t[0],t[1]);n.push(i)}return Glodon$1.Bimface.Plugins.Geometry.PlaneBufferGeometry.checkIntersect(n)}onExit(e){let t=this.viewer.getViewer();if(this.roomView.removeCloudViewerEvents(t),this.removeDomEventListeners(),this.roomView.detachDrawables(),this.bIsOnEditing=!1,this.viewHouseVisibility&&this.viewer.showViewHouse(),this.viewer._enableCursor(!0),this.viewer.setCameraAnimation(this.lastAnimationState),t.getFilter().activateAll(),this.viewer._enableSelectionChanged(!0),this.viewer.enableOrbit(!0),!0!==e){let e=this.save(),t=this.roomInfo.faceColor,i=this.roomInfo.frameColor;const n=this.getBindedModelId();let o=this.viewer.roomManager;if(o&&o.getRoomById(e.id)){let t=o.getRoomById(e.id),i=this.roomData.getRoomHeightOffset(),s=this.viewer.getViewer().getModelManager().getModel(n).transformMatrix.clone(),r=new THREE.Vector3,a=new THREE.Quaternion,l=new THREE.Vector3;s.decompose(r,a,l),r=this.viewer.globalUnitUtil.revertVector(r),s.compose(r,a,l),i[0]=new THREE.Vector3(0,0,i[0]).applyMatrix4(s.clone().invert()).z,i[1]=new THREE.Vector3(0,0,i[1]).applyMatrix4(s.clone().invert()).z;let h=e.boundary,d=[];for(let e=0;e<h.roomBoundary.length-1;e++){let t=h.roomBoundary[e];d.push([t.x,t.y,i[0]])}o.clearRoomsById([e.id],!1),t.roomInfo.boundary=this.viewer.createBoundary(d),t.roomInfo.height=i[1]-i[0],t.roomInfo.offset=i,o.addRoom(t)}else{this.viewer.createRoom(e.boundary,e.height,e.id,t,i);let o=this.roomData.getRoomHeightOffset();o[0]=new THREE.Vector3(0,0,o[0]).applyMatrix4(this.viewer.getViewer().getModelManager().getModel(n).transformMatrix.clone().invert()).z,o[1]=new THREE.Vector3(0,0,o[1]).applyMatrix4(this.viewer.getViewer().getModelManager().getModel(n).transformMatrix.clone().invert()).z;let s=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer});s.setBottomHeightByRoomId(this.roomId,o[0]),s.setTopHeightByRoomId(this.roomId,o[1]),this.viewer.bindRoomByModelId(e.id,n)}}else this.viewer.showRoomsById([this.roomId]);this.viewer.setCameraType("PerspectiveCamera");let i=this.viewer._sectionPlane;if(i){i.setPlane("Z"),i.setDirection("Forward");let e=this.roomData.getRoomHeightOffset(),t=this.viewer.getViewer().getBoundingBoxWorld(),n=this.viewer.getViewer().getScene().getExpandScalar(),o=(new THREE.Box3).setFromCenterAndSize(t.getCenter(this.scratchVector),t.getSize(this.scratchVector_1).multiplyScalar(n)),s=o.min.z,r=o.max.z,a=10;"m"===this.viewer._defaultUnit&&(a/=1e3);let l=this._calcSectionPlaneProgress(s,r,this.viewer.globalUnitUtil.translate(e[1]+a));i.setProgress(l)}this.isInHeightEditor=!1;let n=this;this.viewer.setCameraStatus(this.restoreCameraStatus,(function(){n.viewer.render()}))}makeSectionPlane(){let e,t=this.viewer.roomManager;if(t&&t.getRoomById(this.roomId)){e=t.getRoomById(this.roomId).getRoomBoundingBox()}else{e=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer}).getRoomBoundingBoxById(this.roomId)}e=this.viewer.globalUnitUtil.translateBBox(e);let i=(e.min.y+e.max.y)/2,n=this.viewer.getViewer().getBoundingBoxWorld(),o=this._calcSectionPlaneProgress(n.min.y,n.max.y,i),s=this.viewer._sectionPlane;s&&(s.setPlane("Y"),s.setDirection("Reverse"),s.setProgress(o))}_calcSectionPlaneProgress(e,t,i){return 100-(i-e)/(t-e)*100}destroySectionPlane(){this.sectionPlane.exit(),this.sectionPlane=null}getIsOnEditing(){return this.bIsOnEditing}setBimfaceUIVisibility(e){let t=Object.keys(this.mapUIVisibility);for(const i of t){let t=document.getElementsByClassName(i);0!=t.length&&(t[0].style.display=0==e?"none":this.mapUIVisibility[i])}}addDomEventListeners(){this.onMouseDownBinded=this.onMouseDown.bind(this),this.onMouseMoveBinded=this.onMouseMove.bind(this),this.onMouseUpBinded=this.onMouseUp.bind(this),this.onMouseDoubleClickBinded=this.onMouseDoubleClick.bind(this),this.onWindowResizeBinded=this.onWindowResize.bind(this);let e=this.svgContainer;e.addEventListener("mousemove",this.onMouseMoveBinded,!1),e.addEventListener("mousedown",this.onMouseDownBinded,!1),document.addEventListener("mouseup",this.onMouseUpBinded,!1),e.addEventListener("dblclick",this.onMouseDoubleClickBinded,!1),window.addEventListener("resize",this.onWindowResizeBinded,!1)}removeDomEventListeners(){let e=this.svgContainer;e.removeEventListener("mousemove",this.onMouseMoveBinded),e.removeEventListener("mousedown",this.onMouseDownBinded),document.removeEventListener("mouseup",this.onMouseUpBinded),e.removeEventListener("dblclick",this.onMouseDoubleClickBinded),window.removeEventListener("resize",this.onWindowResizeBinded)}destroySvgContainer(){this.roomView.detachDrawables(),this.domContainer.removeChild(this.svgContainer),this.svgContainer=null,this.viewer.getDomElement().removeChild(this.domContainer),this.domContainer=null}activateEditor(e){switch(e){case"Pick":this.roomData.isEditHeightEnabled=!1,this.activeEditor=new i.PickEditor(this.roomView),this._activateFromHeightEditor();break;case"Add":this.roomData.isEditHeightEnabled=!1,this.activeEditor=new i.AdditionEditor(this.roomView),this._activateFromHeightEditor();break;case"Delete":this.roomData.isEditHeightEnabled=!1,this.activeEditor=new i.DeletionEditor(this.roomView),this._activateFromHeightEditor();break;case"Height":this.roomData.isEditHeightEnabled=!0,this._activateHeightEditor(),this.activeEditor=new HeightAdjustmentEditor(this.roomView)}}_activateFromHeightEditor(){if(!this.isInHeightEditor)return;let e=this.viewer.getCameraAnimation();this.viewer.setCameraAnimation(!1),this.viewer.setCameraStatus(this.restoreCameraStatus2,(()=>requestAnimationFrame((()=>{let t=this.viewer._sectionPlane;t&&(t.setPlane("Z"),t.setDirection("Forward"),t.setProgress(this.restoreSectionPlaneProgress)),this.roomView.detachDrawables(),this.roomView.attachDrawables(),this.viewer.render(),this.viewer.setCameraAnimation(e),this.roomView.update()})))),this.isInHeightEditor=!1}_activateHeightEditor(){this.isInHeightEditor=!0,this.restoreCameraStatus2=this.viewer.getCameraStatus(),this.viewer._sectionPlane&&(this.restoreSectionPlaneProgress=this.viewer._sectionPlane.getProgress()),this.makeSectionPlane();let e=this.viewer,t=this.roomView,i=this.viewer.getCameraAnimation();this.viewer.setCameraAnimation(!1),e.setView(Glodon$1.Bimface.Viewer.ViewOption.South,(()=>{let n,o=this.viewer.roomManager;if(o&&o.getRoomById(this.roomId)){n=o.getRoomById(this.roomId).getRoomBoundingBox()}else{n=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:e}).getRoomBoundingBoxById(this.roomId)}n=this.viewer.globalUnitUtil.translateBBox(n),e.getViewer().zoomToBBox(n,.5,void 0,void 0,1e3),e.setCameraType("OrthographicCamera"),t.getData().build(),t.update(),this.viewer.setCameraAnimation(i)}))}activateByRoomId(e){let t;this.isInHeightEditor=!1,this.roomId=e;let n=this.viewer.roomManager;if(n&&n.getRoomById(this.roomId)){let e=n.getRoomById(this.roomId);this.roomInfo=e.roomInfo,t=e.getOldBoundary()}else{this.roomInfo=this.viewer.mapCustomizedRoom[e],t=new Glodon$1.Bimface.Plugins.SpatialRelation.Room({viewer:this.viewer,hasInitialized:!0}).getBoundaryByRoomId(e)}this.roomData=new i.RoomData(this.viewer,t),this.roomData.setEditRoomId(e),this.roomView=new i.RoomView(this.roomData,this.svgContainer),this.roomView.setEventManager(this.viewer.getEventManager()),this.viewer.enableOrbit(!1),this.viewer._enableCursor(!1),this.activateEditor("Pick"),this.addDomEventListeners()}onMouseDown(e){if(e.button===THREE.MOUSE.LEFT){let t={x:e.clientX-this.offset.left,y:e.clientY-this.offset.top};this.activeEditor.begin(t)}}onMouseMove(e){let t={x:e.clientX-this.offset.left,y:e.clientY-this.offset.top};this.activeEditor.onEditing(t)}onMouseUp(e){if(e.button===THREE.MOUSE.LEFT){let t={x:e.clientX-this.offset.left,y:e.clientY-this.offset.top};this.activeEditor.end(t),e.preventDefault(),e.stopPropagation()}}onMouseDoubleClick(e){e.preventDefault(),e.stopPropagation()}onWindowResize(){this.roomView.update()}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RoomEditing").RoomEidtorConfig=function(){return{viewer:null,roomId:null}},function(){let e="Bimface.Plugins.RevitHelpers",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RevitHelpers"));i.DrawingHelper=class{constructor(i){t.send(e,"DrawingHelper"),skipVueObserver(this),this.viewer3D=i.viewer,this.databagId=i.viewer._data.databagId,this.modelId=i.modelId,this.modelId&&!this.viewer3D._models[this.modelId]&&(this.modelId=null,this.viewer3D.console.warn("Incorrect parameter fileId or incorrect member modelId of DrawingHelperConfig.")),this.dataViews=null,this.integrateDataViews={},this.drawingViews=[],this.drawingIds=[],this.drawingList=[],this.integrateDrawingList={},this._config=i,this.mapDrawingVisibility={},this.mapDrawingObject={},this.supportViewTypeMap={FloorPlan:!0,Elevation:!0,Section:!0};let n=i.viewer.getViewer().getScene();this.customPlaneManager=CLOUD.CustomPlaneManager.getInstance(n),this.initialize()}initialize(){let e=this;"integrateModel"==this.viewer3D.getModel(this.modelId||null)._data.modelType&&null!=this.viewer3D.getModel(this.modelId||null)._data.integrateDrawings?e._config.viewer.getLinksJson((function(t){t&&e.formatLinksData(t)})):"singleModel"==this.viewer3D.getModel(this.modelId||null)._data.modelType&&this.getViews((function(t){let n=JSON.parse(t).viewList;for(let t=0;t<n.length;t++){const s=n[t];if(s.preview.path&&e.supportViewTypeMap[s.viewType]){e.drawingIds.push(s.id);var o=i.DrawingView.toObject(s.viewPoint);o.origin.z+=s.elevation,e.drawingList.push({id:s.id,name:s.name,viewPort:o}),e.drawingViews.push(s)}}}))}createDrawingView(){return new i.DrawingView(this.viewer3D,this.drawingViews)}formatLinksData(e){let t={},i=(e,o)=>{for(let s=0;s<e.length;s++){let r,a=e[s],{linkTransform:l,fileId:h,name:d,links:c}=a;l.indexOf("]")>0?r=n(l,h,d,o):t[h]?t[h]instanceof Array?t[h].push(o):t[h]=[o,t[h]]:t[h]=o,c.length>0&&i(c,r)}},n=(e,i,n,o)=>{let s=new THREE.Matrix4;return e&&s.set.apply(s,JSON.parse(e)),s.transpose(),o&&s.premultiply(o),t[i]?t[i]instanceof Array?t[i].push(s):t[i]=[s,t[i]]:t[i]=s,s};for(let t=0;t<e.length;t++){let o,s=e[t],{linkTransform:r,fileId:a,name:l,links:h}=s;o=r.indexOf("]")>0?n(r,a,l):new THREE.Matrix4,h.length>0&&i(h,o)}this.transforms=t}getViews(e){if(this.dataViews)return void(e&&e(this.dataViews));let t=this;(this.modelId?this.viewer3D.getModel(this.modelId)._getMetaDataManager().dataManager:this.viewer3D.getDefaultModel()._getMetaDataManager().dataManager).getViews((function(i){t.dataViews=i,e&&e(i.data)}))}getViewsById(e,t){if(this.integrateDrawingList[e])return void(t&&t(this.integrateDrawingList[e]));let n=this;(this.modelId?this.viewer3D.getModel(this.modelId)._getMetaDataManager().dataManager:this.viewer3D.getDefaultModel()._getMetaDataManager().dataManager).getViewsById(e,(function(o){if(!o.data)return t&&t([]);n.integrateDataViews[e]=o,n.integrateDataViews.resourceHost=o.resourceHost;let s=JSON.parse(o.data).viewList,r=[];for(let e=0;e<s.length;e++){const t=s[e];if(t.preview.path&&n.supportViewTypeMap[t.viewType]){n.drawingIds.push(t.id);var a=i.DrawingView.toObject(t.viewPoint);a.origin.z+=t.elevation;var l={id:t.id,name:t.name,viewPort:a};r.push(l),n.drawingViews.push(t)}}n.drawingList=n.drawingList.concat(r),n.integrateDrawingList[e]=r,t&&t(r)}))}isInclude(e){return this.drawingIds.indexOf(e)>=0}getDrawingList(e,t){if(!e){let e=JSON.parse(JSON.stringify(this.drawingList));return e.forEach((e=>{e.viewPort&&e.viewPort.origin&&(e.viewPort.origin=this.viewer3D.globalUnitUtil.revertTranslate(e.viewPort.origin,["x","y","z"]))})),t&&t(e),e}{if("integrateModel"==this.viewer3D.getModel(this.modelId)._data.modelType){let t=!1,i=this.viewer3D.getModel(this.modelId)._data.integratedFileIds;for(let n in i){if(i[n].indexOf(e)>-1){t=!0;break}}if(!t)return void this.viewer3D.console.warn("Incorrect parameter fileId or incorrect member modelId of DrawingHelperConfig.")}let i=this;this.getViewsById(e,(function(e){return e.forEach((e=>{e.viewPort&&e.viewPort.origin&&(e.viewPort.origin=i.viewer3D.globalUnitUtil.revertTranslate(e.viewPort.origin,["x","y","z"]))})),t&&t(e),e}))}}addDrawingsById(e,t,i){let n=this,o=0;for(let s=0;s<e.length;s++){const r=e[s];if(this.isInclude(r)){this.mapDrawingObject.hasOwnProperty(r)&&(this.removeDrawingsById([r]),console.warn("Duplicate id."));let s=this.createDrawingView();s.activeViewById(r);let a=this.drawingIds.indexOf(r),l=this.drawingViews[a],h=(this.dataViews||this.integrateDataViews).resourceHost+"/"+n.databagId+"/"+l.preview.path;if(null==l.preview.path)return void console.warn("No thumbnail in databag.");if(++o,l.id.indexOf(".")>0){let n=l.id.split(".")[0];if(this.transforms&&this.transforms[n])if(this.transforms[n].slice)for(let s=0,a=this.transforms[n];s<a.length;s++){let n=this.createDrawingView();n.activeViewById(r),n.setLinkFileTranslation(a[s]);let l=n.getOutline3D();this.addPlane(l,t,h,e,o,r,i,s+1==a.length,n)}else{s.setLinkFileTranslation(this.transforms[n]);let a=s.getOutline3D();this.addPlane(a,t,h,e,o,r,i,!0,s)}else{let n=s.getOutline3D();this.addPlane(n,t,h,e,o,r,i,!0,s)}}else{let a=s.getOutline3D();this.addPlane(a,t,h,e,o,r,(function(){n.viewer3D.render(),i&&i()}),!0,s)}}}}addPlane(e,t,i,n,o,s,r,a,l){let h=this;this.customPlaneManager.addPlane(e.min,e.max,i,(function(e){h.mapDrawingObject[s]||(h.mapDrawingObject[s]=[]),"number"!=typeof t&&(t=0),l.update(e,h.viewer3D.globalUnitUtil.translate(t)),l=null,h.mapDrawingObject[s].push(e),a&&o==n.length&&r&&r()}))}clearDrawings(){let e=this.drawingIds;this.removeDrawingsById(e)}hideAllDrawings(){let e=this.drawingIds;this.hideDrawingsById(e)}hideDrawingsById(e){for(let t=0;t<e.length;t++){const i=e[t];if(this.isInclude(i)&&this.mapDrawingObject[i]){let e=this;this.mapDrawingObject[i].forEach((function(t){e.customPlaneManager.hidePlane(t)}))}}this.viewer3D.render()}removeDrawingsById(e){for(let t=0;t<e.length;t++){const i=e[t];if(this.isInclude(i)&&this.mapDrawingObject[i]){let e=this;this.mapDrawingObject[i].forEach((function(t){e.customPlaneManager.removePlane(t)})),delete this.mapDrawingObject[i]}}this.viewer3D.render()}setDrawingsOpacityById(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(this.isInclude(n)&&this.mapDrawingObject[n]){let e=this;this.mapDrawingObject[n].forEach((function(i){e.customPlaneManager.setPlaneOpacity(i,t)}))}}this.viewer3D.render()}showAllDrawings(){let e=this.drawingIds;this.showDrawingsById(e)}showDrawingsById(e){for(let t=0;t<e.length;t++){const i=e[t];if(this.isInclude(i)&&this.mapDrawingObject[i]){let e=this;this.mapDrawingObject[i].forEach((function(t){e.customPlaneManager.showPlane(t)}))}}this.viewer3D.render()}getViewsTree(i,n){if(t.send(e,"getViewsTree"),"[object Function]"===Object.prototype.toString.call(i)&&(n=i,i=""),"integrateModel"==this.viewer3D.getModel(this.modelId)._data.modelType){let e=!1,t=this.viewer3D.getModel(this.modelId)._data.integratedFileIds;for(let n in t){if(t[n].indexOf(i)>-1){e=!0;break}}if(!e)return void this.viewer3D.console.warn("Incorrect parameter fileId or incorrect member modelId of DrawingHelperConfig.")}(this.modelId?this.viewer3D.getModel(this.modelId)._getMetaDataManager().dataManager:this.viewer3D.getDefaultModel()._getMetaDataManager().dataManager).getViewsTree(i,(e=>n(this.viewer3D.globalUnitUtil.excute(e,"mm",this.viewer3D.globalUnitUtil.getGlobalUnit(),["cropBox","outline","elevation"]))))}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RevitHelpers").DrawingHelperConfig=function(){return{viewer:null,modelId:""}};class ObjectEditor{constructor(e,t,i){this.viewer3D=e,this.objectType=t,this.name="Translation",this._eventManager=i,this.initialBoundingBoxPoints=[],this.transformMatrix=new THREE.Matrix4,this.singleModelMatrixInvert=new THREE.Matrix4,this.initialized=!1,"ExternalObject"===t&&(this.externalObjectManager=new Glodon.Bimface.Plugins.ExternalObject.ExternalObjectManager(e))}setEditedObjectId(e){if(this.handleEditedObjectId(e),e=this.editedObjectId,this.viewer3D instanceof Glodon.Bimface.Viewer.ViewerGIS){const t=this.viewer3D.getLayerManager().getLayerByType("ExternalObjectLayer");for(let i=0;i<t.length;i++){let n=!1;const o=t[i].getExternalObjectManager(),s=o.getAllObjectIds();if(this.isEditedMulti()){for(let t=0;t<e.length;t++)if(s.includes(e[i])){this.externalObjectManager=o,n=!0;break}if(n)break}else if(s.includes(e)){this.externalObjectManager=o;break}}}this.isEditedMulti()&&this.init()}handleEditedObjectId(e){this.editedObjectId=Array.isArray(e)&&1===e.length?e[0]:e}getEditedObjectId(){return this.editedObjectId}isEditedMulti(){return Array.isArray(this.editedObjectId)&&this.editedObjectId.length>1}init(){if(!this.initialized&&this.isEditedMulti()){const e=this.editedObjectId[0];this.singleModelMatrixInvert=this.getModelTransformMatrix(e).invert();const t=this.editedObjectId.reduce(((e,t)=>{const{min:i,max:n}=this.getSingleBoundingBoxWorld(t);return e.push(i,n),e}),[]),{min:i,max:n}=(new THREE.Box3).setFromPoints(t);this.initialCenter=(new THREE.Vector3).addVectors(i,n).multiplyScalar(.5),this.initialBoundingBoxPoints=[new THREE.Vector3(i.x,i.y,i.z),new THREE.Vector3(n.x,i.y,i.z),new THREE.Vector3(n.x,n.y,i.z),new THREE.Vector3(i.x,n.y,i.z),new THREE.Vector3(i.x,i.y,n.z),new THREE.Vector3(n.x,i.y,n.z),new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(i.x,n.y,n.z)],this.initialized=!0}}resetInitialValues(){this.initialBoundingBoxPoints=[],this.transformMatrix=new THREE.Matrix4,this.singleModelMatrixInvert=new THREE.Matrix4,this.initialized=!1}getBoundingBoxWorld(){const e=this.objectType;if(this.isEditedMulti()){return(new THREE.Box3).setFromPoints(this.initialBoundingBoxPoints.map((e=>e.clone().applyMatrix4(this.transformMatrix))))}if("ExternalObject"===e)return this.viewer3D.getExternalComponentManager().getBoundingBoxById(this.editedObjectId);return this.viewer3D.getViewer().getModelManager().getModel(this.editedObjectId).getBoundingBoxWorld()}getTransformMatrix(){return this.isEditedMulti()?this.transformMatrix:this.getModelTransformMatrix(this.editedObjectId)}getSingleBoundingBoxWorld(e){if("ExternalObject"===this.objectType)return this.viewer3D.getExternalComponentManager().getBoundingBoxById(e);return this.viewer3D.getViewer().getModelManager().getModel(e).getBoundingBoxWorld()}getModelTransformMatrix(e){if("ExternalObject"===this.objectType){let t=this.viewer3D.getExternalComponentManager().getGroupTransform(e);return(new THREE.Matrix4).compose(t.position,t.rotate,t.scale)}return this.viewer3D.getViewer().getModelManager().getModel(e).getTransformMatrix().clone()}getBoundaryPoints(){const e=this.objectType;if(this.isEditedMulti()){const e=this.transformMatrix;return this.initialBoundingBoxPoints.map((t=>t.clone().applyMatrix4(e)))}if("ExternalObject"===e)return this.viewer3D.getExternalComponentManager().getBoundaryPoints(this.editedObjectId);return this.viewer3D.getViewer().getModelManager().getModel(this.editedObjectId).getBoundaryPoints()}getBoundingBox(){let e=this.getBoundaryPoints(),t=this.getRotationMatrix().invert(),i=[];return e.map((e=>i.push(e.clone().applyMatrix4(t)))),(new THREE.Box3).setFromPoints(i)}getRotationMatrix(){let e=new THREE.Matrix4,t=this.getTransformMatrix();return e.extractRotation(t),e}_fireModelEvent(e){const t=this._eventManager,i=Array.isArray(this.editedObjectId)?this.editedObjectId:[this.editedObjectId],n={};i.map((e=>{n[e]=this.viewer3D.getModel(e).getModelTransformationAdaptedUnit()})),t.fireEvent(e,{modelId:i,transformation:n})}updateController(e){}updateTransformMatrix(){const e=this.editedObjectId[0],t=this.getModelTransformMatrix(e);this.transformMatrix=t.multiply(this.singleModelMatrixInvert)}_scaleOnBasePoint(e,t,i){const n=new THREE.Vector3,o=new THREE.Quaternion,s=new THREE.Vector3;e.decompose(n,o,s),s.multiply(i);const r=i.clone().sub(new THREE.Vector3(1,1,1)),a=o.clone(),l=a.clone().invert(),h=n.clone(),d=t.clone().sub(h).applyQuaternion(l).multiply(r).applyQuaternion(a);n.sub(d);return(new THREE.Matrix4).compose(n,o,s)}_rotateOnBasePoint(e,t,i,n){const o=new THREE.Vector3,s=new THREE.Quaternion,r=new THREE.Vector3;e.decompose(o,s,r);const a=s.clone().invert(),l=(new THREE.Quaternion).setFromAxisAngle(i,n);s.multiply(l);const h=o.clone(),d=t.clone().sub(h).applyQuaternion(a).applyQuaternion(s);o.sub(d).add(t.clone().sub(h));return(new THREE.Matrix4).compose(o,s,r)}getExternalObjectTransform(e){const t=this.externalObjectManager.getTransformation(e);return(new THREE.Matrix4).fromArray(t)}setRotation(e,t){const i=this.objectType,n=t;if(this.isEditedMulti()){const t=this.editedObjectId.length,i=this.viewer3D.globalUnitUtil.revertVector(this.initialCenter.clone().applyMatrix4(this.transformMatrix)),o=this.transformMatrix.clone();let s;switch(n){case"xy":s=new THREE.Vector3(0,0,1);break;case"xz":s=new THREE.Vector3(0,1,0);break;case"yz":s=new THREE.Vector3(1,0,0)}const r=this._rotateOnBasePoint(this.transformMatrix.clone(),i,s,e),a=o.clone().invert();for(let e=0;e<t;e++){const t=this.editedObjectId[e];let i;if("ExternalObject"===this.objectType)i=this.getExternalObjectTransform(t);else{const e=this.viewer3D.getModel(t).getModelTransformation();i=(new THREE.Matrix4).fromArray(e)}const n=r.clone().multiply(a.clone().multiply(i));"ExternalObject"===this.objectType?this.externalObjectManager.setTransformation(t,n.elements):this.viewer3D.getModel(t).setModelTransformation(n.elements)}this.updateTransformMatrix()}else{const t=this.viewer3D.globalUnitUtil.revertVector(this.getEditObjectCenter());if("ExternalObject"===i)"xy"===n&&this.externalObjectManager.setRotationZ(this.editedObjectId,t,e),"xz"===n&&this.externalObjectManager.setRotationY(this.editedObjectId,t,e),"yz"===n&&this.externalObjectManager.setRotationX(this.editedObjectId,t,e);else if("Model"==i){const i=this.viewer3D.getModel(this.editedObjectId);"xy"===n&&i.setModelRotationZ(t,e),"xz"===n&&i.setModelRotationY(t,e),"yz"===n&&i.setModelRotationX(t,e)}}"ExternalObject"!==this.objectType&&this._fireModelEvent("ModelTransforming")}getEditObjectCenter(){return this._modelCenter=new THREE.Vector3,this.getBoundingBoxWorld().getCenter(this._modelCenter),this._modelCenter}setObjectScale(e,t){const i=this.objectType;if(this.isEditedMulti()){const n=this.editedObjectId.length,o=this.transformMatrix.clone(),s=this._scaleOnBasePoint(this.transformMatrix.clone(),e,t),r=o.clone().invert();for(let e=0;e<n;e++){const t=this.editedObjectId[e],n="ExternalObject"===i?this.getExternalObjectTransform(t).elements:this.viewer3D.getModel(t).getModelTransformation(),o=(new THREE.Matrix4).fromArray(n),a=s.clone().multiply(r.clone().multiply(o));"ExternalObject"===this.objectType?this.externalObjectManager.setTransformation(t,a.elements):this.viewer3D.getModel(t).setModelTransformation(a.elements)}this.updateTransformMatrix()}else"ExternalObject"===i?this.externalObjectManager.scaleOnBasePoint(this.getEditedObjectId(),e,t):"Model"===i&&this.viewer3D.getModel(this.getEditedObjectId()).setModelScale(e,t),"ExternalObject"!==this.objectType&&this._fireModelEvent("ModelTransforming")}setObjectTranslation(e){const t=this.objectType;if(this.isEditedMulti())this.editedObjectId.forEach((i=>{if("ExternalObject"===t)this.externalObjectManager.translate(i,e);else if("Model"===t){this.viewer3D.getModel(i).setModelTranslation(e)}}));else{const i=this.editedObjectId;if("ExternalObject"===t)this.externalObjectManager.translate(i,e);else if("Model"===t){this.viewer3D.getModel(i).setModelTranslation(e)}}this.isEditedMulti()&&this.updateTransformMatrix(),"ExternalObject"!==this.objectType&&this._fireModelEvent("ModelTransforming")}setName(e){this.name=e}}let DomNS$2=Glodon.Web.Lang.Utility.Namespace.ensureNamespace(Glodon,"Web.Lang.Utility.Dom"),ObjectEditorNS=Glodon.Web.Lang.Utility.Namespace.ensureNamespace(Glodon,"Bimface.Plugins.ObjectEditor");class ObjectEditorManager{constructor(e,t){this.viewer=e,this.editObjectType=t,skipVueObserver(this),this.activeEditors=[],this.rotationController={X:!0,Y:!0,Z:!0},this.translationController={X:!0,Y:!0,Z:!0},this.scaleController={Uniform:!0,X:!0,Y:!0,Z:!0},this.initilize()}initilize(){this.initHelperAndEvent();let e=new Glodon.Web.Lang.EventManager;this.getEventManager=function(){return e},this.activeEditor=new ObjectEditor(this.viewer,this.editObjectType,e)}initHelperAndEvent(){this.helper=CLOUD.Interaction.InteractionHelper.getInstance(this.viewer.getViewer()),this.helperEvents={},this.addHelperEvent("TransformStarted",(e=>{"Model"===this.editObjectType&&this.activeEditor._fireModelEvent("ModelTransformStart")})),this.addHelperEvent("TransformChanged",(e=>{if("Translation"===e.id){let t=e.control.position.clone(),i={x:t.x-this.objectPositon.x,y:t.y-this.objectPositon.y,z:t.z-this.objectPositon.z};this.activeEditor.setObjectTranslation(this.viewer.globalUnitUtil.revertTranslate(i,["x","y","z"])),this.objectPositon=t}else if("Scale"===e.id){let t=e.control.scaleInfo,i={};if(t){let n=this.activeEditor.getBoundaryPoints(),o=null;const s=(e,t,i,o)=>{let s=n[e],r=n[t],a=n[i],l=n[o];return(new THREE.Vector3).add(s).add(r).add(a).add(l).multiplyScalar(.25)};switch(t.type){case"AxisX":o=s(0,3,7,4),i=new THREE.Vector3(t.scaleFactor/this.objectScale.x,1,1);break;case"AxisXN":o=s(1,2,6,5),i=new THREE.Vector3(t.scaleFactor/this.objectScale.x,1,1);break;case"AxisY":o=s(0,1,5,4),i=new THREE.Vector3(1,t.scaleFactor/this.objectScale.y,1);break;case"AxisYN":o=s(2,3,7,6),i=new THREE.Vector3(1,t.scaleFactor/this.objectScale.y,1);break;case"AxisZ":o=s(0,1,2,3),i=new THREE.Vector3(1,1,t.scaleFactor/this.objectScale.z);break;case"AxisZN":o=s(4,5,6,7),i=new THREE.Vector3(1,1,t.scaleFactor/this.objectScale.z);break;default:o=s(0,1,2,3).add(s(4,5,6,7)).multiplyScalar(.5),i=new THREE.Vector3(t.scaleFactor/this.objectScale.x,t.scaleFactor/this.objectScale.y,t.scaleFactor/this.objectScale.z)}o=this.viewer.globalUnitUtil.revertVector(o),this.activeEditor.setObjectScale(o,i),e.control.update(this.activeEditor.getBoundingBox());let r=new THREE.Vector3;this.activeEditor.getBoundingBoxWorld().getCenter(r),e.control.setPosition(r),this.objectScale={x:t.scaleFactor,y:t.scaleFactor,z:t.scaleFactor}}}else if("Rotate"===e.id){let t=e.control.rotateInfo,i="";if(t){switch(t.type){case"ringX":default:i="yz";break;case"ringY":i="xz";break;case"ringZ":i="xy"}switch(this.activeEditor.setRotation(t.angle,i),t.type){case"ringX":e.control.rotateX(t.angle);break;case"ringY":e.control.rotateY(t.angle);break;default:e.control.rotateZ(t.angle)}}}})),this.addHelperEvent("TransformFinished",(e=>{"Scale"===e.id&&(this.objectScale={x:1,y:1,z:1}),"Model"===this.editObjectType&&this.activeEditor._fireModelEvent("ModelTransformEnd")}))}addHelperEvent(e,t){this.helperEvents[e]=t,this.helper.addEventListener(e,t)}setEditedObjectId(e){this.editedObjectId=e,Array.isArray(e)&&this.activeEditor.resetInitialValues(),this.activeEditor.setEditedObjectId(e),this.dispose();let t=new THREE.Vector3;switch(this.activeEditor.name){case"Translation":this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Translation","TranslateControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Translation").applyMatrix4(this.activeEditor.getRotationMatrix()),this.objectPositon=this.helper.getControl("Translation").position.clone();break;case"Scaling":this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Scale","ScaleControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Scale").applyMatrix4(this.activeEditor.getRotationMatrix()),this.objectScale={x:1,y:1,z:1};break;case"Rotation":this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Rotate","RotateControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Rotate").applyMatrix4(this.activeEditor.getRotationMatrix())}this.changeControlArrowDirection(),this.updateController()}attachInitDrawables(){}getEditedObjectId(){return this.editedObjectId}activateEditor(e){this.dispose();let t=new THREE.Vector3;switch(e){case"Translation":this.activeEditor.setName("Translation"),this.activeEditor.setEditedObjectId(this.editedObjectId),this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Translation","TranslateControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Translation").applyMatrix4(this.activeEditor.getRotationMatrix()),this.objectPositon=this.helper.getControl("Translation").position.clone();break;case"Scaling":this.activeEditor.setName("Scaling"),this.activeEditor.setEditedObjectId(this.editedObjectId),this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Scale","ScaleControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Scale").applyMatrix4(this.activeEditor.getRotationMatrix()),this.objectScale={x:1,y:1,z:1};break;case"Rotation":this.activeEditor.setName("Rotation"),this.activeEditor.setEditedObjectId(this.editedObjectId),this.activeEditor.getBoundingBox().getCenter(t),this.helper.addControl("Rotate","RotateControl",{position:t,boundingBox:this.activeEditor.getBoundingBox()}),this.helper.getControl("Rotate").applyMatrix4(this.activeEditor.getRotationMatrix())}this.changeControlArrowDirection(),this.activeEditor.setEditedObjectId(this.editedObjectId),this.updateController()}changeControlArrowDirection(){const e=this.viewer.getViewer().camera._direction&&this.viewer.getViewer().camera._direction.clone().applyMatrix4(this.helper.invertMatrix).normalize(),t=this.viewer.getViewer().camera.position.clone().applyMatrix4(this.helper.invertMatrix),i=this.viewer.getViewer().camera.fov;this.helper.dispatchEvent({type:"CameraChanged",cameraDirection:e,cameraPosition:t,cameraFov:i})}dispose(){this.helper.removeControl("Translation"),this.helper.removeControl("Scale"),this.helper.removeControl("Rotate")}hide(){this.helper.getControl("Translation")&&(this.helper.getControl("Translation").visible=!1),this.helper.getControl("Scale")&&(this.helper.getControl("Scale").visible=!1),this.helper.getControl("Rotate")&&(this.helper.getControl("Rotate").visible=!1),this.viewer.render()}show(){this.helper.getControl("Translation")&&(this.helper.getControl("Translation").visible=!0),this.helper.getControl("Scale")&&(this.helper.getControl("Scale").visible=!0),this.helper.getControl("Rotate")&&(this.helper.getControl("Rotate").visible=!0),this.viewer.render()}onExit(){this.dispose(),this.isExitNow=!0,Object.entries(this.helperEvents).forEach((([e,t])=>{this.helper.removeEventListener(e,t)})),this.viewer.render()}updateController(e,t){switch(t){case"Translation":null!=e.X&&(this.translationController.X=e.X),null!=e.Y&&(this.translationController.Y=e.Y),null!=e.Z&&(this.translationController.Z=e.Z);break;case"Rotation":null!=e.X&&(this.rotationController.X=e.X),null!=e.Y&&(this.rotationController.Y=e.Y),null!=e.Z&&(this.rotationController.Z=e.Z);break;case"Scaling":null!=e.X&&(this.scaleController.X=e.X),null!=e.Y&&(this.scaleController.Y=e.Y),null!=e.Z&&(this.scaleController.Z=e.Z),null!=e.Uniform&&(this.scaleController.Uniform=e.Uniform)}const i={...this.scaleController};this.activeEditor&&this.activeEditor.isEditedMulti()&&(i.X=i.Y=i.Z=!1),this.helper.getControl("Translation")&&this.helper.getControl("Translation").updateAxisVisible(this.translationController),this.helper.getControl("Rotate")&&this.helper.getControl("Rotate").updateAxisVisible(this.rotationController),this.helper.getControl("Scale")&&this.helper.getControl("Scale").updateAxisVisible(i)}}ObjectEditorNS.ObjectEditorManager=ObjectEditorManager;const ExternalObjectEditorToolbarEvent={Exit:"Exit",EditingModeChanged:"EditingModeChanged"},SDM=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),SNS="bf_interaction.sceneEditor";let DomNS$3=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");class ObjectEditorToolbar{constructor(e){this.viewer=e.viewer,this.objectId=e.objectId,skipVueObserver(this),this.viewer._objectEditorToolbar&&this.viewer._objectEditorToolbar.exit(),this.mode=null,this.toolBarButtons={translate:!e.buttonVisibility.hasOwnProperty("translate")||e.buttonVisibility.translate,rotate:!e.buttonVisibility.hasOwnProperty("rotate")||e.buttonVisibility.rotate,scale:!e.buttonVisibility.hasOwnProperty("scale")||e.buttonVisibility.scale},this.viewer._objectEditorToolbar=this,this.rotationController={X:!e.rotationController.hasOwnProperty("X")||e.rotationController.X,Y:!e.rotationController.hasOwnProperty("Y")||e.rotationController.Y,Z:!e.rotationController.hasOwnProperty("Z")||e.rotationController.Z},this.translationController={X:!e.translationController.hasOwnProperty("X")||e.translationController.X,Y:!e.translationController.hasOwnProperty("Y")||e.translationController.Y,Z:!e.translationController.hasOwnProperty("Z")||e.translationController.Z},Array.isArray(this.objectId)&&this.objectId.length>1?this.scaleController={Uniform:!e.scaleController.hasOwnProperty("Uniform")||e.scaleController.Uniform,X:!!e.scaleController.hasOwnProperty("X")&&e.scaleController.X,Y:!!e.scaleController.hasOwnProperty("Y")&&e.scaleController.Y,Z:!!e.scaleController.hasOwnProperty("Z")&&e.scaleController.Z}:this.scaleController={Uniform:!e.scaleController.hasOwnProperty("Uniform")||e.scaleController.Uniform,X:!e.scaleController.hasOwnProperty("X")||e.scaleController.X,Y:!e.scaleController.hasOwnProperty("Y")||e.scaleController.Y,Z:!e.scaleController.hasOwnProperty("Z")||e.scaleController.Z}}setRotationController(e){e&&(this.rotationController=e),this.objectEditorManager.updateController(this.rotationController,"Rotation")}getRotationController(){let e={};return e.X=!this.rotationController.hasOwnProperty("X")||this.rotationController.X,e.Y=!this.rotationController.hasOwnProperty("Y")||this.rotationController.Y,e.Z=!this.rotationController.hasOwnProperty("Z")||this.rotationController.Z,e}setTranslationController(e){e&&(this.translationController=e),this.objectEditorManager.updateController(this.translationController,"Translation")}getTranslationController(){let e={};return e.X=!this.translationController.hasOwnProperty("X")||this.translationController.X,e.Y=!this.translationController.hasOwnProperty("Y")||this.translationController.Y,e.Z=!this.translationController.hasOwnProperty("Z")||this.translationController.Z,e}setScaleController(e){e&&(this.scaleController=e),this.objectEditorManager.updateController(this.scaleController,"Scaling")}getScaleController(){let e={};return e.X=!this.scaleController.hasOwnProperty("X")||this.scaleController.X,e.Y=!this.scaleController.hasOwnProperty("Y")||this.scaleController.Y,e.Z=!this.scaleController.hasOwnProperty("Z")||this.scaleController.Z,e.Uniform=!this.scaleController.hasOwnProperty("Uniform")||this.scaleController.Uniform,e}setButtonVisibility(e){e&&(this.toolBarButtons=e,this._updateButtonsVisibility())}getButtonVisibility(){let e={};return e.translate=!this.toolBarButtons.hasOwnProperty("translate")||this.toolBarButtons.translate,e.rotate=!this.toolBarButtons.hasOwnProperty("rotate")||this.toolBarButtons.rotate,e.scale=!this.toolBarButtons.hasOwnProperty("scale")||this.toolBarButtons.scale,e}_updateButtonsVisibility(){this.toolBarButtons.scale||this.toolBarButtons.rotate||this.toolBarButtons.translate?(this.switchToolbarAllHide=!1,this.show()):(this.setBimfaceUIVisibility(!1),this.switchToolbar.hide(),this.switchToolbarAllHide=!0);let e=this.switchToolbar.getControls(),t=this.getButton("Translation",e),i=this.getButton("Rotation",e),n=this.getButton("Scaling",e);this.toolBarButtons.translate?t.show():t.hide(),this.toolBarButtons.rotate?i.show():i.hide(),this.toolBarButtons.scale?n.show():n.hide()}_updateController(){this.objectEditorManager&&(this.objectEditorManager.updateController(this.translationController,"Translation"),this.objectEditorManager.updateController(this.rotationController,"Rotation"),this.objectEditorManager.updateController(this.scaleController,"Scaling"))}setEditingMode(e){if(this.objectEditorManager){switch(e){case"rotation":this.mode="rotation",this.objectEditorManager.activateEditor("Rotation");break;case"translation":this.mode="translation",this.objectEditorManager.activateEditor("Translation");break;case"scale":this.mode="scale",this.objectEditorManager.activateEditor("Scaling")}this.objectEditorManager.show()}}getEditingMode(){return this.mode}setEditedObjectId(e){this.objectEditorManager.setEditedObjectId(e)}getEditedObjectId(){return this.objectEditorManager.getEditedObjectId()}show(){this._destroyed||(this.viewer.viewerType,this.setBimfaceUIVisibility(!1),this.modelEditor.show(),this.switchToolbarAllHide||this.switchToolbar.show(),this.objectEditorManager.show())}hide(){this._destroyed||(this.viewer.viewerType,this.setBimfaceUIVisibility(!0),this.modelEditor.hide(),this.switchToolbar.hide(),this.objectEditorManager.hide())}exit(){this._destroyed||(this.hide(),this._getEventManager().fireEvent(ExternalObjectEditorToolbarEvent.Exit),this.objectEditorManager.onExit(),delete this.viewer._objectEditorToolbar,this.destroy())}destroy(){this.domElement&&this.domElement.remove(),this.domElement=null,this.viewer=null,this.objectId=null,this.objectEditorManager=null,this._destroyed=!0}update(){}updateManagerController(e,t){this.objectEditorManager.updateController(e,type)}initialize(){this.mapUIVisibility={"bf-tree-toolbar":"none","bf-modelTree-panel":"none","bf-toolbar-bottom":"none","bf-property-panel":"none","bf-measurement-panel":"none","bf-sectionPlane-panel":"none","bf-pickSectionPlane-panel":"none","bf-sectionBox-panel":"none","bf-settings-panel":"none","bf-basicInfo-panel":"none","bf-map-panel":"none"},this.recordUIVisibility()}toolBarDom(e=!1){const t=this;let i=[];const n=DomNS$3.create("div",e?"bf-effectToolbar":"bf-roomEditorToolbar");if(t.domElement=n,n.style.zIndex=1,n.addEventListener("mousedown",(e=>(e.stopPropagation(),!1))),e){const e=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;e.element=n,e.className="bf-toolbar bf-toolbar-effectToolbar switch-btn";let o=this.modelEditor=new Glodon$1.Bimface.UI.Toolbar.Toolbar(e);t.modelEditor=o,i.push(o);const s=new Glodon$1.Bimface.UI.Button.ButtonConfig;s.className="bf-button bimface-icon gld-bf-edit-24",s.title="点击隐藏编辑控件",s.checkedState=!0;const r=new Glodon$1.Bimface.UI.Button.ToggleButton(s);r.addEventListener("StateChange",(e=>{e?(r.element.title="点击隐藏编辑控件",SDM.send(SNS,"editorStatusOn"),this.objectEditorManager.show(),this.objectEditorManager.activateEditor("Translation")):(r.element.title="点击显示编辑控件",SDM.send(SNS,"editorStatusOff"),this._getEventManager().fireEvent(ExternalObjectEditorToolbarEvent.Exit),this.objectEditorManager.dispose(),this.objectEditorManager.hide()),this.toggleOtherButtons(e)})),o.addControl(r)}if(void 0===this.switchToolbar){var o=Glodon$1.Bimface.UI.Toolbar.ToolbarConfig();o.className=e?"bf-toolbar bf-toolbar-effectToolbar":"bf-toolbar bf-toolbar-roomEditor",o.element=n,o.buttons=["ModelEditingTranslate","ModelEditingRotate","ModelEditingScale"],this.viewer.getDomElement().appendChild(n),this.switchToolbar=new Glodon$1.Bimface.Application.UI.Toolbar.Toolbar(o),i.push(this.switchToolbar)}let s=Glodon$1.Bimface.UI.Control.ControlEvent,r=this.switchToolbar.getControls();this.uncheckOthers("Translation",r);let a=["Translation","Rotation","Scaling"];t._editingMode="Translation";for(let e=0;e<r.length;e++){let i=r[e];i.addEventListener(s.Click,(function(){if(i.isChecked()){t.objectEditorManager.activateEditor(a[e]),t.uncheckOthers(i.getId(),r);let n="Scaling"===i.getId()?"Scale":i.getId();t._getEventManager().fireEvent(ExternalObjectEditorToolbarEvent.EditingModeChanged,{previousEditingMode:t._editingMode,followingEditingMode:n}),t._editingMode=n}else i.toggleCheckedState()}))}if(!e){const e=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;e.element=n,e.className="bf-toolbar bf-toolbar-roomEditor";let o=t.modelEditor=new Glodon$1.Bimface.UI.Toolbar.Toolbar(e);t.modelEditor=o,i.push(o);const s=new Glodon$1.Bimface.UI.Button.ButtonConfig;s.className="bf-modeleditor-cancel",s.title=BimfaceLanguage.bf_general_exit;const r=new Glodon$1.Bimface.UI.Button.SingleButton(s);r.setHtml("退出"===BimfaceLanguage.bf_general_exit?"退 出":BimfaceLanguage.bf_general_exit),r.addEventListener("Click",(()=>{this.exit()})),o.addControl(r)}this.viewer.getDomElement().appendChild(n),this._updateButtonsVisibility(),this._updateController()}recordUIVisibility(){let e=Object.keys(this.mapUIVisibility);for(const t of e){let e=document.getElementsByClassName(t);e.length>0&&(this.mapUIVisibility[t]=e[0].style.display)}}uncheckOthers(e,t){for(const i of t)i.getId()===e?i.setCheckedState(!0):i.setCheckedState(!1)}getButton(e,t){for(let i=0;i<t.length;i++){let n=t[i];if(n.getId()===e)return n}}setBimfaceUIVisibility(e){let t=Object.keys(this.mapUIVisibility);for(const i of t){let t=document.getElementsByClassName(i);0!=t.length&&(t[0].style.display=0==e?"none":this.mapUIVisibility[i])}}_getEventManager(){return this.objectEditorManager.getEventManager()}addEventListener(e,t){this._getEventManager().addEvent(e,t)}removeEventListener(e,t){this._getEventManager().removeEvent(e,t)}toggleOtherButtons(e){let t,i=this.switchToolbar.getControls();i.length&&(t=i[0],t.element.parentElement.style.display=e?"flex":"none");for(let n=0;n<i.length;n++)t=i[n],e&&(0===n?t.setCheckedState(!0):t.setCheckedState(!1))}}function getRealModelId(e){let t=e.modelId;if(Array.isArray(e.ids)&&e.ids.length>0)return"ViewerGIS"===e.viewer.getViewerType()?e.ids.reduce(((t,i)=>{const n=e.viewer.getLayerManager().getLayer(i);return n&&t.push(n.getModelId()),t}),[]):e.ids;if("ViewerGIS"===e.viewer.getViewerType()&&e.layerId){const i=e.viewer.getLayerManager().getLayer(e.layerId);i&&(t=i.getModelId())}return t}Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ModelEditor").ModelEditorToolbarConfig=function(){return{viewer:null,modelId:null,layerId:null,app:null,buttonVisibility:{},translationController:{},rotationController:{},scaleController:{},ids:null}},function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ModelEditor"));t.ModelEditorToolbar=class extends ObjectEditorToolbar{constructor(t){e.send("Bimface.Plugins.ModelEditor","ModelEditorToolbar"),t.objectId=getRealModelId(t),super(t),this.name="ModelEditorToolbar",this.editedId=t.objectId,this.initialize(),this.toolBarDom(t.isGisEdit)}setButtonVisibility(e){super.setButtonVisibility(e)}getButtonVisibility(){return super.getButtonVisibility()}setEditedModelId(e){super.setEditedObjectId(e)}getEditedModelId(){return super.getEditedObjectId()}setEditedModel(e){const t=getRealModelId({viewer:this.viewer,modelId:e,layerId:e});super.setEditedObjectId(t),this.editedId=e}getEditedModel(){return this.editedId}setEditedModels(e){const t=getRealModelId({viewer:this.viewer,ids:e,layerIds:e});super.setEditedObjectId(t),this.editedId=e}getEditedModels(){return this.editedId}show(){super.show()}hide(){super.hide()}exit(){super.exit(),CLOUD.GlobalData.GTAO=this.enableGTAO}setRotationController(e){super.setRotationController(e)}getRotationController(){return super.getRotationController()}setTranslationController(e){super.setTranslationController(e)}getTranslationController(){return super.getTranslationController()}setScaleController(e){super.setScaleController(e)}getScaleController(){return super.getScaleController()}setEditingMode(e){super.setEditingMode(e)}getEditingMode(){return super.getEditingMode()}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}initialize(){super.initialize(),this.objectEditorManager=new ObjectEditorManager(this.viewer,"Model"),this.objectEditorManager.setEditedObjectId(this.objectId),this.enableGTAO=CLOUD.GlobalData.GTAO,!0===this.enableGTAO&&(CLOUD.GlobalData.GTAO=!1)}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ModelEditor");let t=Object.freeze({ModelTransformStart:"ModelTransformStart",ModelTransforming:"ModelTransforming",ModelTransformEnd:"ModelTransformEnd",Exit:"Exit",EditingModeChanged:"EditingModeChanged"});e.ModelEditorToolbarEvent=t}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ExternalObject").loadersConfig=function(){return{"3DS":{loaderName:"TDSLoader",loaderFiles:["TDSLoader.js"]},FBX:{loaderName:"FBXLoader",loaderFiles:["fflate.min.js","FBXLoader.js"]},OBJ:{loaderName:"OBJLoader",loaderFiles:["OBJLoader.js"]},MTL:{loaderName:"MTLLoader",loaderFiles:["MTLLoader.js"]}}},function(){var e="Bimface.Plugins.ExternalObject.ExternalObjectManager",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let i=Glodon$1.Web.Lang.Utility.HttpRequest,n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ExternalObject");n.ExternalObjectManager=class{constructor(i){if(t.send(e,"bf_c_extObjMng_new"),i._plugins&&i._plugins.externalObjectManager)return i._plugins.externalObjectManager;i._plugins&&(i._plugins.externalObjectManager=this),this._viewer=i,i.externalComponentManager&&!i.externalComponentManager.isDestroyed()||(i.externalComponentManager=new CLOUD.ExternalComponentManager(i.getViewer()),i.externalComponentManager._objects={}),this._manager=i.externalComponentManager,this._objects=this._manager._objects,this.modelId="ExternalComponent";let n=new Glodon$1.Web.Lang.EventManager;return this.getEventManager=function(){return n},this._sceneScale=i.globalUnitUtil.translateVector(new THREE.Vector3(1,1,1)),this._scaledIdMap={},this.urlMap={},i.externalObjectManager=this,this.enableLight=!1,this.console=new Glodon$1.Web.Common.Console,skipVueObserver(this),this}addEventListener(e,t){this.getEventManager().addEvent(e,t)}removeEventListener(e,t){this.getEventManager().removeEvent(e,t)}addObject(i,n,o){return t.send(e,"bf_c_extObjMng_addObj"),console.warn("[BIMFACE WARN]: ExternalObjectManager.addObject(name, object, modelId) is obsolete, please use ExternalObjectManager.loadObject(option, successCallback, failureCallback) instead."),this._addObject(i,n,o)}_isBuildInGeometry(e){return e instanceof Glodon$1.Bimface.Plugins.Geometry.SplineCurve||e instanceof Glodon$1.Bimface.Plugins.Geometry.SpatialPlane||e instanceof Glodon$1.Bimface.Plugins.Geometry.Plane||e instanceof Glodon$1.Bimface.Plugins.Geometry.Pipe||e instanceof Glodon$1.Bimface.Plugins.Geometry.Band||e instanceof Glodon$1.Bimface.Plugins.Geometry.PlaneBufferGeometry}_addObject(e,t,i,n){if(t.viewer||(t.viewer=this._viewer),!this.getObjectIdByName(e)){if(!this.enableLight){let e=t.children.filter((e=>"AmbientLight"!==e.type));t.children=e}this._isBuildInGeometry(t)&&(t=t._rebuild?t._rebuild(this._viewer):t);var o=Glodon$1.Web.Lang.Utility.UUID.createUUID();return this._manager.addNode(o,t),this._objects[o]=e,this._viewer.getViewer().render(),"Viewer3D"===this._viewer.getViewerType()&&this._manager.bindModel(o,i||t._modelId||this._viewer.getDefaultModel().modelId,n),this._isBuildInGeometry(t)||!1===t._externalNeedScale?this._scaledIdMap[o]=!1:(this.scale(o,this._sceneScale),this._scaledIdMap[o]=!0),o}console.warn(`[ExternalObjectManager.addObject] 已有名为 "${e}" 的ExternalObject,请更换名称后再执行ExternalObjectManager.addObject()`)}_isNameRepeated(e,t){const i=this.urlMap[e].optionList;for(const e of i)if(e.name===t)return!0;return!1}addObjectByUrl(e,t,i,n,o){console.warn("[BIMFACE WARN]: ExternalObjectManager.addObjectByUrl(name, objectUrl, callback, modelId) is obsolete, please use ExternalObjectManager.loadObject(option, successCallback, failureCallback) instead."),this.loadObject({name:e,url:{objectUrl:t.url,mtlUrl:t.mtlUrl},association:{modelId:n}},i,o)}loadObject(e,t,n){const o=e.name,s=e.url,r=s&&s.objectUrl;if(!o||!r&&!e.object)return console.warn("[BIMFACE WARN]: option.name and (option.url.objectUrl or option.object) must not be undefined"),void(n&&n());void 0!==e.enableLight&&(this.enableLight=e.enableLight);const a=e.association&&e.association.modelId,l=e.association&&e.association.objectId;let h=this;function d(){if(CLOUD.Utils.isDefined(e.objectData)){let t=h.getObjectIdByName(o);h.setObjectData(t,e.objectData)}t&&t()}if(CLOUD.Utils.isDefined(e.object)){const t=this._addObject(o,e.object,a,l);if(t)return d(),t;n&&n()}else if(CLOUD.Utils.isDefined(s)){if(this.urlMap[r]&&!0===this.urlMap[r].pending){this.urlMap[r].callbackList.push(d),n&&this.urlMap[r].errorCallbackList.push(n);const e={name:o,modelId:a,bindObjectId:l};if(this._isNameRepeated(r,o))return;return void this.urlMap[r].optionList.push(e)}if(this.urlMap[r]&&!1===this.urlMap[r].pending)return this.cloneWithModelId(this.urlMap[r].originId,o,a,l),void d();this.urlMap[r]={},this.urlMap[r].pending=!0,this.urlMap[r].callbackList=[],this.urlMap[r].callbackList.push(d),this.urlMap[r].errorCallbackList=[],n&&this.urlMap[r].errorCallbackList.push(n);const e={name:o,modelId:a,bindObjectId:l};this.urlMap[r].optionList=[e];new Promise(((e,t)=>{const n=window.BimfaceLoaderConfig.fullStaticHost,r=Glodon$1.Bimface.Plugins.ExternalObject.loadersConfig();let h=[];for(let e in s){if(void 0===s[e])continue;let t=s[e].split(".").pop().toUpperCase(),i=r[t]&&r[t].loaderFiles;if(void 0===i)return console.warn("File format not supported, currently supported formats: 3DS, FBX, OBJ."),!1;i.forEach((e=>{h.push(`${n}/lib/loaders/${e}`)}))}i.getScripts(h,(()=>{const{objectUrl:i,mtlUrl:n}=s,h=i.split(".").pop().toUpperCase(),d=r[h].loaderName;let c=new THREE[d];if(void 0===n)c.load(i,(t=>{const n=this._addObject(o,t,a,l);this.urlMap[i].originId=n,this.urlMap[i].pending=!1,e()}),(()=>{}),(()=>{t()}));else{(new THREE.MTLLoader).load(n,(n=>{n.preload(),c.setMaterials(n),c.load(i,(t=>{const n=this._addObject(o,t,a,l);this.urlMap[i].originId=n,this.urlMap[i].pending=!1,e()}),(()=>{}),(()=>{t()}))}),(()=>{}),(()=>{t()}))}}))})).then((()=>{this.urlMap[r].callbackList.map(((e,t)=>{const{name:i,modelId:n,bindObjectId:o}=this.urlMap[r].optionList[t];this.cloneWithModelId(this.urlMap[r].originId,i,n,o),e()}))})).catch((()=>{for(let e of this.urlMap[r].errorCallbackList)e();this.urlMap[r]=null}))}}cloneWithModelId(e,t,i,n){let o=this.clone(e,t);"Viewer3D"===this._viewer.getViewerType()&&this._manager.bindModel(o,i||this._viewer.getDefaultModel().modelId,n)}getAssociatedInfo(e){return this._manager.getBindedInfo(e)}clone(e,t){if(!this._objects[e])return void console.warn(`[ExternalObjectManager.clone] 没有id为 "${e}" 的ExternalObject,先执行ExternalObjectManager.addObject()`);if(this.getObjectIdByName(t))return;const i=Glodon$1.Web.Lang.Utility.UUID.createUUID();return this._manager.cloneNode(e,i),this._objects[i]=t,1==this._scaledIdMap[e]?(this.scale(i,this._sceneScale),this._scaledIdMap[i]=!0):this._scaledIdMap[i]=!1,i}getObjectIdByName(e){for(var t in this._objects)if(this._objects[t]===e)return t}overrideColor(i,n){t.send(e,"overrideColor");const o=this._viewer.getViewer().getFilter(),s={color:parseInt(n.getHEX(),16),opacity:n.getAlpha()};i.all?o.addToOverrideListByConditions([],s,this.modelId):(i.ids&&o.addToOverrideListByColor(i.ids,s,this.modelId),i.objectData&&o.addToOverrideListByConditions(i.objectData,s,this.modelId))}restoreColor(i){t.send(e,"restoreColor"),i.all?this._viewer.getViewer().getFilter().addToOverrideListByConditions([],null,this.modelId):(i.ids&&this._viewer.getViewer().getFilter().addToOverrideListByColor(i.ids,null,this.modelId),i.objectData&&this._viewer.getViewer().getFilter().addToOverrideListByConditions(i.objectData,null,this.modelId))}getAllObjectIds(){return Object.keys(this._objects)}removeById(e){if(this._objects[e]){this.clearRelationshipById(e),this.removeGlowEffectById([e]),this._manager.removeNodeById(e),delete this._objects[e];const t=this._getCloneOriginUrlById(e);void 0!==t&&delete this.urlMap[t],this._viewer.getViewer().render()}}removeByIds(e){this.removeGlowEffectById(e);for(var t=0;t<e.length;t++){const i=e[t];if(this.clearRelationshipById(i),!this._objects[i])continue;this._manager.removeNodeById(i),delete this._objects[i];const n=this._getCloneOriginUrlById(i);void 0!==n&&delete this.urlMap[n]}this._viewer.getViewer().render()}clear(){var e=Object.keys(this._objects);e.length>0&&this.removeGlowEffectById(e),this._manager.clearNodes(),this._objects={},this._manager._objects={},this.urlMap={},this.relationshipsMap=null,this._viewer.getViewer().render()}hide(e){if(!CLOUD.Utils.isDefined(e))return;const t=this._manager.getFilter();if(!CLOUD.Utils.isDefined(t))return;if(CLOUD.Utils.isDefined(e.all)&&1==e.all)return void t.hideAll();let i=[];CLOUD.Utils.isDefined(e.objectData)&&(Array.isArray(e.objectData)||(e.objectData=[e.objectData]),i=i.concat(t.getMatchIds(e.objectData))),CLOUD.Utils.isDefined(e.ids)&&(i=i.concat(e.ids)),i=Array.from(new Set(i)),0!==i.length&&t.hideByIds(i)}show(e){if(!CLOUD.Utils.isDefined(e))return;const t=this._manager.getFilter();if(!CLOUD.Utils.isDefined(t))return;if(CLOUD.Utils.isDefined(e.all)&&1==e.all)return void t.showAll();let i=[];CLOUD.Utils.isDefined(e.objectData)&&(Array.isArray(e.objectData)||(e.objectData=[e.objectData]),i=i.concat(t.getMatchIds(e.objectData))),CLOUD.Utils.isDefined(e.ids)&&(i=i.concat(e.ids)),i=Array.from(new Set(i)),0!==i.length&&t.showByIds(i)}select(e){let t=this._viewer.getViewer();if(!CLOUD.Utils.isDefined(e))return;const i=this._manager.getFilter();if(!CLOUD.Utils.isDefined(i))return;if(CLOUD.Utils.isDefined(e.all)&&1==e.all)return t.addToSelection(this.getAllObjectIds(),this.modelId),void t.render();let n=[];CLOUD.Utils.isDefined(e.objectData)&&(Array.isArray(e.objectData)||(e.objectData=[e.objectData]),n=n.concat(i.getMatchIds(e.objectData))),CLOUD.Utils.isDefined(e.ids)&&(n=n.concat(e.ids)),n=Array.from(new Set(n)),0!==n.length&&(t.addToSelection(n,this.modelId),t.render())}removeSelection(e){let t=this._viewer.getViewer();if(!CLOUD.Utils.isDefined(e))return;const i=this._manager.getFilter();if(!CLOUD.Utils.isDefined(i))return;if(CLOUD.Utils.isDefined(e.all)&&1==e.all)return t.clearSelection(),void t.render();let n=[];CLOUD.Utils.isDefined(e.objectData)&&(Array.isArray(e.objectData)||(e.objectData=[e.objectData]),n=n.concat(i.getMatchIds(e.objectData))),CLOUD.Utils.isDefined(e.ids)&&(n=n.concat(e.ids)),n=Array.from(new Set(n)),0!==n.length&&(t.removeFromSelection(n,this.modelId),t.render())}convert(e,t){!1!==t&&(t=!0);const i=DataUtil.assertType(e,"obj")&&e.modelId?`${e.modelId}_${e.objectId}`:e;let n=this._viewer.getExternalObjectConverter().convertToExternalObject(i,e,t);return n._externalNeedScale=!1,n}_fireTransformedEvent(e){this.getEventManager().fireEvent(Glodon$1.Bimface.Viewer.Viewer3DEvent.ExternalObjectTransformed,e,this.getPosition(e)),this._viewer.getViewer().updateGlowEffect(this.modelId,e),this._viewer.updateSceneBoundingBox(!1)}translate(e,t){let i=new THREE.Vector3(t.x,t.y,t.z);i.multiply(new THREE.Vector3(this._sceneScale.x,this._sceneScale.y,this._sceneScale.z));let n=this.getAllChildrenId(e);n&&n.length>0&&n.forEach((e=>this._manager.setAccumulateTransform(e,i))),this._manager.setAccumulateTransform(e,i),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}_getMatrixWorld(e){return(new THREE.Matrix4).fromArray(this.getTransformation(e))}rotateOnBasePoint(e,t,i,n){t=this._viewer.globalUnitUtil.translateVector(t),i=new THREE.Vector3(i.x,i.y,i.z);const o=this.relationshipsMap&&this.relationshipsMap.get(e);let s,r,a;o&&o.father&&(s=this._getMatrixWorld(o.father),r=s.clone().invert());const l=this._getMatrixWorld(e);if(a=l.clone().invert(),s){this._manager.applyTransformMatrix(e,l.clone().multiply(r),!0);const n=this._getMatrixWorld(e).clone().invert();t.applyMatrix4(n),i=new THREE.Vector4(i.x,i.y,i.z,0).applyMatrix4(n),i=new THREE.Vector3(i.x,i.y,i.z).normalize()}if(this._manager.rotateOnBasePoint(e,t,i,n),s){const t=this._getMatrixWorld(e);this._manager.applyTransformMatrix(e,t.clone().multiply(s),!0)}((e,t,i)=>{let n=this.getAllChildrenId(e);n&&n.length>0&&n.forEach((e=>{const n=this._getMatrixWorld(e),o=i.clone().multiply(t.clone().multiply(n));this._manager.applyTransformMatrix(e,o,!0)}))})(e,a,this._getMatrixWorld(e)),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}scaleOnBasePoint(e,t,i){t=this._viewer.globalUnitUtil.translateVector(t),this._manager.scaleOnBasePoint(e,t,i),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}getBoundingBoxById(e){return this._viewer.globalUnitUtil.revertBBox(this._manager.getBoundingBoxById(e))}_getValid3dParam(e){if("[object Object]"===Object.prototype.toString.call(e)&&e.hasOwnProperty("x")&&e.hasOwnProperty("y")&&e.hasOwnProperty("z"))return new THREE.Vector3(e.x,e.y,e.z)}setPosition(e,t){var i=this._getValid3dParam(t);i&&(i.applyMatrix4((new THREE.Matrix4).makeScale(this._sceneScale.x,this._sceneScale.y,this._sceneScale.z)),this._manager.setTransform(e,i,void 0,void 0,void 0,!0),this._viewer.getViewer().render(),this._fireTransformedEvent(e))}getPosition(e){var t=this._manager.getGroupTransform(e);if(t&&t.position){var i=t.position;return this._viewer.globalUnitUtil.revertTranslate({x:i.x,y:i.y,z:i.z},["x","y","z"])}}offset(e,t){var i=this._getValid3dParam(this._viewer.globalUnitUtil.translate(t,["x","y","z"]));if(!i)return;let n=this.getAllChildrenId(e);n&&n.length>0&&n.forEach((e=>this._manager.setAccumulateOffset(e,i))),this._manager.setAccumulateOffset(e,i),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}offsetX(e,t){this.offset(e,{x:t,y:0,z:0})}offsetY(e,t){this.offset(e,{x:0,y:t,z:0})}offsetZ(e,t){this.offset(e,{x:0,y:0,z:t})}rotate(e,t){var i=this._getValid3dParam(t);if(!i)return;let n=this.getAllChildrenId(e);n&&n.length>0&&n.forEach((e=>this._manager.setAccumulateTransform(e,void 0,void 0,i))),this._manager.setAccumulateTransform(e,void 0,void 0,i),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}rotateX(e,t){this.rotate(e,{x:t,y:0,z:0})}rotateY(e,t){this.rotate(e,{x:0,y:t,z:0})}rotateZ(e,t){this.rotate(e,{x:0,y:0,z:t})}setRotationX(e,t,i){let n=new THREE.Vector3(1,0,0);this.rotateOnBasePoint(e,t,n,i)}setRotationY(e,t,i){let n=new THREE.Vector3(0,1,0);this.rotateOnBasePoint(e,t,n,i)}setRotationZ(e,t,i){let n=new THREE.Vector3(0,0,1);this.rotateOnBasePoint(e,t,n,i)}scale(e,t){var i=this._getValid3dParam(t);i&&0!==i.x&&0!==i.y&&0!==i.z&&(this._manager.setAccumulateTransform(e,void 0,i),this._viewer.getViewer().render(),this._fireTransformedEvent(e))}scaleX(e,t){this.scale(e,{x:t,y:1,z:1})}scaleY(e,t){this.scale(e,{x:1,y:t,z:1})}scaleZ(e,t){this.scale(e,{x:1,y:1,z:t})}getTransformation(e){if(!this._manager._hasObjectId(e))return;const[t]=this._manager.meshes[e];if(t){const i=t.matrix.clone();return 1==this._scaledIdMap[e]&&i.multiply((new THREE.Matrix4).makeScale(1/this._sceneScale.x,1/this._sceneScale.y,1/this._sceneScale.z)),i.elements[12]*=1/this._sceneScale.x,i.elements[13]*=1/this._sceneScale.y,i.elements[14]*=1/this._sceneScale.z,DataUtil.limitTransformationDecimal(i.elements)}}setTransformation(e,t){if(!this._manager._hasObjectId(e))return;if(["[object Float32Array]","[object Array]"].indexOf(Object.prototype.toString.call(t))<0)return;const i=new THREE.Matrix4;i.fromArray(t),1==this._scaledIdMap[e]&&i.multiply((new THREE.Matrix4).makeScale(this._sceneScale.x,this._sceneScale.y,this._sceneScale.z)),i.elements[12]*=this._sceneScale.x,i.elements[13]*=this._sceneScale.y,i.elements[14]*=this._sceneScale.z,this._manager.applyTransformMatrix(e,i,!0),this._viewer.getViewer().render(),this._fireTransformedEvent(e)}setGlowEffectById(i,n){t.send(e,"setGlowEffectById");var o=new THREE.Color("#11DAB7"),s="body",r=.3,a=3,l=!1;null!=n&&(null!=n.type&&(s=n.type),null!=n.color&&n.color instanceof Glodon$1.Web.Graphics.Color&&(o=new THREE.Color(n.color.red/255,n.color.green/255,n.color.blue/255)),null!=n.intensity&&(r=n.intensity),null!=n.spread&&(a=n.spread),null!=n.isGis&&(l=n.isGis)),this._viewer.getViewer().setGlowEffectById(this.modelId,i,{color:o,type:s,intensity:r,spread:a,isGis:l}),this._viewer.render()}removeGlowEffectById(i){if(t.send(e,"removeGlowEffectById"),null==i||0==i.length)return void console.warn("没有发光效果被删除。");this._viewer.getViewer().removeGlowEffectById(this.modelId,i),this._viewer.render()}clearGlowEffect(){t.send(e,"clearGlowEffect"),this._viewer.getViewer().removeGlowEffectById(this.modelId),this._viewer.render()}getAnimations(e){return this._manager.getAnimations(e)}play(e,t){if(!this.isAnimatable(e))return void console.warn("there is no animation in the mesh");if(!DataUtil.assertType(t,"obj")){t={index:t||0}}const i=!1===t.loop?THREE.LoopOnce:THREE.LoopRepeat;this._manager.play(e,{...t,loop:i})}pause(e){this._manager.pause(e)}stop(e){this._manager.stop(e)}isAnimatable(e){return this._manager.isAnimation(e)}getObjectByName(e){const t=this.getAllObjects(),i=this.getObjectIdByName(e);return t.find((e=>e.name===i))}removeByName(e){let t=this.getObjectIdByName(e);this.removeById(t)}getAllObjects(){return this._manager.getAllMeshes()}setObjectData(e,t){if(Array.isArray(t)){let i={};t.forEach((e=>{i=Object.assign({},i,e)})),this._manager.setObjectData(e,i)}else this._manager.setObjectData(e,t)}getObjectData(e){return this._manager.getObjectData(e)}_getCloneOriginUrlById(e){for(const t in this.urlMap)if(this.urlMap[t].originId===e)return t}toLocalPosition(e,t){if(3===arguments.length){console.warn("[BIMFACE WARN]: ExternalObjectManager.toLocalPosition(id, worldPosition, worldVector) is obsolete, please use ExternalObjectManager.toLocalPosition(id, option) instead.");const t=arguments[1]&&this._viewer.globalUnitUtil.translate(arguments[1],["x","y","z"]),i=arguments[2]&&this._viewer.globalUnitUtil.translate(arguments[2],["x","y","z"]);if(!this._manager._hasObjectId(e))return;const n=this._manager.getTransform(e),o=(new THREE.Matrix4).compose(n.position,n.rotate,n.scale).clone().invert();let s,r;if(t){s=new THREE.Vector3(t.x,t.y,t.z).applyMatrix4(o).toArray()}if(i){r=new THREE.Vector3(i.x,i.y,i.z).applyMatrix4(o),r=r.normalize().toArray()}return{localPosition:s,localVector:r}}let{worldPosition:i,worldVector:n}=t;if(i&&(i=this._viewer.globalUnitUtil.translate(i,["x","y","z"])),n&&(n=this._viewer.globalUnitUtil.translate(n,["x","y","z"])),!this._manager._hasObjectId(e))return;const o=this._manager.getTransform(e),s=(new THREE.Matrix4).compose(o.position,o.rotate,o.scale).clone().invert();let r,a;if(i){r=new THREE.Vector3(i.x,i.y,i.z).applyMatrix4(s),r={x:r.x,y:r.y,z:r.z}}if(n){a=new THREE.Vector4(n.x,n.y,n.z,0).applyMatrix4(s),a.normalize(),a={x:a.x,y:a.y,z:a.z}}return{localPosition:r,localVector:a}}toWorldPosition(e,t){if(3===arguments.length){console.warn("[BIMFACE WARN]: ExternalObjectManager.toWorldPosition(id, localPosition, localVector) is obsolete, please use ExternalObjectManager.toWorldPosition(id, option) instead.");const t=arguments[1],i=arguments[2];if(!this._manager._hasObjectId(e))return;const n=this._manager.getTransform(e),o=(new THREE.Matrix4).compose(n.position,n.rotate,n.scale);let s,r;if(t){const e=new THREE.Vector3(t.x,t.y,t.z);s=this._viewer.globalUnitUtil.revertTranslate(e.applyMatrix4(o).toArray())}if(i){r=new THREE.Vector3(i.x,i.y,i.z).applyMatrix4(o),r=r.normalize().toArray()}return{worldPosition:s,worldVector:r}}const{localPosition:i,localVector:n}=t;if(!this._manager._hasObjectId(e))return;const o=this._manager.getTransform(e),s=(new THREE.Matrix4).compose(o.position,o.rotate,o.scale);let r,a;if(i){r=new THREE.Vector3(i.x,i.y,i.z).applyMatrix4(s),r=this._viewer.globalUnitUtil.revertTranslate({x:r.x,y:r.y,z:r.z},["x","y","z"])}if(n){a=new THREE.Vector4(n.x,n.y,n.z,0).applyMatrix4(s),a.normalize(),a={x:a.x,y:a.y,z:a.z}}return{worldPosition:r,worldVector:a}}setHierarchy(e){return this.temporaryMap=new Map,this.isCorrectRelationships=!0,this.getTemporaryMap(null,e.id,e.children),this.isCorrectRelationships?this.relationshipsMap?this.checkLegal()?(this.combineMap(),!0):(this.console.warn("The hierarchical structure was wrong due to the duplication of objects in different hierarchies."),!1):(this.relationshipsMap=this.temporaryMap,!0):(this.console.warn("The hierarchical structure was wrong due to the duplication of objects in different hierarchies."),!1)}getTemporaryMap(e,t,i){if(!this.isCorrectRelationships)return;let n=[];for(let e=0;e<i.length;e++)if(n.push(i[e].id),i[e].children&&i[e].children.length>0)this.getTemporaryMap(t,i[e].id,i[e].children);else{if(this.temporaryMap.has(i[e].id))return void(this.isCorrectRelationships=!1);this.temporaryMap.set(i[e].id,{father:t,children:[]})}this.temporaryMap.has(t)?this.isCorrectRelationships=!1:this.temporaryMap.set(t,{father:e,children:n})}checkLegal(){let e=!0,t={};return this.relationshipsMap.forEach(((e,i)=>{t[i]=this.getAncestors(i)})),this.temporaryMap.forEach(((i,n)=>{let o=i.children;for(let i=0;i<o.length;i++)if(t[n]&&t[n].indexOf(o[i])>-1)return void(e=!1)})),e}getAncestors(e){let t=[],i=this.relationshipsMap.get(e).father;return i&&(t.push(i),t=[...t,...this.getAncestors(i)]),t}combineMap(){this.relationshipsMap&&this.temporaryMap&&this.temporaryMap.forEach(((e,t)=>{if(this.relationshipsMap.has(t)){let i=e.children;for(let e=0;e<i.length;e++)if(this.relationshipsMap.has(i[e]))if(this.relationshipsMap.get(t).children.indexOf(i[e])>-1);else{if(this.relationshipsMap.get(i[e]).father!==t){if(this.relationshipsMap.get(i[e]).father){let t=this.relationshipsMap.get(this.relationshipsMap.get(i[e]).father).children.indexOf(i[e]);this.relationshipsMap.get(this.relationshipsMap.get(i[e]).father).children.splice(t,1)}this.relationshipsMap.get(i[e]).father=t}this.relationshipsMap.get(t).children.push(i[e])}else this.relationshipsMap.get(t).children.push(i[e])}else{this.relationshipsMap.set(t,e);let i=e.children;for(let e=0;e<i.length;e++)if(this.relationshipsMap.has(i[e])&&this.relationshipsMap.get(i[e]).father!==t){if(this.relationshipsMap.get(i[e]).father){let t=this.relationshipsMap.get(this.relationshipsMap.get(i[e]).father).children.indexOf(i[e]);this.relationshipsMap.get(this.relationshipsMap.get(i[e]).father).children.splice(t,1)}this.relationshipsMap.get(i[e]).father=t}}}))}getAllChildrenId(e){if(!this.relationshipsMap)return[];let t=[];if(this.relationshipsMap.has(e)){let i=this.relationshipsMap.get(e).children;t=[...t,...i];for(let e=0;e<i.length;e++)this.relationshipsMap.get(i[e])&&this.relationshipsMap.get(i[e]).children.length>0&&(t=[...t,...this.getAllChildrenId(i[e])])}return t}clearAllHierarchy(){this.relationshipsMap.clear()}clearHierarchy(e,t){let i=this.relationshipsMap.get(e).children,n=new Set,o=new Set;t.forEach((e=>{-1===i.indexOf(e)?o.add(e):n.add(e)})),o.size>0&&this.console.warn(`The relationships associated with childrenIds "${[...o].join("、")}" were not cleared because the parent-child relationships were not established.`),[...n].forEach((t=>this.clearCurrentIdToAncestorRelationship(e,t)))}clearCurrentIdToAncestorRelationship(e,t){let i=this.relationshipsMap.get(t).father;if(i){let n=this.relationshipsMap.get(i).children.indexOf(t);this.relationshipsMap.get(i).children.splice(n,1),i!=e?this.clearCurrentIdToAncestorRelationship(e,i):0===this.relationshipsMap.get(i).children.length&&null===this.relationshipsMap.get(i).father&&this.relationshipsMap.delete(i)}this.relationshipsMap.get(t).father=null,0===this.relationshipsMap.get(t).children.length&&this.relationshipsMap.delete(t)}clearRelationshipById(e){if(!this.relationshipsMap)return;if(!this.relationshipsMap.has(e))return;let t=this.relationshipsMap.get(e).father;t&&this.clearHierarchy(t,[e]);let i=this.relationshipsMap.get(e).children;i&&i.length>0&&this.clearHierarchy(e,i)}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ExternalObject").ExternalObjectEditorToolbarConfig=function(){return{viewer:null,id:null,app:null,buttonVisibility:{},translationController:{},rotationController:{},scaleController:{},ids:null}};const ExternalObjectEditorToolbarEvent$1=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ExternalObject").ExternalObjectEditorToolbarEvent={Exit:"Exit",EditingModeChanged:"EditingModeChanged"};!function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ExternalObject"));t.ExternalObjectEditorToolbar=class extends ObjectEditorToolbar{constructor(t){e.send("Bimface.Plugins.ExternalObject","ExternalObjectEditorToolbar"),t.objectId=t.id||t.ids,super(t),this.name="ExternalObjectEditorToolbar",this.initialize(),this.toolBarDom(),skipVueObserver(this)}setButtonVisibility(e){super.setButtonVisibility(e)}getButtonVisibility(){return super.getButtonVisibility()}setEditedExternalObjectId(e){super.setEditedObjectId(e)}getEditedExternalObjectId(){return super.getEditedObjectId()}setEditedExternalObjectIds(e){super.setEditedObjectId(e)}getEditedExternalObjectIds(){return super.getEditedObjectId()}show(){super.show()}hide(){super.hide()}exit(){super.exit()}setRotationController(e){super.setRotationController(e)}getRotationController(){return super.getRotationController()}setTranslationController(e){super.setTranslationController(e)}getTranslationController(){return super.getTranslationController()}setScaleController(e){super.setScaleController(e)}getScaleController(){return super.getScaleController()}setEditingMode(e){super.setEditingMode(e)}getEditingMode(){return super.getEditingMode()}initialize(){super.initialize(),this.objectEditorManager=new ObjectEditorManager(this.viewer,"ExternalObject"),this.objectEditorManager.setEditedObjectId(this.objectId)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}}(),function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SpatialRelation"));t.Room=class{constructor(t){e.send("Bimface.Plugins.SpatialRelation","Room"),this.viewer3D=t.viewer,this.databagId=t.viewer._data.databagId,this.toleranceType={STRICT:"STRICT",ORDINARY:"ORDINARY",LENIENT:"LENIENT"},this.tolerence=.25,this.mapRoomBbox={},this.mapRoomBoundary={},this.mapRoomId={},this.mapArea={},this.allComponentIds=null,skipVueObserver(this),!0!==t.hasInitialized&&this.initialize()}initialize(){let e=this;"singleMode"===this.viewer3D._data.modelType&&this.getRooms((function(t){let i=JSON.parse(t);for(const t of i)e.mapRoomId[t.id]=!0,e.mapRoomBbox[t.id]=(new THREE.Box3).setFromPoints([t.bboxMin,t.bboxMax])}))}getRooms(e){const t=this;this.viewer3D.getDefaultModel()._getMetaDataManager().dataManager.getRooms((function(i){if(e)if(i&&i.length&&i[0].annotationPosition){const n=JSON.parse(JSON.stringify(i));i=t.viewer3D.globalUnitUtil.revertTranslate(t.viewer3D.globalUnitUtil.revertTranslate(i,["x","y","z","perimeter","area"]),["area"]);for(let e=0;e<i.length;e++)i[e].annotationPosition=n[e].annotationPosition;e(i)}else e(t.viewer3D.globalUnitUtil.revertTranslate(t.viewer3D.globalUnitUtil.revertTranslate(i,["x","y","z","perimeter","area"]),["area"]))}))}getRoomBoundary(e,t){this.mapRoomId[e]&&this.viewer3D.getDefaultModel()._getMetaDataManager().dataManager.getRoomBoundary(e,(function(e){t&&t(e)}))}getAreaByRoomId(e){let t=this,i=new Array;for(const n of e){let e={id:n,unit:"m2",value:null};if(t.mapArea[n])e.value=t.mapArea[n];else{let i=t._getRoomBoundaryById(n);i?"m"===this.viewer3D.getDefaultUnit()?e.value=Math.abs(THREE.ShapeUtils.area(i)):e.value=Math.abs(THREE.ShapeUtils.area(i))/1e6:console.warn(`Input room id ${n} is invalid.`)}i.push(e)}return i}getBoundaryByRoomId(e){let t=new Array,i=this.viewer3D.getCustomizedRoom();if(e in i){let n=this._getRoomBoundaryById(e);for(let o=0,s=n.length;o<s;o++){let s=new Array;s.push(n[o].x),s.push(n[o].y),s.push(i[e].offset[0]),t.push(s)}}else console.warn(`Input room id ${e} is not exist.`);return this.viewer3D.globalUnitUtil.revertTranslate(t)}getHeightByRoomId(e){let t,i=this.viewer3D.getCustomizedRoom();return e in i?t=i[e].height:console.warn(`Input room id ${e} is not exist.`),this.viewer3D.globalUnitUtil.revertTranslate(t)}setBoundaryByRoomId(e,t){let i,n=this.viewer3D.getCustomizedRoom();if(e in n){let o=n[e];if(this.viewer3D.clearRoomsById(e,!1),"string"==typeof t&&(t=JSON.parse(t)),t instanceof Array)if(2==t.length)i=this.viewer3D.createBoundary(t[0],t[1]);else{if(!(t.length>0))return;i=this.viewer3D.createBoundary(1==t.length&&t[0]||t)}else i=t;if(!i)return void console.warn("The custom room data is not standard");o.offset=this.viewer3D.globalUnitUtil.revertTranslate(o.offset),i.offsetZ-=o.offset[0],this.viewer3D.createRoomByOffset(i,o.offset,e,o.faceColor,o.frameColor,!1),this.viewer3D.render();let s={id:e,unit:"m2",value:null},r=this._getRoomBoundaryById(e);"m"===this.viewer3D.getDefaultUnit()?s.value=Math.abs(THREE.ShapeUtils.area(r)):s.value=Math.abs(THREE.ShapeUtils.area(r))/1e6}else console.warn(`Input room id ${e} is not exist.`)}enableDepthTest(e,t){const i=this.viewer3D.getViewer();CLOUD.ExtrudeBodyManager.getInstance(i).enableDepthTest(e,t)}getModelComponentIds(){if(this.allComponentIds&&"ViewerGIS"!==this.viewer3D.viewerType)return this.allComponentIds;let e=this.viewer3D.getViewer();return this.allComponentIds=e.getAllModelUserIds(),this.allComponentIds}getComponentsByRoomId(e,t,i,n){null==t&&(t=this.toleranceType.ORDINARY),null==i&&(i=this.toleranceType.STRICT);let o=this;this.getRoomBoundary(e,(function(t){let i=JSON.parse(t);i.hasOwnProperty("loops")&&(i=i.loops[0]);let n=[];for(const e of i)n.push({x:e[0].x,y:e[0].y});o.mapRoomBoundary[e]=n}));let s=[],r=this.getModelComponentIds();for(const n in r)for(const o of r[n]){let r=this.viewer3D.getViewer().getComponentInfoByUserId(o,n).boundingBox;this.roomContains(e,r,t,i)&&s.push(o)}n&&n(s)}getRoomsByComponentId(e,t,i,n){null==t&&(t=this.toleranceType.ORDINARY),null==i&&(i=this.toleranceType.STRICT);let o=[],s=this.viewer3D.getCustomizedRoom(),r=Object.keys(s);for(let n=0;n<r.length;n++){let s=r[n],a=this.viewer3D.getViewer().getComponentInfoByUserId(e).boundingBox;a=this.viewer3D.globalUnitUtil.revertBBox(a),this.roomContains(s,a,t,i)&&o.push(s)}n&&n(o)}roomContains(e,t,i,n){if(!this.viewer3D.getCustomizedRoom()[e]&&!this.mapRoomBoundary[e])return void console.warn("Input room id is invalid.");let o=this.isRoomContainBoundingBoxByZ(e,t,n);if(0==o)return o;let s=this.isRoomBoundingBoxContainBoundingBoxByXY(e,t,i);if(0==s)return s;let r=this.isRoomBoundaryContainBoundingBoxByXY(e,t,i);return 0!=r||r}getRoomBoundingBoxById(e){let t=this.getCustomizedRoom(e),i=CLOUD.ExtrudeBodyManager.getInstance(this.viewer3D.getViewer()).getBindedModelId(e);if(t){let e=t.boundingBox,n=t.offset;e.min.z=n[0],e.max.z=n[1];let o=(new THREE.Box3).setFromPoints([new THREE.Vector3(e.min.x,e.min.y,e.min.z),new THREE.Vector3(e.max.x,e.max.y,e.max.z)]).clone().applyMatrix4(this.viewer3D.getViewer().getModelManager().getModel(i).transformMatrix.clone());return this.viewer3D.globalUnitUtil.revertBBox(o)}if(this.mapRoomBbox[e]){let t=this.mapRoomBbox[e].clone().applyMatrix4(this.viewer3D.getViewer().getModelManager().getModel(i).transformMatrix.clone());return this.viewer3D.globalUnitUtil.revertBBox(t)}}getCustomizedRoom(e){let t=this.viewer3D.getCustomizedRoom()[e];if(!t)return null;if(t.boundary&&"user"!=t.boundary.belong){let e=[],i=[],n=t.boundary;for(let t=0;t<n.loops.length;t++){let o=n.loops[t],s=[];for(const e of o)s.push([e[0].x,e[0].y,e[0].z]);0==t?e=s:s.length>2&&i.push(s)}let o=this.viewer3D.createBoundary(e,i);return o.offset=[...t.offset],o}return t.boundary.offset=t.offset,t.boundary}_getRoomBoundaryById(e){return this.viewer3D.getCustomizedRoom()[e]?this.getCustomizedRoom(e).roomBoundary:this.mapRoomBoundary[e]}isRoomContainBoundingBoxByZ(e,t,i){let n=this.getRoomBoundingBoxById(e),o=n.min.z,s=n.max.z,r=t.max.z,a=t.min.z,l=this.tolerence;if(i==this.toleranceType.STRICT)return a>=o-l&&r<=s+l;if(i==this.toleranceType.ORDINARY){let e=(a+r)/2;return this.isBetween(e,o,s)&&(this.isBetween(a,o,s)||this.isBetween(r,o,s))}return i==this.toleranceType.LENIENT?a<=s+l&&r>=o-l:void 0}setTopHeightByRoomId(e,t){let i=this.getCustomizedRoom(e);if(i){let n=this.viewer3D.getCustomizedRoom()[e];this.viewer3D.clearRoomsById([e],!1);let o=[];for(let e=0;e<i.roomBoundary.length-1;e++){let t=i.roomBoundary[e];o.push([t.x,t.y,0])}let s=this.viewer3D.createBoundary(o);t=this.viewer3D.globalUnitUtil.translate(t);let r=[i.offset[0],t];this.viewer3D.createRoomByOffset(s,r,e,n.faceColor,n.frameColor,!0)}else console.log("No room exists whose id is "+e)}setBottomHeightByRoomId(e,t){let i=this.getCustomizedRoom(e);if(i){let n=this.viewer3D.getCustomizedRoom()[e];this.viewer3D.clearRoomsById([e],!1);let o=[];for(let e=0;e<i.roomBoundary.length-1;e++){let t=i.roomBoundary[e];o.push([t.x,t.y,0])}let s=this.viewer3D.createBoundary(o),r=[t=this.viewer3D.globalUnitUtil.translate(t),i.offset[1]];this.viewer3D.createRoomByOffset(s,r,e,n.faceColor,n.frameColor,!0)}else console.log("No room exists whose id is "+e)}isRoomBoundingBoxContainBoundingBoxByXY(e,t,i){let n=this.getRoomBoundingBoxById(e),o=n.min.x,s=n.max.x,r=n.min.y,a=n.max.y,l=t.min.x,h=t.max.x,d=t.min.y,c=t.max.y,u=this.tolerence;return i==this.toleranceType.STRICT?l>=o-u&&h<=s+u&&d>=r-u&&c<=a+u:i==this.toleranceType.ORDINARY||i==this.toleranceType.LENIENT?l<=s+u&&h>=o-u&&d<=a+u&&c>=r-u:void 0}isRoomBoundaryContainBoundingBoxByXY(e,t,i){let n=this.toFivePos(t),o=this._getRoomBoundaryById(e);o=this.viewer3D.globalUnitUtil.revertTranslate(o,["x","y","z"]);let s=[],r=CLOUD.ExtrudeBodyManager.getInstance(this.viewer3D.getViewer()).getBindedModelId(e);for(let e=0;e<o.length;e++){let t=new THREE.Vector3(o[e].x,o[e].y,0).clone().applyMatrix4(this.viewer3D.getViewer().getModelManager().getModel(r).transformMatrix.clone());s.push({x:t.x,y:t.y})}o=s;let a=0;for(let e=0;e<n.length;e++){const t=n[e];this.containsInBoundary(t,o)&&a++}let l=!1;return i==this.toleranceType.STRICT?l=5==a:i==this.toleranceType.ORDINARY?l=a>=3:i==this.toleranceType.LENIENT&&(l=a>=1),l}isBetween(e,t,i){let n=this.tolerence;return e<=i+n&&e>=t-n}toFivePos(e){let t=[];return t.push(new THREE.Vector2(e.min.x,e.min.y)),t.push(new THREE.Vector2(e.max.x,e.min.y)),t.push(new THREE.Vector2(e.max.x,e.max.y)),t.push(new THREE.Vector2(e.min.x,e.max.y)),t.push(new THREE.Vector2((e.min.x+e.max.x)/2,(e.min.y+e.max.y)/2)),t}containsInBoundary(e,t,i){let n=!1;for(let i=0;i<t.length-1;i++)if(this.isOnSegment(e,t[i],t[i+1])){n=!0;break}if(n)return!i;for(var o=e.x,s=e.y,r=!1,a=0,l=t.length-1;a<t.length;l=a++){var h=t[a].x||t[a][0],d=t[a].y||t[a][1],c=t[l].x||t[l][0],u=t[l].y||t[l][1];d>s!=u>s&&o<(c-h)*(s-d)/(u-d)+h&&(r=!r)}return r}isOnSegment(e,t,i){if(e.x>Math.max(t.x,i.x)||e.x<Math.min(t.x,i.x))return!1;if(e.y>Math.max(t.y,i.y)||e.y<Math.min(t.y,i.y))return!1;if(t.x!=i.x){let n=(i.y-t.y)/(i.x-t.x),o=i.y-n*i.x;if(n*e.x+o==e.y)return!0}else if(e.x==t.x)return!0;return!1}isPointInside(e,t,i){!1!==i&&(i=!0);let{roomBoundary:n,roomInnerBoundary:o}=this.getCustomizedRoom(t);n=this.viewer3D.globalUnitUtil.revertTranslate(n,["x","y","z"]),o&&(o=this.viewer3D.globalUnitUtil.revertTranslate(o,["x","y","z"]));let s=[],r=CLOUD.ExtrudeBodyManager.getInstance(this.viewer3D.getViewer()).getBindedModelId(t);for(let e=0;e<n.length;e++){let t=new THREE.Vector3(n[e].x,n[e].y,0).clone().applyMatrix4(this.viewer3D.getViewer().getModelManager().getModel(r).transformMatrix.clone());s.push({x:t.x,y:t.y})}if(n=s,o&&o.length>0){let e=[];for(let t=0;t<o.length;t++){let i=[];for(let e=0;e<o[t].length;e++){let n=new THREE.Vector3(o[t][e].x,o[t][e].y,0).clone().applyMatrix4(this.viewer3D.getViewer().getModelManager().getModel(r).transformMatrix.clone());i.push({x:n.x,y:n.y})}e.push(i)}o=e}if(!this.containsInBoundary(e,n,i))return!1;if(o&&o.find((t=>this.containsInBoundary(e,t,i))))return!1;let a=Number(e.z.toFixed(10)),l=this.getRoomBoundingBoxById(t),h=Number(l.min.z.toFixed(10)),d=Number(l.max.z.toFixed(10));return i?a>h&&a<d:a>=h&&a<=d}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SpatialRelation").RoomConfig=function(){return{viewer:null}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SpatialRelation"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");let i=Object.freeze({Saved:"Saved",Cancelled:"Cancelled"});e.RoomEditorToolbarEvent=i,t.RoomEditorToolbarEvent=i}(),function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SpatialRelation");var n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Application.UI.Button");let o=Glodon$1.Bimface.Plugins.SpatialRelation.RoomEditorToolbarEvent;class s{constructor(t){e.send("Bimface.Plugins.SpatialRelation","RoomEditorToolbar"),this.id="RoomEditorToolbar",this.viewer=t.viewer,this.roomId=t.roomId,this.databagId=t.viewer._data.databagId,this.eventManager=new Glodon$1.Web.Lang.EventManager,skipVueObserver(this),this.initialize(),this.toolBarDom()}initialize(){const e=Glodon$1.Bimface.Plugins.RoomEditing,t=new e.RoomEidtorConfig;t.viewer=this.viewer,t.roomId=this.roomId,t.roomEditorToolBar=this,this.roomEditor=new e.RoomEditor(t),this.roomEditor.onEnter(),this.registerRoomEditorEvents()}toolBarDom(){const e=this;let i=[];const n=t.create("div","bf-roomEditorToolbar");if(e.domElement=n,void 0===this.switchToolbar){var s=Glodon$1.Bimface.UI.Toolbar.ToolbarConfig();s.className="bf-toolbar bf-toolbar-roomEditor",s.element=n,s.buttons=["RoomEditingDrag","RoomEditingAdd","RoomEditingDelete","RoomEditingHeight"],this.viewer.getDomElement().appendChild(n),this.switchToolbar=new Glodon$1.Bimface.Application.UI.Toolbar.Toolbar(s),i.push(this.switchToolbar)}let r=Glodon$1.Bimface.UI.Control.ControlEvent,a=this.switchToolbar.getControls();this.uncheckOthers("Drag",a);let l=["Pick","Add","Delete","Height"];for(let t=0;t<a.length;t++){let i=a[t];i.addEventListener(r.Click,(function(){i.isChecked()?(e.roomEditor.activateEditor(l[t]),e.uncheckOthers(i.getId(),a)):i.toggleCheckedState()}))}const h=new Glodon$1.Bimface.UI.Toolbar.ToolbarConfig;h.element=n,h.className="bf-toolbar bf-toolbar-roomEditor";let d=e.roomToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(h);e.roomToolbar=d,i.push(d);const c=new Glodon$1.Bimface.UI.Button.ButtonConfig;c.className="bf-save",c.title=BimfaceLanguage.bf_general_save;const u=new Glodon$1.Bimface.UI.Button.SingleButton(c);u.setHtml(BimfaceLanguage.bf_general_save),u.addEventListener("Click",(function(){const t=e.roomEditor.save(),i={roomId:e.roomId,boundary:t.outerBoundary,height:t.height};e.eventManager.fireEvent(o.Saved,i),e.update()})),d.addControl(u);const p=new Glodon$1.Bimface.UI.Button.ButtonConfig;p.className="bf-cancel",p.title=BimfaceLanguage.bf_general_cancel;const g=new Glodon$1.Bimface.UI.Button.SingleButton(p);g.setHtml(BimfaceLanguage.bf_general_cancel),g.addEventListener("Click",(function(){e.eventManager.fireEvent(o.Cancelled),e.exit()})),d.addControl(g),this.viewer.getDomElement().appendChild(n),this.roomToolbar.hide(),this.switchToolbar.hide()}registerRoomEditorEvents(){let e=this;this.viewer.addEventListener("DeletionError",(function(){if(!e.deletionErrorTips){const t=new Glodon$1.Bimface.UI.Tips.TipsConfig;t.element=e.viewer.getDomElement(),t.className="bf-tips bf-roomEditor-tips",t.timeOut=3e3,t.html=`<div><i class="icon-warning"></i>${BimfaceLanguage.bf_panel_roomEdit_insufficientNode}</div>`,e.deletionErrorTips=new Glodon$1.Bimface.UI.Tips.Tips(t)}e.deletionErrorTips.show()}));let t=this.viewer.getDomElement();this.viewer.addEventListener("RoomEditorAddEnter",(function(){t.addClass("roomEditor-addtion")})),this.viewer.addEventListener("RoomEditorAddExit",(function(){t.removeClass("roomEditor-addtion")})),this.viewer.addEventListener("RoomEditorDeleteEnter",(function(){t.addClass("roomEditor-deletion")})),this.viewer.addEventListener("RoomEditorDeleteExit",(function(){t.removeClass("roomEditor-deletion")}))}uncheckOthers(e,t){for(const i of t)i.getId()===e?i.setCheckedState(!0):i.setCheckedState(!1)}getEventManager(){return this.eventManager}addEventListener(e,t){this.getEventManager().addEvent(e,t)}removeEventListener(e,t){this.getEventManager().removeEvent(e,t)}show(){this.roomToolbar.show(),this.switchToolbar.show()}hide(){this.roomEditor.setBimfaceUIVisibility(!0),this.roomToolbar.hide(),this.switchToolbar.hide()}update(){if(!0!==this.roomEditor.checkIntersect())this.hide(),this.roomEditor.onExit();else{if(!this.intersectTips){const e=new Glodon$1.Bimface.UI.Tips.TipsConfig;e.element=this.viewer.getDomElement(),e.className="bf-tips bf-roomEditor-tips",e.timeOut=3e3,e.html=`<div><i class="icon-warning"></i>${BimfaceLanguage.bf_panel_roomEdit_selfIntersection}</div>`,this.intersectTips=new Glodon$1.Bimface.UI.Tips.Tips(e)}this.intersectTips.show()}}exit(){this.hide(),this.roomEditor.onExit(!0)}}i.RoomEditorToolbar=s,n.RoomEditorToolbar=s}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SpatialRelation"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms"),i=function(){return{viewer:null,roomId:null,app:null}};e.RoomEditorToolbarConfig=i,t.RoomEditorToolbarConfig=i}();class ThirdPartyLibraryManager{}ThirdPartyLibraryManager.loadThirdPartyByName=function(e,t){const i=Glodon.Web.Lang.Utility.HttpRequest,n=window.BimfaceLoaderConfig.fullStaticHost,o=ThirdPartyLibraryManager.libraryConfig(),s=[],r=o[e]&&o[e].loaderFiles;void 0!==r?(r.map((e=>{s.push(`${n}/lib/${e}`)})),i.getScripts(s,(()=>{t&&t()}))):console.warn("The thirdParty not found")},ThirdPartyLibraryManager.libraryConfig=function(){return{Video:{loaderName:"Video",loaderFiles:["video.min.js"]},clipper:{loaderName:"clipper",loaderFiles:["clipper.js"]},interactions:{loaderName:"interactions",loaderFiles:["interactions.js"]},html2canvas:{loaderName:"html2canvas",loaderFiles:["html2canvas.min.js"]}}},function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Solids");class i{constructor(e){this.console=new Glodon$1.Web.Common.Console,this.validConfig(e)?(this.id="SolidToolbar",e.roomId=e.sectionId,e.floor=e.floorId,this._config=e,this._viewer=e.viewer,this._modelId=e.modelId,this._floorId=e.floorId,this._height=e.height,this._unit=e.unit,this._roomId=e.sectionId,this._controlId=e.controlId,this.eventManager=new Glodon$1.Web.Lang.EventManager,this._defaultContextMenuDisplay=e.viewer._opt.enableToggleContextMenuDisplay,this.eventManager.addEvent(t.SolidToolbarEvent.Saved,(()=>requestAnimationFrame((()=>this._viewer.toggleContextMenuDisplay(this._defaultContextMenuDisplay))))),skipVueObserver(this)):this.console.warn("初始化参数错误")}validConfig(e){return!!e.viewer&&(!!e.floorId&&(!!e.name&&(!!e.sectionId&&!!e.conditions)))}setCamera(){this._viewer.getViewer().setHomeView(0),this._viewer.getViewer().setHomeView(1),this._viewer.setCameraType("OrthographicCamera"),this._viewer.getModels().map((e=>e.isolateComponentsById([void 0],"MakeOthersTranslucent"))),this._viewer.enableSnap(!0)}initialize(){if(this._initialized)return;const i=this;this.setCamera();const n=document.createElement("div","bf-solidToolbar");i.domElement=n;const o=Glodon$1.Bimface.UI.Toolbar.ToolbarConfig();o.id="SolidToolbar",o.className="bf-toolbar bf-solidToolbar",o.element=n;this._viewer.getDomElement().appendChild(n),this.drawToolbar=new Glodon$1.Bimface.UI.Toolbar.Toolbar(o),[].push(this.drawToolbar),this._viewer.getModel(this._modelId).getAreas((n=>{const o=n.find((e=>e.id==i._floorId));o&&(null==i._config.height&&(o.height?i._config.height=o.height:i._config.height="Millimeter"==i._viewer.getGlobalUnit()?3e3:3),i._config.elevation="Millimeter"==i._viewer.getGlobalUnit()?o.elevation/1e3:o.elevation),i.loadScripts().then((()=>{i.solidDrawTool=new Glodon$1.Bimface.Interactions.Separation(i._config),i.solidDrawTool.addEventListener("DrawFinished",(()=>{i.destroyToolbar(),i._viewer.unlockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.getSolid().solidToolbar=i,i.getSolid().updateSolidInfo(),i.getEventManager().fireEvent(t.SolidToolbarEvent.Saved,i.getSolid()._solidInfo)})),i.solidDrawTool.addEventListener("EditCompleted",(()=>{i._viewer.unlockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.getSolid().updateSolidInfo(),i.getEventManager().fireEvent(t.SolidToolbarEvent.Saved,i.getSolid()._solidInfo)})),i._initialized=!0,i.getEventManager().fireEvent(t.SolidToolbarEvent.Initialized),i._viewer.toggleContextMenuDisplay(!1)}));const s=Glodon$1.Bimface.UI.Button.ButtonConfig();s.className="bf-draw-rectangle gld-bimface gld-bf-nrectangle",s.title="绘制矩形";const r=new Glodon$1.Bimface.UI.Button.ToggleButton(s);r.addEventListener("Click",(function(){r.isChecked()&&(i.solidDrawTool.type=0,l.setCheckedState(!1),i._viewer.lockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.solidDrawTool.drawPolyLineTool&&i.solidDrawTool.drawPolyLineTool.exit(),i.solidDrawTool.drawRectangle())})),i.drawToolbar.addControl(r);const a=Glodon$1.Bimface.UI.Button.ButtonConfig();a.className="bf-draw-polyline gld-bimface gld-bf-polygon",a.title="绘制多段线";const l=new Glodon$1.Bimface.UI.Button.ToggleButton(a);l.addEventListener("Click",(function(){l.isChecked()&&(i.solidDrawTool.type=0,r.setCheckedState(!1),i._viewer.lockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.solidDrawTool.drawRectangleTool&&(i.solidDrawTool.drawRectangleTool.exit(),delete i.solidDrawTool.drawRectangleTool),i.solidDrawTool.drawPolyLine())})),i.drawToolbar.addControl(l);const h=new Glodon$1.Bimface.Application.UI.Button.DividerLine;i.drawToolbar.addControl(h);const d=e.create("label","bf-grid-container"),c=document.createElement("input");c.type="checkbox",c.className="bf-checkbox-input",c.checked="checked",d.appendChild(c);const u=document.createElement("span");u.className="grid-text",u.innerText="轴网",d.appendChild(u),d.addEventListener("change",(function(){c.checked?i._viewer.getModel(i._modelId).showAxisGridsByFloor(i._config.fileId,i._floorId):i._viewer.getModel(i._modelId).removeAllAxisGrids()})),i.drawToolbar.element.appendChild(d)}))}loadScripts(){if(i._scriptsLoaded)return Promise.resolve();const e=new Promise((e=>{ThirdPartyLibraryManager.loadThirdPartyByName("interactions",e)})),t=new Promise((e=>{ThirdPartyLibraryManager.loadThirdPartyByName("clipper",e)}));return new Promise((n=>{Promise.all([e,t]).then((()=>{i._scriptsLoaded=!0,n()}))}))}cancelDraw(){this.solidDrawTool.drawPolyLineTool&&this.solidDrawTool.drawPolyLineTool.exit(),this.solidDrawTool.drawRectangleTool&&this.solidDrawTool.drawRectangleTool.exit(),this._viewer.unlockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),this._viewer.enableSnap(!1)}getToolbar(){return this}getSolidSeparation(){return this.solidDrawTool}edit(){if(this.setCamera(),!this.drawToolbar){const e=this._viewer.getModel(this._modelId).getRoomManager().getRoomById(this._roomId);if(!this.solidDrawTool){const i=this;return void this.loadScripts().then((()=>{i.solidDrawTool=new Glodon$1.Bimface.Interactions.Separation(i._config),i.solidDrawTool.room=e,e.solidToolbar=i,i._viewer.lockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.solidDrawTool.edit(),i._initialized=!0,i.getEventManager().fireEvent(t.SolidToolbarEvent.Initialized),i._viewer.toggleContextMenuDisplay(!1),i.solidDrawTool.addEventListener("EditCompleted",(()=>{i._viewer.unlockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),i.getSolid().updateSolidInfo(),i.getEventManager().fireEvent(t.SolidToolbarEvent.Saved,i.getSolid()._solidInfo)}))}))}this.solidDrawTool.room=e,e.solidToolbar=this}this._viewer.lockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),this.solidDrawTool.edit()}cancelEdit(){const e=this._viewer.getModel(this._modelId).getRoomManager();e&&e.showRoomsById([this._roomId]),this._viewer.unlockAxis(Glodon$1.Bimface.Viewer.AxisOption.Z),this.solidDrawTool.editPolygon&&this.solidDrawTool.editPolygon.exit(),this._viewer.enableSnap(!1)}hide(){this.drawToolbar.hide()}show(){this.drawToolbar.show()}destroyToolbar(){this.drawToolbar.destroy()}hideContent(){this.drawToolbar.hide(),this.solidDrawTool.hide()}showContent(){this.drawToolbar.show(),this.solidDrawTool.show()}exitSection(){this._viewer._sectionPlane&&this._viewer._sectionPlane.exit(),this.cancelDraw(),this.cancelEdit(),this._viewer.toggleContextMenuDisplay(this._defaultContextMenuDisplay)}getSolid(){return this.solidDrawTool.getRoom()}uncheckOthers(e,t){for(const i of t)i.getId()===e?i.setCheckedState(!0):i.setCheckedState(!1)}getEventManager(){return this.eventManager}addEventListener(e,t){this.getEventManager().addEvent(e,t)}removeEventListener(e,t){this.getEventManager().removeEvent(e,t)}destroy(){this.exitSection(),this.drawToolbar=null,this.console=null,this._config=null,this._viewer=null,this.eventManager=null,this.domElement&&this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement)}}t.SolidToolbar=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Solids").SolidToolbarConfig=function(){return{controlId:null,viewer:null,modelId:null,floor:null,height:null,name:null,sectionId:null,fileId:null,unit:null,roomColor:null,frameColor:null,enableAxisGrids:!0,overlapType:"plus"}},function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Solids"),t=Object.freeze({Saved:"Saved",Deleted:"Deleted",Initialized:"Initialized"});e.SolidToolbarEvent=t}(),function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=(Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RevitHelpers"));t.MEPTopologyHelper=class{constructor(t){e.send("Bimface.Plugins.RevitHelpers","MEPTopologyHelper"),this.databagId=t.viewer._data.databagId,this.modelType=t.viewer._data.modelType,this.viewer=t.viewer,skipVueObserver(this)}_findNetworkById(e,t){var i,n,o=this;o._FILEID_CACHE!=o.fileId&&(o._API_CACHE=null),"integrateModel"==o.modelType?(i=`${hostConfig.resourceHost}/${o.databagId}/metadata/${o.fileId}/mepsystem.json`,n=`metadata/${o.fileId}/mepsystem.json`,o._FILEID_CACHE=o.fileId):(i=`${hostConfig.resourceHost}/${o.databagId}/metadata/mepsystem.json`,n="metadata/mepsystem.json"),o._API_CACHE?o._getNetwork(e,o._API_CACHE,(function(e){t(e)})):Glodon$1.Web.Lang.Utility.HttpRequest.ajax({url:"Local"!=o.viewer._data.dataEnvType?Glodon$1.Web.Lang.Utility.HttpRequest.getUrl({url:i,path:n,APIHost:o.viewer._opt.APIHost,loadMode:o.viewer._data.loadMode,fileId:o.viewer._data.modelId,viewToken:o.viewer._data.viewToken,modelType:o.viewer._data.modelType}):i,success:function(i){var n=JSON.parse(i);o._API_CACHE=n,o._getNetwork(e,n,(function(e){t(e)}))}})}_getNetwork(e,t,i){var n=this;n._NETWORK_LENGTH=0,t.systems.map((function(o,s){o.network[e]&&(n._NETWORK_LENGTH++,i(o.network)),s==t.systems.length-1&&0==n._NETWORK_LENGTH&&console.log("此ID不存在于Network中")}))}_transform(e){let t=[];for(let i in e)/^__STEP/.test(i)||(t[t.length]={type:i,id:e[i]});return t}_walk(e,t,i,n){let o="up"===i?"flowFrom":"flowInto",s=[t];for(;s.length;){let t=s.pop(),i=e[t];if(!i)continue;i.id=t,n(i,e);let r=i[o];r&&[].push.apply(s,[...r].reverse())}}_BFSwalk(e,t,i,n){let o="up"===i?"flowFrom":"flowInto",s=[t];for(;0!==s.length;){let t=s.shift(),i=e[t];i&&(i.id=t,n(i,i[o],e),[].push.apply(s,i[o]))}}_deduplicate(e){return e.map((function(e){return e.reduce((function(e,t,i){return i%2==0?-1===e.indexOf(t)&&e.push(t):/\d+/.test(e[e.length-1])||e.push(t),e}),[])}))}_formatToObj(e){var t,i=this,n={};return e.forEach((function(e){e.forEach((function(e,o){if(o%2==0)t=e,n[e]||(n[e]=[]);else{let o;o="integrateModel"==i.modelType?`${i.fileId}.${e}`:e,-1===n[t].indexOf(o)&&n[t].push(o)}}))})),n}_formatNewData(e,t){let i;for(let t in e){if(-1!=Object.keys(e[t]).indexOf("flowFrom")){i=e;break}{let n=[],o=[];e[t].neighbours.map((e=>{"bidirectional"!==e.direction&&("in"===e.direction?n.push(e.id):o.push(e.id))})),Object.assign(e[t],{flowFrom:n},{flowInto:o}),i=e}}return i}getDownstreamComponentsById(e,t){const i=this;"integrateModel"==i.modelType&&(i.fileId=e.split(".")[0],e=e.split(".")[1]),i._findNetworkById(e,(n=>{if(!n)return t();let o=i._formatNewData(n),s={};i._BFSwalk(o,e,"down",(function(t){t.id!==e&&("integrateModel"==i.modelType&&(t.id=`${i.fileId}.${t.id}`),s[t.type]?s[t.type].push(t.id):s[t.type]=[t.id])})),t(i._transform(s))}))}getConnectedComponentsById(e,t){var i=this;"integrateModel"==i.modelType&&(i.fileId=e.split(".")[0],e=e.split(".")[1]),i._findNetworkById(e,(n=>{if(!n)return t();let o=i._formatNewData(n),s={up:{routes:[[]]},down:{routes:[[]]}};["up","down"].forEach((t=>this._walk(o,e,t,(function(i,n){let o=s[t].routes,r=o.length-1;if("末端"===o[r].slice(-2,-1)[0]){if("末端"===i.type)return o[o.length]=o[r].slice(0,-1).concat(i.id);{let e=i["up"===t?"flowInto":"flowFrom"][0];o[o.length]=o[r].slice(0,o[r].indexOf(e)+1),r++}}e!=i.id&&(o[r].push(i.type),o[r].push(i.id))}))));let r=i._deduplicate(s.up.routes),a=i._deduplicate(s.down.routes),l=this._transform(i._formatToObj(r)),h=this._transform(i._formatToObj(a));t({up:l,down:h})}))}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RevitHelpers").MEPTopologyHelperConfig=function(){return{viewer:null}},function(){let e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.RevitHelpers");class i{constructor(t,i){e.send("Bimface.Plugins.RevitHelpers","DrawingView"),this.viewer3D=t,this.drawingViews=i,this.activeViewId=null,this.activeDrawingView=null,this.viewPoint=null,this.planTranslation=null,this.linkFileTranslation=new THREE.Vector3}activeViewById(e){this.activeViewId=e;for(const e of this.drawingViews)if(e.id==this.activeViewId){this.activeDrawingView=e;let t=e.viewPoint.origin;this.coordViewPoint=new THREE.Vector3(t[0],t[1],t[2])}}formatViewMatrix(e){let t=this.activeDrawingView.viewPoint.rightDirection,i=this.activeDrawingView.viewPoint.upDirection,n=new THREE.Vector3(t[0],t[1],t[2]),o=new THREE.Vector3(i[0],i[1],i[2]);e=null==e?new THREE.Vector3:e;let s=new THREE.Matrix4;return s.makeBasis(n,o,e),s}update(e,t){this.makeTranslation(e,t),"FloorPlan"==this.activeDrawingView.viewType?this.rotateFloorPlan(e):this.rotateElevation(e)}makeTranslation(e,t){let i=this.activeDrawingView.viewPoint.viewDirection,n=new THREE.Vector3(i[0],i[1],i[2]).multiplyScalar(t),o=this.planTranslation,s=this.linkFileTranslation;e.translateX(o.x+s.x+n.x),e.translateY(o.y+s.y+n.y),e.translateZ(o.z+s.z+n.z)}rotateFloorPlan(e){let t=this.activeDrawingView.viewPoint.upDirection,i=new THREE.Vector3(t[0],t[1],t[2]),n=new THREE.Vector3(0,1,0).angleTo(i);new THREE.Vector3(0,1,0).cross(i).length()>0&&(n=-n),e.rotateZ(n),e.updateMatrixWorld()}rotateElevation(e){let t=this.activeDrawingView.viewPoint.viewDirection,i=new THREE.Vector3(t[0],t[1],t[2]),n=i.angleTo(new THREE.Vector3(0,-1,0));i.cross(new THREE.Vector3(0,-1,0)).z>0&&(n=-n),e.rotateX(Math.PI/2),e.rotateY(n),e.updateMatrixWorld()}getOutline3D(){let e=this.activeDrawingView.outline,t=this.activeDrawingView.viewPoint.scale,i=this.activeDrawingView.elevation,n=new THREE.Vector3(e[0]*t,e[1]*t,0),o=new THREE.Vector3(e[0]*t,e[3]*t,0),s=new THREE.Vector3(e[2]*t,e[3]*t,0),r=new THREE.Vector3(e[2]*t,e[1]*t,0),a=this.formatViewMatrix(),l=n.applyMatrix4(a),h=o.applyMatrix4(a),d=s.applyMatrix4(a),c=r.applyMatrix4(a);this.planTranslation=l.clone().add(d).multiplyScalar(.5),this.planTranslation.add(this.coordViewPoint);let u=h.clone().sub(l).length(),p=c.clone().sub(l).length(),g=new THREE.Vector3(-p/2,-u/2,i),m=new THREE.Vector3(p/2,u/2,i);return new THREE.Box3(g,m)}setLinkFileTranslation(e){this.linkFileTranslation.x=e.elements[12],this.linkFileTranslation.y=e.elements[13],this.linkFileTranslation.z=e.elements[14]}}i.toObject=function(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];n instanceof Array&&(t[i]={x:n[0],y:n[1],z:n[2]})}return t},t.DrawingView=i}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Snap").SnapConfig=function(){return{id:null,color:new Glodon$1.Web.Graphics.Color(249,157,11,1),hoverColor:new Glodon$1.Web.Graphics.Color(17,218,183,.2),objectColor:new Glodon$1.Web.Graphics.Color(17,218,183,.9),width:3,radius:25,viewer:null}},function(){let e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Snap"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=function(e){this.viewer=e.viewer,this.maxPointsNum=1;var i=new Glodon$1.Web.Graphics.Color(17,218,183,.2);let n=new Glodon$1.Web.Graphics.Color(17,218,183,1);var o=t.createNS("circle","bf-snap-handle");o.setAttribute("r",6),o.setAttribute("fill",i.getRGB()),o.style.fill=i.getRGB();const s=t.createNS("rect","bf-snap-handle");s.setAttribute("width",14),s.setAttribute("height",14),s.setAttribute("fill","none"),s.setAttribute("stroke",n.getRGB()),s.setAttribute("stroke-width",2);const r=t.createNS("path","bf-snap-handle");r.setAttribute("d","M 7 0 L 16 16 L 0 16 L 7 0"),r.setAttribute("fill","none"),r.setAttribute("stroke",n.getRGB()),r.setAttribute("stroke-width",2);const a=t.createNS("line","bf-snap-handle");a.setAttribute("x1",0),a.setAttribute("y1",0),a.setAttribute("x2",14),a.setAttribute("y2",14),a.setAttribute("stroke",i.getRGB()),a.setAttribute("stroke-width",2);const l=t.createNS("line","bf-snap-handle");l.setAttribute("x1",14),l.setAttribute("y1",0),l.setAttribute("x2",0),l.setAttribute("y2",14),l.setAttribute("stroke",i.getRGB()),l.setAttribute("stroke-width",2);var h=t.createNS("line","bf-snap-line");h.style.strokeWidth=2,h.style.stroke=i.getRGB();var d=t.createNS("polygon","bf-snap-rect");d.setAttribute("fill",i.getRGBA()),d.setAttribute("stroke",i.getRGB()),d.setAttribute("stroke-width",1),this.hoverLine=h,this.hoverPoint=o,this.hoverEndPoint=s,this.hoverMidPoint=r,this.hoverIntersectionPointA=a,this.hoverIntersectionPointB=l,this.hoverPanel=d,this.hoverPanelSize={width:20,height:20}};i.prototype=Object.assign(i.prototype,{stretchOnDirection:function(e,t,i){var n=e.clone().add(t).multiplyScalar(.5),o=t.clone().sub(e).normalize();return[n.clone().sub(o.clone().multiplyScalar(i/2)),n.clone().add(o.clone().multiplyScalar(i/2))]},draw:function(e){var t=this.hoverLine,i=this.hoverPoint;const n=this.hoverEndPoint,o=this.hoverMidPoint,s=this.hoverIntersectionPointA,r=this.hoverIntersectionPointB,a=e.hoverPosition&&e.hoverPosition.x,l=e.hoverPosition&&e.hoverPosition.y;var h=this.hoverPanel,d=this.hoverPanelSize;switch(e.hoverObjectType){case"Point":i.setAttribute("cx",e.hoverPosition.x),i.setAttribute("cy",e.hoverPosition.y),e.svg.appendChild(i);break;case"EndPoint":n.setAttribute("x",a-7),n.setAttribute("y",l-7),e.svg.appendChild(n);break;case"MidPoint":o.setAttribute("d",`M ${a} ${l-7} L ${a+8} ${l+8} L ${a-8} ${l+8} L ${a} ${l-7}`),e.svg.appendChild(o);break;case"IntersectionPoint":s.setAttribute("x1",a-7),s.setAttribute("y1",l-7),s.setAttribute("x2",a+7),s.setAttribute("y2",l+7),e.svg.appendChild(s),r.setAttribute("x1",a+7),r.setAttribute("y1",l-7),r.setAttribute("x2",a-7),r.setAttribute("y2",l+7),e.svg.appendChild(r);break;case"Line":t.setAttribute("x1",e.lineStartPoint.x),t.setAttribute("y1",e.lineStartPoint.y),t.setAttribute("x2",e.lineEndPoint.x),t.setAttribute("y2",e.lineEndPoint.y),e.svg.appendChild(t);break;case"Panel":var c=e.clientPts,u=c[0].distanceTo(c[1]),p=c[0].distanceTo(c[3]),g=u/d.width,m=p/d.height;if(1!=g){var f=this.stretchOnDirection(c[0],c[1],d.width),w=this.stretchOnDirection(c[2],c[3],d.width);c=f.concat(w)}if(1!=m){f=this.stretchOnDirection(c[0],c[3],d.height),w=this.stretchOnDirection(c[1],c[2],d.height);c=[f[0],w[0],w[1],f[1]]}for(var v="",y=0;y<c.length;y++)v+=c[y].x+",",v+=c[y].y+" ";h.setAttribute("points",v),e.svg.appendChild(h)}}}),e.SnapItem=i}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Snap"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=null,n=[],o=null,s=null,r=function(e){var i=e.viewer,n=this;this.snapMode=e.snapMode,n.isOpen=!1,this._p1=new THREE.Vector3,this._p2=new THREE.Vector3;var o=new Glodon$1.Web.Lang.EventManager,s=t.create("div","bf-snap-conext");this.context={rootDomElement:s},this._opt=e,this.getEventManager=function(){return o},skipVueObserver(this),n.init(e),i.addEventListener("Rendered",(function(){n.isOpen&&n.update()}))};r.prototype={init:function(e){var i=this,n=i.context,o=i._opt.viewer;i.isOpen=!0,o.getDomElement().appendChild(n.rootDomElement),o.getModels().forEach((e=>{e.setSelectedComponentsById()}));var s=t.createNS("svg","bf-snap-svg");n.rootDomElement.innerHTML="",n.rootDomElement.appendChild(s),n.svg=s;var r=new Glodon$1.Bimface.Plugins.Snap.SnapItem(e);i.snapItem=r,o.render()},snapByPoint:function(e){i=e.pickPoint?e.pickPoint:null;let t=this.snapMode?this.snapMode.getSnap3DList():["line","face","endpoint","midpoint","intersection"];if(e.pointType&&t.includes({EndPoint:"endpoint",MidPoint:"midpoint",IntersectionPoint:"intersection"}[e.pointType])?o=e.pointType:e.pickPlane&&t.includes("face")?(o="Panel",s=e.normal):e.pickLine&&t.includes("line")?(o="Line",n=e.pickLine):o=null,!this.isNeedSnap(e))return this.context.pickPoint=i,this.context.hoverPosition=i,void(this.context.hoverObjectType=o);this.update()},isNeedSnap:function(e){if(!this.snapMode)return!0;let t=this.snapMode.getSnap3DList(),i="face",n="line",o="endpoint",s="midpoint",r="intersection",a=!1,l=!1,h=!1,d=!1;e.pointType&&(l=t.includes(o)||t.includes(s)||t.includes(r)),e.pickPlane&&(h=t.includes(i)),e.pickLine&&(d=t.includes(n)),a=l||h||d;let c=this.snapMode.getSnapCondition(),u=this._opt.viewer.getViewer().getUserdataByUserId(e.userId),p=this.isMatchConditions(u,c.objectData),g=!0,m=!0;if("ViewerGIS"==this._opt.viewer.getViewerType())if(e.modelId){let t=this._opt.viewer.getModel(e.modelId)._layer.id;c.layerIds&&c.layerIds.length>0&&c.layerIds.indexOf(t)<0&&(g=!1)}else g=!1;"Viewer3D"==this._opt.viewer.getViewerType()&&c.modelIds&&c.modelIds.length>0&&c.modelIds.indexOf(e.modelId)<0&&(m=!1);let f=a&&p&&g&&m;return f||this.reset(),f},isMatchConditions:function(e,t){if(!e||!t)return!0;for(var i=!0,n=0,o=t.length;n<o;n++){var s=t[n];for(var r in s)if(e[r]!==s[r]){i=!1;break}if(i)break;n<t.length-1&&(i=!0)}return i},update:function(){var e=this.context,t=this._opt.viewer,r=t.getDomElement(),a=r.getBoundingClientRect(),l=t.getViewer(),h=[],d=[];if(this.context.svg.innerHTML="",i?(e.pickPoint=i,e.hoverPosition=l.worldToCanvas(i),e.hoverPositionDS=l.getScene().worldToDrawing(i)):e.hoverPosition=null,e.hoverObjectType=o,"Line"==o&&2==n.length){e.lineStartPoint=l.worldToCanvas(n[0]),e.lineEndPoint=l.worldToCanvas(n[1]);var c=new THREE.Vector2(e.lineStartPoint.x,e.lineStartPoint.y),u=new THREE.Vector2(e.lineEndPoint.x,e.lineEndPoint.y),p=new THREE.Box2;p.min.set(r.clientLeft,r.clientTop),p.max.set(p.min.x+r.clientWidth,p.min.y+r.clientHeight);var g=!p.containsPoint(c),m=!p.containsPoint(u),f={start:c,end:u},w=CLOUD$1.CameraUtil.lineIntersectWithRect(f,p);if(g&&m)2==w.length&&(e.lineStartPoint=w[0],e.lineEndPoint=w[1]);else if(g||m)for(var v=new THREE.Vector2(e.hoverPosition.x,e.hoverPosition.y),y=g?u.clone():c.clone(),b=y.clone().sub(v).normalize(),E=0;E<w.length;E++){if(y.clone().sub(w[E]).normalize().dot(b)>0){e.lineStartPoint=y,e.lineEndPoint=w[E];break}}}if("Panel"==e.hoverObjectType){e.normal=l.getScene().worldToDrawing(s),e.normal.normalize();var x=l.cameraControl,C=new THREE.Plane;C.setFromNormalAndCoplanarPoint(e.normal,e.hoverPositionDS);var M=new THREE.Vector2(e.hoverPosition.x-10,e.hoverPosition.y-10),P=new THREE.Vector2(e.hoverPosition.x+10,e.hoverPosition.y-10),T=e.hoverPositionDS,I=x.getRaycaster(M.x,M.y);if(this._p1=I.ray.intersectPlane(C,this._p1),I=x.getRaycaster(P.x,P.y),this._p2=I.ray.intersectPlane(C,this._p2),null==this._p1||null==this._p2)return this._p1=new THREE.Vector3,void(this._p2=new THREE.Vector3);var S=new THREE.Vector3(1,0,0),D=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,0,1),A=Math.abs(e.normal.clone().dot(S))<=.0025,_=Math.abs(e.normal.clone().dot(B))<=.0025;if(A&&_)var L=S.clone(),k=B.clone();else L=D.clone().cross(e.normal).normalize(),k=e.normal.clone().cross(L).normalize();var R=this._p1.distanceTo(this._p2)/2,V=L.clone().multiplyScalar(R),G=k.clone().multiplyScalar(R),U=T.clone().sub(V).add(G),O=T.clone().add(V).add(G),H=T.clone().sub(V).sub(G),N=T.clone().add(V).sub(G),$=[];$.push(U,O,N,H);for(var z=[],F=x.getContainerDimensions(),W=0;W<$.length;W++){var j=CLOUD$1.CameraUtil.drawingToCanvas(x.camera,$[W],F.width,F.height);z.push(new THREE.Vector3(j.x,j.y,0))}e.clientPts=z}for(E=0;E<h.length-1;E++){var Z=l.worldPointsToClient(h[E],h[E+1]);if(Z){var X={x:Z.start.x-a.left,y:Z.start.y-a.top};d.push(X)}}e.clientPoints=d,this.snapItem.draw(e)},reset:function(){o=null,this.context.svg.innerHTML=""},destroy:function(){var e=this.context.rootDomElement,t=this;t.reset(),e.remove(),t.snapItem=null,t.isOpen=!1}},e.Snap=r}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Walkthrough").WalkthroughManagerConfig=function(){return{viewer:null}},function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Walkthrough");t.WalkthroughManager=class{constructor(e){var t=e.viewer;t?"Viewer3D"===t.getViewerType()||"ViewerGIS"===t.getViewerType()?(skipVueObserver(this),this._viewer=t,this._walkthroughMap={}):console.log("ViewerType is not supported."):console.log("viewer must not be empty.")}addWalkthrough(e,t){var i=Glodon$1.Web.Lang.Utility.UUID.createUUID(),n={id:i,walkthrough:t};return t._walkthrough.setName(e),this._walkthroughMap[i]=n,i}removeWalkthrough(e){"[object String]"===Object.prototype.toString.call(e)&&(e=[e]),"[object Array]"===Object.prototype.toString.call(e)&&e.forEach((e=>{delete this._walkthroughMap[e]}))}setWalkthroughList(e){if("[object Object]"===Object.prototype.toString.call(e)){var t=e.coordinate;e.data.forEach((e=>{var i=new Glodon$1.Bimface.Plugins.Walkthrough.WalkthroughConfig;i.viewer=this._viewer;var n=new Glodon$1.Bimface.Plugins.Walkthrough.Walkthrough(i),o=e.coordinateSystem||t;"world"===o&&e.keyFrames.forEach((e=>{e.coordinateSystem=o})),n.setKeyFrames(e.keyFrames),n.setWalkthroughTime(e.time),n._walkthrough.setName(e.name),this._walkthroughMap[e.id]={id:e.id,walkthrough:n}}))}}getWalkthroughList(){var e={data:[],version:1};for(var t in this._walkthroughMap){var i={id:t},n=this._walkthroughMap[t].walkthrough;i.keyFrames=n.getKeyFrames(),i.keyFrames.forEach((e=>{delete e.coordinateSystem})),i.name=n._walkthrough.getName(),i.time=n._walkthrough.walkthroughTime,i.coordinateSystem="world",e.data.push(i)}return e}exportVideo(t,i){e.send("Bimface.Plugins.Walkthrough.WalkthroughManager","exportVideo");const n=this,o=this._walkthroughMap[t],s=this._viewer.getViewer().getRenderer().domElement;let r=document.createElement("canvas");r.width=s.width,r.height=s.height;let a=r.getContext("2d"),l=null==this._viewer._opt.backgroundColor.direction?this._viewer._opt.backgroundColorDirection:this._viewer._opt.backgroundColor.direction;0==l&&(l=2*Math.PI);const h=(e,t,i)=>{let n=2*Math.PI,o=i;for(;o<-Math.PI;)o+=n;for(;o>Math.PI;)o-=n;let s,r=Math.atan2(t,e),a=Math.tan(o);s=o>-r&&o<=r?1:o>r&&o<=Math.PI-r?2:o>Math.PI-r||o<=-(Math.PI-r)?3:4;let l={x:e/2,y:t/2},h=e/2,d=t/2;switch(s){case 1:l.x=e,l.y=d-e/2*a;break;case 2:l.x=h+t/(2*a),l.y=0;break;case 3:l.x=0,l.y=d+e/2*a;break;case 4:l.x=h-t/(2*a),l.y=t}return{x:l.x,y:l.y,region:s}},d=(e=>{const t=1.5*Math.PI-e;return{theta:t,revTheta:t+Math.PI}})(l);let c=h(r.width,r.height,d.theta),u=h(r.width,r.height,d.revTheta);Math.abs(c.x-u.x)<.01&&(c.x=0,u.x=0),Math.abs(c.xy-u.y)<.01&&(c.y=0,u.y=0);const p=a.createLinearGradient(c.x,c.y,u.x,u.y);o.walkthrough.stop(),o.walkthrough.play(),o.walkthrough.setDisableAnimation(!0);const g=this._viewer._opt.backgroundColor.colors||this._viewer._opt.backgroundColor,m=()=>{a&&(a.clearRect(0,0,r.width,r.height),g.map((e=>{const t=`#${(e.color||e).red.toString(16).padStart(2,"0")}${(e.color||e).green.toString(16).padStart(2,"0")}${(e.color||e).blue.toString(16).padStart(2,"0")}`,i=e.stop?parseInt(e.stop.split("%")[0])/100:0;p.addColorStop(i,t)})),a.fillStyle=p,a.fillRect(0,0,r.width,r.height),a.drawImage(s,0,0),requestAnimationFrame(m))};requestAnimationFrame(m);const f=r.captureStream();this.mediaRecorder=new MediaRecorder(f,{videoBitsPerSecond:85e5,mimeType:"video/webm; codecs=h264"});const w=[];this.mediaRecorder.ondataavailable=e=>{w.push(e.data)},this.mediaRecorder.onstop=()=>{const e=new Blob(w,{type:"video/webm"});i&&i(e),r=null,a=null,n._viewer.render()},this.mediaRecorder.start();const v=o.walkthrough._stopCallback;o.walkthrough.stopCallback((()=>{n.mediaRecorder&&"inactive"!=n.mediaRecorder.state&&(n.mediaRecorder.stop(),delete n.mediaRecorder),v&&v(),o.walkthrough.setDisableAnimation(!1)}))}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").NorthArrowConfig=function(){return{domElement:null,viewer:null,right:10,top:10}};class NorthArrowYaw{constructor(e,t,i){this.element=e,this.northArrowElement=t,this.textElement=e.lastElementChild,this._camera=i,this._rotate=0,this._minRadius=4,this._maxRadius=48,this.init()}init(){let e,t,i,n,o;this.isDragging=!1,this.events={mouseout:()=>{this.isDragging||this.element.firstElementChild.setAttribute("filter","")},mousedown:i=>{this.isDragging=!0,e=i.offsetX-50,t=i.offsetY-60,o=this._camera.getYawPitch().pitch,this.element.setAttribute("class","bf-northarrow-yawactive")},mouseover:function(){this.firstElementChild.setAttribute("filter","url(#bf-northarrow-dropshadow)")}};for(let e in this.events)this.element.addEventListener(e,this.events[e].bind(this.element));const s=()=>{this.isDragging=!1,this.element.firstElementChild.setAttribute("filter",""),this.element.setAttribute("class","bf-northarrow-yaw")},r=(i,n)=>{let s=i-e,r=n-t,a=Math.atan(n/i),l=Math.atan(t/e),h=180*Math.abs(a-l)/Math.PI;i>0&&i>Math.abs(n)&&e>0&&e>Math.abs(t)?r>0?this._rotate+=h:this._rotate-=h:i<0&&i<-Math.abs(n)&&e<0&&e<-Math.abs(t)?r>0?this._rotate-=h:this._rotate+=h:(a=Math.atan(i/n),l=Math.atan(e/t),h=180*Math.abs(a-l)/Math.PI,n>0&&t>0?s>0?this._rotate-=h:this._rotate+=h:s>0?this._rotate+=h:this._rotate-=h),this.element.setAttribute("transform",`rotate(${this._rotate}, 0, 0)`);let d=this._rotate*Math.PI/180;this._camera.setCameraFromYawPitch({yaw:d,pitch:o,target:!0},!0),e=i,t=n};this.northArrowEvents={mousemove:e=>{this.isDragging&&(i=e.offsetX-50,n=e.offsetY-60,r(i,n))},mouseup:e=>{this.isDragging&&s()}};for(let e in this.northArrowEvents)this.northArrowElement.addEventListener(e,this.northArrowEvents[e]);this.northArrowParentEvents={mousemove:e=>{this.isDragging&&(i=e.offsetX-50-this.northArrowElement.offsetLeft,n=e.offsetY-60-this.northArrowElement.offsetTop,r(i,n))},mouseup:e=>{this.isDragging&&s()}};for(let e in this.northArrowParentEvents)this.northArrowElement.parentElement.addEventListener(e,this.northArrowParentEvents[e]);this.textEvents={dblclick:e=>{o=this._camera.getYawPitch().pitch,this._camera.setCameraFromYawPitch({yaw:0,pitch:o,target:!0},!1)}};for(let e in this.textEvents)this.textElement.addEventListener(e,this.textEvents[e])}update(){if(this.isDragging)return;let{yaw:e}=this._camera.getYawPitch();this._rotate=180*e/Math.PI,this.element.setAttribute("transform",`rotate(${this._rotate}, 0, 0)`)}destroy(){if(this.events)for(let e in this.events)this.element.removeEventListener(e,this.events[e]);if(this.northArrowEvents)for(let e in this.northArrowEvents)this.northArrowElement.removeEventListener(e,this.northArrowEvents[e]);if(this.northArrowParentEvents)for(let e in this.northArrowParentEvents)this.northArrowElement.parentElement.removeEventListener(e,this.northArrowParentEvents[e]);if(this.textEvents)for(let e in this.textEvents)this.textElement.removeEventListener(e,this.textEvents[e])}}class NorthArrowPitch{constructor(e,t){this.elements=e,this._camera=t,this.minPitch=-Math.PI/2,this.maxPitch=Math.PI/2,this.init()}init(){const e=this._camera;let t,i,n=this,o=!1,s=!1;this.events={mousedown:function(){o=!0;let r=e.getYawPitch();i=r.yaw,t=r.pitch;let a=Math.PI/1e3;const l=()=>{if(t=-t,t>n.maxPitch&&(t=n.maxPitch),t<n.minPitch&&(t=n.minPitch),t>n.minPitch&&t-a>n.minPitch&&"bf-northarrow-pitchdown"===this.className.baseVal)t-=a,s=!0;else{if(!(t<n.maxPitch&&t+a<n.maxPitch&&"bf-northarrow-pitchup"===this.className.baseVal))return;t+=a,s=!1}t=-t,e.setCameraFromYawPitch({yaw:i,pitch:t,target:!0,isDownDirection:s},!0),o&&requestAnimationFrame(l)};l()},mouseup:()=>{o=!1},mouseover:function(){this.firstElementChild.setAttribute("filter","url(#bf-northarrow-dropshadow)")},mouseout:function(){this.firstElementChild.setAttribute("filter",""),o=!1},dblclick:function(){if("bf-northarrow-pitchup"===this.className.baseVal){let o=e.getYawPitch();i=o.yaw,t=o.pitch;let r=Math.PI/200;const a=()=>{t=-t,t>n.maxPitch&&(t=n.maxPitch),t<n.minPitch&&(t=n.minPitch),t<n.maxPitch&&t+r<n.maxPitch&&(t+=r,s=!1,t=-t,e.setCameraFromYawPitch({yaw:i,pitch:t,target:!0,isDownDirection:s},!0),requestAnimationFrame(a))};a()}}};for(let e in this.events)for(let t in this.elements)this.elements[t].addEventListener(e,this.events[e].bind(this.elements[t]))}destroy(){for(let e in this.events)for(let t in this.elements)this.elements[t].removeEventListener(e,this.events[e])}}class NorthArrowPan{constructor(e,t){this.elements=e,this._camera=t,this.init()}init(){const e=this._camera;let t=!1;this.events={mousedown:function(){t=!0;const i=()=>{switch(/bf-northarrow-pan(.*)/.exec(this.className.baseVal)[1]){case"up":e.panInDirection(!0);break;case"down":e.panInDirection(!1);break;case"left":e.panInHorizontal(!0);break;case"right":e.panInHorizontal(!1)}t&&requestAnimationFrame(i)};i()},mouseup:()=>{t=!1},mouseover:function(){this.setAttribute("filter","url(#bf-northarrow-dropshadow)")},mouseout:function(){this.setAttribute("filter",""),t=!1}};for(let e in this.events)for(let t in this.elements)this.elements[t].addEventListener(e,this.events[e].bind(this.elements[t]))}destroy(){for(let e in this.events)for(let t in this.elements)this.elements[t].removeEventListener(e,this.events[e])}}class NorthArrowZoom{constructor(e,t){this.elements=e,this._camera=t,this.init()}init(){const e=this._camera;let t=!1;this.events={mousedown:function(){t=!0;const i=()=>{"bf-northarrow-zoomin"===this.className.baseVal?e.zoomIn():e.zoomOut(),t&&requestAnimationFrame(i)};i()},mouseup:()=>{t=!1}},this.events.mouseout=this.events.mouseup;for(let e in this.events)for(let t in this.elements)this.elements[t].addEventListener(e,this.events[e].bind(this.elements[t]))}destroy(){for(let e in this.events)for(let t in this.elements)this.elements[t].removeEventListener(e,this.events[e])}}!function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.NorthArrow=class{constructor(e){this._opt=e;const i=e.domElement,n=t.create("div","bf-northarrow");n.style.top=`${e.top}px`,n.style.right=`${e.right}px`,i.appendChild(n),this.domElement=n,this._camera=e.viewer._camera,this.init(),skipVueObserver(this)}init(){this.drawElements((()=>{this.addDomElementEvents(),this.northArrowYaw=new NorthArrowYaw(this.elements.yaw,this.domElement,this._camera),this.northArrowPitch=new NorthArrowPitch({pitchUp:this.elements.pitchUp,pitchDown:this.elements.pitchDown},this._camera),this.northArrowZoom=new NorthArrowZoom({zoomIn:this.elements.zoomIn,zoomOut:this.elements.zoomOut},this._camera),this.northArrowPan=new NorthArrowPan({panUp:this.elements.panUp,panDown:this.elements.panDown,panLeft:this.elements.panLeft,panRight:this.elements.panRight},this._camera),this.addRenderCallback()}))}drawElements(e){this.domElement.innerHTML='\n <svg height="180" width="100" class="bf-northarrow-svg" onselectstart="return false;">\n <defs>\n <filter id="bf-northarrow-dropshadow" x="-10" y="-10" width="100" height="100">\n <feDropShadow dx="0" dy="0" stdDeviation="0" \n flood-color="cyan"/>\n </filter>\n </defs>\n \n <g class="bf-northarrow-pitchup" transform="translate(50, 12)" width="500" height="100">\n <path d="M-15,0 A50,50 0 0,1 15,0 A3,3 0 0,1 14.5,8 A42,42 0 0,0 -14.5,8 A3,3 0 0,1 -15,0 Z" shape-rendering="geometricPrecision" />\n <path d="M-4,3 L0,-1 4,3" shape-rendering="geometricPrecision" />\n </g>\n\n <g transform="translate(50, 60)">\n <g class="bf-northarrow-yaw">\n <path d="M39,0 A39,39 0 0,0 -39,0 L-29,0 A29,29 0 0,1 29,0 L39,0 A39,39 0 0,1 0,39 L0,29 A29,29 0 0,0 29,0 L39,0 M-39,0 A39,39 0 0,0 0,39 L0,29 A29,29 0 0,1 -29,0 L-39,0 Z" shape-rendering="geometricPrecision" />\n <g transform="translate(-40, -40)">\n <path />\n <path d="M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z M40,1 C18.4608948,1 1,18.4608948 1,40 C1,61.5391052 18.4608948,79 40,79 C61.5391052,79 79,61.5391052 79,40 C79,18.4608948 61.5391052,1 40,1 Z" shape-rendering="geometricPrecision" />\n <path d="M40,11 C56.0162577,11 69,23.9837423 69,40 C69,56.0162577 56.0162577,69 40,69 C23.9837423,69 11,56.0162577 11,40 C11,23.9837423 23.9837423,11 40,11 Z M40,12 C24.536027,12 12,24.536027 12,40 C12,55.463973 24.536027,68 40,68 C55.463973,68 68,55.463973 68,40 C68,24.536027 55.463973,12 40,12 Z" shape-rendering="geometricPrecision" />\n <rect x="1" y="40" width="10" height="1" />\n <rect x="69" y="40" width="10" height="1" />\n <rect x="39" y="69" width="1" height="10" />\n <path />\n </g>\n <text x="0" y="-30">N</text>\n </g>\n </g>\n\n <g class="bf-northarrow-pitchdown" transform="translate(50, 108)">\n <path d="M-15,0 A50,50 0 0,0 15,0 A3,3 0 0,0 14.5,-8 A42,42 0 0,1 -14.5,-8 A3,3 0 0,0 -15,0 Z" shape-rendering="geometricPrecision" />\n <path d="M-4,-3 L0,1 4,-3" shape-rendering="geometricPrecision" />\n </g>\n\n <g transform="translate(50, 60)">\n <g class="bf-northarrow-panup" transform="translate(-7, -24)">\n <path d="M7,0 L14,10 0,10 Z" />\n <path d="M7,0 L14,10 L0,10 L7,0 Z M7,1.745 L1.921,9 L12.078,9 L7,1.745 Z" />\n </g>\n <g class="bf-northarrow-pandown" transform="translate(-7, 14) rotate(180, 7 5)">\n <path d="M7,0 L14,10 0,10 Z" />\n <path d="M7,0 L14,10 L0,10 L7,0 Z M7,1.745 L1.921,9 L12.078,9 L7,1.745 Z" />\n </g>\n <g class="bf-northarrow-panleft" transform="translate(-24, -5) rotate(-90, 7 5)">\n <path d="M7,0 L14,10 0,10 Z" />\n <path d="M7,0 L14,10 L0,10 L7,0 Z M7,1.745 L1.921,9 L12.078,9 L7,1.745 Z" />\n </g>\n <g class="bf-northarrow-panright" transform="translate(10, -5) rotate(90, 7 5)">\n <path d="M7,0 L14,10 0,10 Z" />\n <path d="M7,0 L14,10 L0,10 L7,0 Z M7,1.745 L1.921,9 L12.078,9 L7,1.745 Z" />\n </g>\n\n </g>\n\n <g transform="translate(50, 118)">\n <g transform="translate(-13, 0)">\n <rect id="Rectangle" fill="#2A313B" opacity="0.78" x="0" y="0" width="26" height="53" />\n <path d="M26,0 L26,53 L0,53 L0,0 L26,0 Z M25,1 L1,1 L1,52 L25,52 L25,1 Z" fill="#969FAE" fill-rule="nonzero" />\n <rect fill="#969FAE" x="3" y="26" width="20" height="1" />\n </g>\n <g class="bf-northarrow-zoomin">\n <path d="M-13,0 L13,0 13,26 -13,26 Z" />\n <polygon points="5 5 5 0 7 0 7 5 12 5 12 7 7 7 7 12 5 12 5 7 0 7 0 5" transform="translate(-6, 7)" />\n </g>\n <g class="bf-northarrow-zoomout">\n <path d="M-13,26 L13,26 13,52 -13,52 Z" />\n <rect x="0" y="0" width="12" height="2" transform="translate(-6, 39)" />\n </g>\n </g>\n </svg>\n ',this.elements={},["pitchUp","pitchDown","yaw","panUp","panDown","panLeft","panRight","zoomIn","zoomOut"].forEach((e=>{const t=this.domElement.querySelector(`.bf-northarrow-${e.toLowerCase()}`);this.elements[e]=t})),e()}addDomElementEvents(){this.domElementEvents={mouseover:()=>{this.elements.pitchUp.style.opacity=1,this.elements.pitchDown.style.opacity=1},mouseout:()=>{this.elements.pitchUp.style.opacity=0,this.elements.pitchDown.style.opacity=0},mousedown:e=>(e.stopPropagation(),!1)},this.domElementEvents.mousemove=this.domElementEvents.mouseup=this.domElementEvents.mousedown,this.domElementEvents.mouseout();for(let e in this.domElementEvents)this.domElement.addEventListener(e,this.domElementEvents[e])}addRenderCallback(){this.renderCallback=()=>{this.northArrowYaw&&this.northArrowYaw.update()},this._opt.viewer.getViewer().addRenderCallback(this.renderCallback)}destroy(){if(this.domElement&&this.domElementEvents)for(let e in this.domElementEvents)this.domElement.removeEventListener(e,this.domElementEvents[e]);this.northArrowYaw&&this.northArrowYaw.destroy(),this.northArrowPitch&&this.northArrowPitch.destroy(),this.northArrowPan&&this.northArrowPan.destroy(),this.northArrowZoom&&this.northArrowZoom.destroy(),this.renderCallback&&this._opt.viewer.getViewer().removeRenderCallback(this.renderCallback),this._opt.domElement.removeChild(this.domElement)}setLimitPitch(e=null,t=null){this.northArrowPitch.minPitch=null!=e?e:-Math.PI/2,this.northArrowPitch.maxPitch=null!=t?t:Math.PI/2}show(){this.domElement.style.display="block"}hide(){this.domElement.style.display="none"}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").ScaleBarConfig=function(){return{domElement:null,viewer:null,right:10,bottom:10}},function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.performance,n=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7];e.ScaleBar=class{constructor(e){this._opt=e;const i=e.domElement,n=t.create("div","bf-scale");n.style.bottom=`${e.bottom}px`,n.style.right=`${e.right}px`,i.appendChild(n),this.domElement=n,this.barElement=void 0,this.labelElement=void 0,this.lastUpdateTime=Date.now(),this.enableScale=!0,this._value=void 0,skipVueObserver(this),this.init()}init(){this.drawElements((()=>{this.addRenderCallback()}))}drawElements(e){this.domElement.innerHTML='\n <svg height="36px" width="140px" class="bf-scale-svg" onselectstart="return false;">\n <rect x="0" y="0" width="140px" height="36px" style="fill:#20262F;opacity:0.85;stroke-width:1px;stroke:#3B4554"/>\n <path class="bf-scale-bar" fill="none"/>\n <text class= "bf-scale-label" fill="#cccccc"></text>\n </svg>\n ',this.barElement=this.domElement.querySelector(".bf-scale-bar"),this.labelElement=this.domElement.querySelector(".bf-scale-label"),this.domElement.style.display="none",e()}addRenderCallback(){this.renderCallback=i.throttleAndDebounce((()=>{if(this.enableScale&&!this._opt.viewer._isDestroyed){var e=this._opt.viewer.getViewer().camera,t=this._opt.viewer.getViewer().getViewportSize();if(e.position.y<0)this.domElement.style.display="none";else{var i=new THREE.Vector3(t.width/2,t.height-1),o=new THREE.Vector3(t.width/2+1,t.height-1),s=this._opt.viewer.getViewer().pickByPoint(i,!0,!1),r=this._opt.viewer.getViewer().pickByPoint(o,!0,!1);if(s&&r&&s.worldPosition&&r.worldPosition){var a=s.worldPosition.distanceTo(r.worldPosition);if(this._pixelDistance=a,a<0)this.domElement.style.display="none";else{for(var l,h=n.length-1;!l&&h>=0;--h)n[h]/a<=120&&(l=n[h]);if(l){var d;this._value=l,d=l>=1e3?(l/1e3).toString()+"km":l.toString()+"m",this.labelElement.textContent=d;var c=this.labelElement.getBoundingClientRect().width||43;this.labelElement.setAttribute("x",70-c/2),this.labelElement.setAttribute("y",23);var u=l/a,p="M"+(70-u/2).toString()+" 20 L"+(70-u/2).toString()+" 28 L"+(70+u/2).toString()+" 28 L"+(70+u/2).toString()+" 20";this.barElement.setAttribute("d",p),this.domElement.style.display="block"}else this._value=void 0,this._pixelDistance=void 0,this.domElement.style.display="none"}}else this.domElement.style.display="none"}}}),500),this._opt.viewer.getViewer().addRenderCallback(this.renderCallback)}destroy(){this.renderCallback&&this._opt.viewer.getViewer().removeRenderCallback(this.renderCallback),this._opt.domElement.removeChild(this.domElement)}show(){this.domElement.style.display="block",this.enableScale=!0}hide(){this.domElement.style.display="none",this.enableScale=!1}isVisible(){return this.enableScale}getValue(){return this._pixelDistance}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").InfoBarConfig=function(){return{domElement:null,viewer:null,right:0,bottom:0}},function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),i=Glodon$1.Web.Lang.Utility.performance;e.InfoBar=class{constructor(e){this._opt=e;const n=e.domElement,o=t.create("div","bf-infobar");o.style.bottom=`${e.bottom}px`,o.style.right=`${e.right}px`,o.style.display="none",n.appendChild(o),this.domElement=o,this.enable=!0,this._info={},this._inited=!1,this.isMouseClicked=!1,skipVueObserver(this);this._mousemoveCallback=i.throttleAndDebounce((e=>{if(!this.enable)return;if(this.isMouseClicked)return;let t=this._opt.viewer.getViewer().pickByPoint(e,!1,!1);if(!t)return;let i=t.worldPosition,n=i.z,{lat:o,lon:s}=this._opt.viewer.worldToLatLon(i);this._info={latitude:o,longtitude:s,altitude:n};let r=`${o.toFixed(6)}${o>=0?"N":"S"}&nbsp;&nbsp;${s.toFixed(6)}${s>=0?"E":"W"}&nbsp;&nbsp;${"-0.000"===n.toFixed(3)?"0.000":n.toFixed(3)}m`;this.domElement.innerHTML=r,this._inited||(this.domElement.style.display="block",this._inited=!0)}),250),this._mousedownCallback=()=>{this.isMouseClicked=!0},this._mouseupCallback=()=>{this.isMouseClicked=!1},this.init()}init(){this._opt.domElement.addEventListener("mousedown",this._mousedownCallback),this._opt.domElement.addEventListener("mouseup",this._mouseupCallback),this._opt.domElement.addEventListener("mousemove",this._mousemoveCallback)}destroy(){this._opt.domElement.removeEventListener("mousemove",this._mousemoveCallback),this._opt.domElement.removeEventListener("mousedown",this._mousedownCallback),this._opt.domElement.removeEventListener("mouseup",this._mouseupCallback),this._opt.domElement.removeChild(this.domElement)}show(){this.domElement.style.display="block",this.enable=!0}hide(){this.domElement.style.display="none",this.enable=!1}isVisible(){return this.enable}getValue(){return this._info}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins").CreditConfig=function(){return{domElement:null,viewer:null,right:10,bottom:10}},function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.Credit=class{constructor(e){this._opt=e;const i=e.domElement,n=t.create("div",`bf-credit ${e.class||""}`);i.appendChild(n),this.domElement=n,this.barElement=void 0,this.labelElement=void 0,skipVueObserver(this)}drawElements(){const{credit:e,text:t,link:i,copyright:n}=this._opt;if(e===Glodon$1.Bimface.Common.Credit.None)this.domElement.innerHTML="";else this.domElement.innerHTML=`\n <div class='copyright'>${n}\n <div class='divider'></div>\n <a class='text' href='${i}' target='_blank'>${t}</a> \n </div>\n `}destroy(){this._opt.domElement.removeChild(this.domElement)}update(e){this._opt=Object.assign({},this._opt,e),this.drawElements()}show(){this.domElement.style.display="block"}hide(){this.domElement.style.display="none"}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Search").SearchConfig=function(){return{wrapElement:null,viewer:null}},function(){var e="Bimface.Plugins.Search",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Search"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){var t=e;if(this._opt=t,this.clear(),!t.viewer)return console.log("viewer is not defined."),!1;let i=new Glodon$1.Web.Lang.EventManager;this.getEventManager=function(){return i},this.buttonIcon=n.create("div","bf-button gld-bf-search bf-search-btn"),this.element=n.create("div","bf-search-toolbar bf-hide"),t.wrapElement.appendChild(this.buttonIcon),t.wrapElement.appendChild(this.element),this.init()};o.prototype={addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},clickSearch(e){const t=this._opt.viewer,i=this.element.querySelector("input").value;return""==i?(this.clear(),void this.update(e)):i===this._data.text?this.clickArrow(!0,e):void t.search({text:i},(t=>{this._data.index=t.length>0?1:0;let n=this.formatResult(t);this._data.all=n.length,this._data.result=n,this._data.text=i,this.hasData=!!this._data.result.length,this._opt.UI.getPanel("MobileLayoutListPanel")&&n.length>0&&this._opt.UI.getPanel("MobileLayoutListPanel").updateStatusByDataType(0==n[this._data.index-1].viewId?"Model":n[this._data.index-1].viewId),this.update(e),this._data.index&&this.zoomToBbox(n[this._data.index-1])}))},clickArrow(e,t){const i=e?this._data.index+1:this._data.index-1,n=this._data.result;this._opt.UI;n.length>0&&(this._data.index=e?i>n.length?1:i:i>0&&i||n.length,this._opt.UI.getPanel("MobileLayoutListPanel")&&n.length>0&&this._opt.UI.getPanel("MobileLayoutListPanel").updateStatusByDataType(0==n[this._data.index-1].viewId?"Model":n[this._data.index-1].viewId),this.update(t),this.zoomToBbox(n[this._data.index-1]))},init:function(){t.send(e,"init"),document.addEventListener("keyup",(e=>{e&&13==e.keyCode&&this.element.querySelector("input")==document.activeElement&&this.clickSearch(!0)})),this.element.addEventListener("click",(e=>{let t=e.target;t.hasClass("bf-search")?this.clickSearch():t.hasClass("gld-bf-arrowup")?this.clickArrow():t.hasClass("gld-bf-arrowdown")&&this.clickArrow(!0)})),this.buttonIcon.addEventListener("click",(e=>{this.buttonIcon.addClass("bf-hide"),this.element.removeClass("bf-hide"),this.update(!0);let t=this._opt.UI.getToolbar("LeftSubToolbar");t&&(t.getControl("MobileLayoutList").setCheckedState(!1),t.getControl("MobileLayoutList").hide())})),this.update()},formatResult(e){let t=[];for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.data.length;e++){const i=n.data[e];t.push({viewId:n.viewId,content:n.content,modelId:n.modelId,boundingBox:i.boundingBox})}}return t},update:function(i){t.send(e,"update"),this.element.innerHTML=`\n <div class="bf-input-wrapper">\n <i class="gld-bimface gld-bf-arrowdown bf-search-back"></i>\n <input value="${this._data.text||""}" type="text" inputmode="search" maxlength="30" placeholder="${BimfaceLanguage.bf_btn_search_textInput}" />\n <div class="bf-right-btns">\n <i class="gld-bimface gld-bf-mark bf-clear ${this._data.text?"":"bf-hidden"}"></i>\n <div class="bf-line ${this._data.text?"":"bf-hidden"}""></div>\n <div title="${BimfaceLanguage.bf_btn_search_search}" class='bf-button gld-bf-search bf-search'></div>\n </div>\n </div>\n <div class='count-wrapper bf-hide'>\n <span class='count'>${this._data.index}/${this._data.all}</span>\n <div title="${BimfaceLanguage.bf_btn_search_previous}" class='bf-button gld-bf-arrowup'></div>\n <div title="${BimfaceLanguage.bf_btn_search_next}" class='bf-button gld-bf-arrowdown'></div>\n </div>\n `;const n=this.element.querySelector(".bf-search-back");n&&n.addEventListener("click",(e=>{this.element.querySelector("input").value="",this.buttonIcon.removeClass("bf-hide"),this.element.addClass("bf-hide"),this.clear();let t=this._opt.UI.getToolbar("LeftSubToolbar");t&&t.getControl("MobileLayoutList").show()}));let o=this.element.querySelector("input");if(i){o.focus();const e=this._data.text;o.value="",o.value=e}o.addEventListener("input",(e=>{this.updateClearBtn(o.value)}));this.element.querySelector(".bf-right-btns .bf-clear").addEventListener("click",(()=>{o.value="",this.clear(),this.updateClearBtn(),this.updateCountRow()})),this.updateCountRow()},clear:function(){this._data={index:0,all:0,text:"",result:[]},this.hasData=!!this._data.result.length},updateClearBtn(e){const t=this.element.querySelector(".bf-right-btns .bf-clear"),i=this.element.querySelector(".bf-right-btns .bf-line");e?(t.removeClass("bf-hidden"),i.removeClass("bf-hidden")):(t.addClass("bf-hidden"),i.addClass("bf-hidden"))},updateCountRow(){const e=this.element.querySelector(".count-wrapper");this.hasData?e.removeClass("bf-hide"):e.addClass("bf-hide")},zoomToBbox(e){const t=this._opt.viewer;t.showViewById(e.viewId),t.zoomToBoundingBox(e.boundingBox)},destroy(){this._opt=null,this.element=null,this._data=null}},i.MobileSearch=o}(),function(){var e="Bimface.Plugins.Search",t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Search"),n=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom"),o=function(e){var t=e;if(this._opt=t,this.clear(),!t.viewer)return console.log("viewer is not defined."),!1;let i=new Glodon$1.Web.Lang.EventManager;this.getEventManager=function(){return i},this.element=n.create("div","bf-search-toolbar"),this.searchPanel=n.create("ul","bf-search-panel"),this.searchPanel.id="bf-search-panel",t.wrapElement.appendChild(this.element),t.wrapElement.appendChild(this.searchPanel),this.init()};o.prototype={addEventListener:function(e,t){this.getEventManager().addEvent(e,t)},removeEventListener:function(e,t){this.getEventManager().removeEvent(e,t)},clickSearch(e){const t=this._opt.viewer,i=this.element.querySelector("input").value;return""==i?(this.clear(),this.searchPanel.innerHTML="",void this.update(e)):i===this._data.text?this.clickArrow(!0,e):void t.search({text:i},(t=>{this._data.index=t.length>0?1:0;let n=this.formatResult(t);this._data.all=n.length,this._data.result=n,this._data.text=i,this._opt.UI.getToolbar("LeftSubToolbar")&&n.length>0&&this._opt.UI.getToolbar("LeftSubToolbar").getControl("LayoutList").setSelectedUiById(0==n[this._data.index-1].viewId?"Model":n[this._data.index-1].viewId),this.update(e),this._data.index&&this.zoomToBbox(n[this._data.index-1])}))},clickArrow(e,t){this.searchPanel.getElementsByClassName("bf-search-result-content").length>0&&(this._opt.wrapElement.querySelectorAll("li")[this._data.index-1].style.color="#ccc");const i=e?this._data.index+1:this._data.index-1,n=this._data.result,o=this._opt.UI;n.length>0&&(this._data.index=e?i>n.length?1:i:i>0&&i||n.length,o.getToolbar("LeftSubToolbar")&&o.getToolbar("LeftSubToolbar").getControl("LayoutList").setSelectedUiById(0==n[this._data.index-1].viewId?"Model":n[this._data.index-1].viewId),this.update(t),this.zoomToBbox(n[this._data.index-1]))},clickSearchPanel(e){if(void 0!==e){this._opt.wrapElement.querySelectorAll("li")[this._data.index-1].style.color="#ccc",this._data.index=e;let t=this._data.result;this._opt.UI.getToolbar("LeftSubToolbar")&&t.length>0&&this._opt.UI.getToolbar("LeftSubToolbar").getControl("LayoutList").setSelectedUiById(0==t[this._data.index-1].viewId?"Model":t[this._data.index-1].viewId),this.update(!0),this._data.index&&this.zoomToBbox(t[this._data.index-1])}},init:function(){t.send(e,"init"),this.onKeyup=e=>{e&&13==e.keyCode&&this.element.querySelector("input")==document.activeElement&&this.clickSearch(!0)},document.addEventListener("keyup",this.onKeyup),this.onClick=e=>{let t=e.target;t.hasClass("gld-bf-search")?this.clickSearch():t.hasClass("gld-bf-arrowup")?this.clickArrow():t.hasClass("gld-bf-arrowdown")&&this.clickArrow(!0)},this.element.addEventListener("click",this.onClick),this.onSearchPanelClick=e=>{this.clickSearchPanel(e.target.index)},this.searchPanel.addEventListener("click",this.onSearchPanelClick),this.update()},formatResult(e){let t=[],i=0;this.searchPanel.innerHTML="";for(let o=0;o<e.length;o++){const s=e[o];for(let e=0;e<s.data.length;e++){i+=1;const o=s.data[e],r=n.create("li","bf-search-result-content");r.textContent=s.content,r.id="bf-search-result-content",r.title=s.content,r.index=i,this.searchPanel.appendChild(r),t.push({viewId:s.viewId,content:s.content,modelId:s.modelId,boundingBox:o.boundingBox})}}return t},update:function(i){if(t.send(e,"update"),this.element.innerHTML=`<input value="${this._data.text||""}" maxlength="30" placeholder="${BimfaceLanguage.bf_btn_search_textInput}" /><div title="${BimfaceLanguage.bf_btn_search_search}" class='bf-button gld-bf-search'></div><div class='line'></div><span class='count'>${this._data.index}/${this._data.all}</span><div title="${BimfaceLanguage.bf_btn_search_previous}" class='bf-button gld-bf-arrowup'></div><div title="${BimfaceLanguage.bf_btn_search_next}" class='bf-button gld-bf-arrowdown'></div>`,this.searchPanel.getElementsByClassName("bf-search-result-content").length>0&&(this._opt.wrapElement.querySelectorAll("li")[this._data.index-1].style.color="#32D3A6",this._opt.wrapElement.querySelectorAll("li")[this._data.index-1].scrollIntoViewIfNeeded(!0)),i){let e=this.element.querySelector("input");e.focus();const t=this._data.text;e.value="",e.value=t}},clear:function(){this._data={index:0,all:0,text:"",text:"",result:[]}},zoomToBbox(e){const t=this._opt.viewer;t.showViewById(e.viewId),t.zoomToBoundingBox(e.boundingBox)},destroy:function(){document.removeEventListener("keyup",this.onKeyup),this.element&&this.element.removeEventListener("click",this.onClick),this.searchPanel&&this.searchPanel.removeEventListener("click",this.onSearchPanelClick),this._opt=null,this._data=null,this.element=null,this.searchPanel=null}},i.Search=o}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SkyBox").SkyBoxStyle=Object.freeze({BlueSky:"BlueSky",CloudySky:"CloudySky",DarkNight:"DarkNight",Galaxy:"Galaxy",Cosmos:"Cosmos",MoonrisePureskyDark:"MoonrisePureskyDark",MountainGround:"MountainGround",CloudPuresky:"CloudPuresky",MistyMorning:"MistyMorning",Puresky:"Puresky",SunsetPuresky:"SunsetPuresky",GreyPuresky:"GreyPuresky",OvercastPuresky:"OvercastPuresky",Customized:"Customized"}),function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SkyBox");e.SkyBoxManagerConfig=class{constructor(){this.customizedImage=null,this.style=null,this.viewer=null,this.initializeVisible=!0}}}(),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t});let BimfaceConfigrationOption=Object.freeze({Release:"Release",Debug:"Debug"}),BimfaceViewTypeOption=Object.freeze({Normal:"Normal",DrawingView:"drawingView"}),BimfaceEnvOption=Object.freeze({BIMFACE:"BIMFACE",Local:"Local"}),BimfaceLanguageOption=Object.freeze({zh_CN:"zh_CN",en_GB:"en_GB",sv_SE:"sv_SE",zh_TW:"zh_TW"}),BimfaceVisualStyle=Object.freeze({Normal:"Normal",Bake:"Bake"});var BimfaceSDKLoaderConfig=function(){if(window.hostConfig){for(let e in window.hostConfig)hostConfig[e]=window.hostConfig[e];hostConfig.securityApi=window.hostConfig.securityApi}return{staticHost:`${hostConfig.staticHost}/api`,APIHost:hostConfig.APIHost,language:"zh_CN",viewToken:null,configuration:BimfaceConfigrationOption.Release,dataEnvType:hostConfig.dataEnvType||"BIMFACE",viewType:BimfaceViewTypeOption.Normal,visualStyle:BimfaceVisualStyle.Bake,version:"",securityApi:hostConfig.securityApi}};window.BimfaceSDKLoaderConfig=BimfaceSDKLoaderConfig,window.BimfaceEnvOption=BimfaceEnvOption,window.BimfaceLanguageOption=BimfaceLanguageOption,window.BimfaceConfigrationOption=BimfaceConfigrationOption,window.BimfaceViewTypeOption=BimfaceViewTypeOption,function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();const t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.SkyBox");t.SkyBoxManager=class{constructor(t){e.send("Bimface.Plugins.SkyBox.SkyBoxManager","bf_c_skyBoxMng_new"),this._customizedImage=t.customizedImage,this._style=t.style,this._viewer=t.viewer,this._enabled=!1,this.exrArr=["MoonrisePureskyDark","MountainGround","CloudPuresky","MistyMorning","Puresky","SunsetPuresky","GreyPuresky","OvercastPuresky"],skipVueObserver(this),this.enableSkyBox(t.initializeVisible)}setCustomizedImage(e){this._customizedImage!=e&&(this._customizedImage=e,this._updateSkyBox())}getCustomizedImage(){return this._customizedImage}setStyle(e){this._style!=e&&(this._style=e,this._updateSkyBox())}getStyle(){return this._style}enableSkyBox(e){if(this._enabled!=e){if(this._enabled=e,!this._enabled)this._viewer.getViewer().IBLManager.removeSkyBox();this._updateSkyBox()}}getSenceType(){return Glodon$1.Bimface.Common.Type.EffectType.SkyBoxManager}show(){this.enableSkyBox(!0)}hide(){this.enableSkyBox(!1)}destroy(){this.enableSkyBox(!1),this._customizedImage=null,this._style=null,this._viewer=null}getParams(){return{customizedImage:this._customizedImage,style:this._style}}_updateSkyBox(){if(this._enabled){var e=this._viewer.getViewer().IBLManager,t=this._style,i=this._viewer._data,n=[];if(this._style==Glodon$1.Bimface.Plugins.SkyBox.SkyBoxStyle.Customized&&this._customizedImage)n.push(this._customizedImage.right),n.push(this._customizedImage.left),n.push(this._customizedImage.top),n.push(this._customizedImage.bottom),n.push(this._customizedImage.front),n.push(this._customizedImage.back);else if(this._style==Glodon$1.Bimface.Plugins.SkyBox.SkyBoxStyle.Customized)t=Glodon$1.Bimface.Plugins.SkyBox.SkyBoxStyle.CloudySky;else{if(this.exrArr.indexOf(this._style)>=0){if(this._viewer.visualization&&this._viewer.visualization.active&&this._viewer.getModel().isBimtilesModel()&&!Glodon$1.Web.Lang.Utility.ClientHelper.getIsMac()){var o=(i.dataEnvType==BimfaceEnvOption.Local?i.sdkPath:hostConfig.staticHost)+"/resources/Setting/SkyBox/"+t+".exr";this._viewer.getViewer().skyBoxMapManager.loadEquirectangularMap(o,(e=>{this._viewer.getViewer().setDeferBackground(e),this._viewer.getViewer().setRenderStateChanged(!0),this._viewer.getViewer().setDefferBackgroundRotation(new THREE.Euler(0,0,0)),this._viewer.getViewer().render()}))}return}t=this._style}if(0==n.length&&t){o=(i.dataEnvType==BimfaceEnvOption.Local?i.sdkPath:hostConfig.staticHost)+"/resources/SkyBox/Pics/"+t;const e=["posx.jpg","negx.jpg","posy.jpg","negy.jpg","posz.jpg","negz.jpg"];for(var s=0;s<6;++s)n.push(o+"/EnvMap_"+e[s])}e.loadSkyBox(n,!1),e.setSkyBoxType(t)}}}}(),function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Ground");e.GroundConfig=class{constructor(){this.elevation=0,this.viewer=null}}}(),function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();const t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Ground");t.Ground=class{constructor(t){e.send("Bimface.Plugins.Ground.Ground","createGround"),this._color=t.color,this._viewer=t.viewer,this._elevation=t.elevation,this._ground=this._viewer.getViewer().createGround(t),skipVueObserver(this)}destroy(){this._viewer.getViewer().removeGround(),this._ground=null}setElevation(e){this._ground.setElevation(this._viewer.globalUnitUtil.translate(e))}getElevation(){return this._viewer.globalUnitUtil.revertTranslate(this._ground.getElevation())}show(){console.log("This function is not available now")}hide(){console.log("This function is not available now")}update(){console.log("This function is not available now")}setColor(){console.log("This function is not available now")}}}(),Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AuxMobile").AuxMobileConfig=function(){return{editor:null,width:3,viewer:null}},function(){const e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.AuxMobile"),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Web.Lang.Utility.Dom");e.AuxMobile=class{constructor(e){this.viewer=e.viewer,this.touchEndCounts=0,this.editor=e.editor,this.showAuxBall=!1,this.outerCircleRadius=40,this.outerCircleFillStyle="rgba(0, 0, 0, 0.65)",this.outerCircleBorderWidth=4,this.outerCircleBorderColor="#999999",this.innerCircleRadius=20,this.innerCircleFillStyle="rgba(255, 255, 255, 0.8)",this.innerCircleBorderWidth=2,this.ballOuterCircleRadius=40,this.ballOuterCircleFillStyle="rgba(255, 255, 255, 0.3)",this.ballOuterCircleBorderWidth=1,this.ballOuterCircleBorderColor="#999999",this.ballInnerCircleRadius=20,this.ballInnerCircleFillStyle="rgba(255, 255, 255, 0.8)",this.ballInnerCircleBorderWidth=2,this.ballDirectionCircleRadius=4,this.ballDirectionCircleFillStyle="rgba(50, 211, 166, 1)",this.ballDirectionCircleBorderWidth=1,this.triangleWidth=12,this.triangleFillStyle="rgba(0, 0, 0, 0.65)",this.triangleBorderWidth=1,this.triangleBorderColor="#999999";let i=this.canvas=t.create("canvas","bf-aux-mobile"),n=this.viewer.getDomElement();i.width=n.offsetWidth,i.height=n.offsetHeight,this.ctx=i.getContext("2d"),n.append(i),this.initPos()}initPos(){let e={x:this.canvas.width/2,y:this.canvas.height/2};this.draw(this.updateAux(e))}setEditor(e){this.editor=e}updateAux(e){this.center=e;let t={outerCircle:{}};if(t.outerCircle.center=e,this.showAuxBall)t.outerCircle.radius=this.ballOuterCircleRadius,t.innerCircle={},t.innerCircle.center=e,t.innerCircle.radius=this.ballInnerCircleRadius;else{t.outerCircle.radius=this.outerCircleRadius,t.innerCircle={},t.innerCircle.center=e,t.innerCircle.radius=this.innerCircleRadius,t.triangle=[];let i={x:e.x-this.outerCircleRadius,y:e.y-this.outerCircleRadius};t.triangle.push({x:i.x,y:i.y}),t.triangle.push({x:i.x+this.triangleWidth,y:i.y}),t.triangle.push({x:i.x,y:i.y+this.triangleWidth})}return t}draw(e){let t=this.ctx;t.clearRect(0,0,this.canvas.width,this.canvas.height);let i=e.outerCircle;t.strokeStyle=this.outerCircleBorderColor,t.lineWidth=this.outerCircleBorderWidth,t.fillStyle=this.outerCircleFillStyle,t.beginPath(),t.arc(i.center.x,i.center.y,i.radius,0,2*Math.PI,!0),t.fill(),t.stroke();let n=e.innerCircle;t.fillStyle=this.innerCircleFillStyle,t.beginPath(),t.arc(n.center.x,n.center.y,n.radius,0,2*Math.PI,!0),t.fill();let o=e.triangle;t.lineWidth=this.triangleBorderWidth,t.fillStyle=this.triangleFillStyle,t.beginPath(),t.moveTo(o[0].x,o[0].y),t.lineTo(o[1].x,o[1].y),t.lineTo(o[2].x,o[2].y),t.closePath(),t.fill(),t.stroke()}drawBall(e){let t=this.ctx;t.clearRect(0,0,this.canvas.width,this.canvas.height);let i=e.outerCircle;t.strokeStyle=this.ballOuterCircleBorderColor,t.lineWidth=this.ballOuterCircleBorderWidth,t.fillStyle=this.ballOuterCircleFillStyle,t.beginPath(),t.arc(i.center.x,i.center.y,i.radius,0,2*Math.PI,!0),t.fill(),t.stroke();let n=e.innerCircle;t.fillStyle=this.ballInnerCircleFillStyle,t.beginPath(),t.arc(n.center.x,n.center.y,n.radius,0,2*Math.PI,!0),t.fill(),t.lineWidth=this.ballDirectionCircleBorderWidth,t.fillStyle=this.ballDirectionCircleFillStyle,t.beginPath(),t.arc(n.center.x,n.center.y,this.ballDirectionCircleRadius,0,2*Math.PI,!0),t.fill(),t.moveTo(n.center.x-this.ballDirectionCircleRadius-3,n.center.y-this.ballDirectionCircleRadius-2),t.lineTo(n.center.x-this.ballDirectionCircleRadius-13,n.center.y),t.lineTo(n.center.x-this.ballDirectionCircleRadius-3,n.center.y+this.ballDirectionCircleRadius+2),t.closePath(),t.fill(),t.beginPath(),t.moveTo(n.center.x+this.ballDirectionCircleRadius+3,n.center.y-this.ballDirectionCircleRadius-2),t.lineTo(n.center.x+this.ballDirectionCircleRadius+13,n.center.y),t.lineTo(n.center.x+this.ballDirectionCircleRadius+3,n.center.y+this.ballDirectionCircleRadius+2),t.closePath(),t.fill()}getRealPoint(e){let t=this.canvas.getBoundingClientRect(),i=this.outerCircleRadius,n=this.outerCircleRadius;return{x:e.x-i+t.left,y:e.y-n+t.top}}getBallRealPoint(e){let t=this.outerCircleRadius,i=this.outerCircleRadius;return{x:e.x-t,y:e.y-i}}showBall(){let e=this.getBallRealPoint(this.center);this.showAuxBall=!0,this.drawBall(this.updateAux(e))}showCanvas(){this.canvas.style.display="block"}hideCanvas(){this.canvas.style.display="none"}formatPoint(e){let t=this.canvas.getBoundingClientRect();return{x:e.x-t.left,y:e.y-t.top}}onTouchStart(e,t){if(t=this.formatPoint(t),!this.touchOnAux(t))return;this.startPoint=t,e.stopImmediatePropagation(),e.preventDefault(),this.editor.touchStartCallback(t)}onTouchMove(e,t){if(t=this.formatPoint(t),!this.touchOnAux(t))return;e.stopImmediatePropagation(),e.preventDefault();let i=this.editor,n=this.updateAux({x:t.x,y:t.y});if(this.showAuxBall){this.drawBall(n);let e=this.startPoint;i.touchMoveCallback({start:e,end:t})}else{this.draw(n);let e=this.getRealPoint(t);i.touchMoveCallback(e)}}onTouchEnd(e,t,i){if(this.startPoint=null,!t)return;if(t=this.formatPoint(t),!this.touchOnAux(t))return;e.stopImmediatePropagation(),e.preventDefault();let n=this.editor;if(this.showAuxBall)n.touchEndCallback(this.center);else{let e=this.getRealPoint(t);n.touchEndCallback(e)}}vectorAngle(e,t){let i=Math.sqrt(e.reduce(((e,t)=>e+Math.pow(t,2)),0)),n=Math.sqrt(t.reduce(((e,t)=>e+Math.pow(t,2)),0));return Math.acos(e.reduce(((e,i,n)=>e+i*t[n]),0)/(i*n))}getNormal(){let e=this.viewer.getViewer().getScene();return CLOUD.FillClipPlaneManager.getInstance(e).renderClipPlane.normal}getCoordinate(){let e=this.viewer._sectionPlane.coordinateSystem,t=e.getCoordinateAxis();return{start:e.drawingToCanvas(t.start.clone()),endZ:e.drawingToCanvas(t.endZ.clone())}}hide(){this.canvas.style.display="none"}show(){this.canvas.style.display="",this.showAuxBall=!1,this.initPos()}destroy(){this.canvas.remove()}redraw(){if(this.center){let e=this.updateAux(this.center);this.draw(e)}}touchOnAux(e){const{center:t,outerCircleRadius:i,ballOuterCircleRadius:n,showAuxBall:o}=this,s=e;let r=t.x-s.x,a=t.y-s.y;return Math.sqrt(r*r+a*a)<=(o&&n||i)}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ClashDetective");e.ClashDetectivePanelConfig=class{constructor(){this.viewer=null}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ClashDetective"),t=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();e.ClashDetectivePanel=class{constructor(e){t.send("Bimface.Plugins.ClashDetective.ClashDetectivePanel","bf_c_clashDetectivePanel_new");let i=this;if(this._console=new Glodon$1.Web.Common.Console,skipVueObserver(this),!e)return void this._console.error("clashDetectivePanelConfig must not be empty.");if(!e.viewer||"Viewer3D"===!e.viewer.viewerType)return void this._console.error("viewer must not be empty or viewer3d.");this.clashDetectivePanelConfig=e,this.viewer=e.viewer,this.unitType=this.viewer.getUnit(),this.modelUnit=this.unitType;const n=i.viewer.getModels();n.length&&(this.modelUnit="m"===n[0]._manifest.Metadata.Unit?"Meter":"Millimeter"),this.clashResult={},this.currentIndex=0,this.hasModelA=!1,this.hasModelB=!1,this.isIntegrateA=!1,this.isIntegrateB=!1,this.transMultiplyingMap={"Millimeter-Millimeter":1,"Millimeter-Centimeter":.1,"Millimeter-Meter":.001,"Millimeter-Kilometer":1e-7,"Meter-Millimeter":1e3,"Meter-Centimeter":100,"Meter-Meter":1,"Meter-Kilometer":.001},this.bBoxBorderMap={Millimeter:2e3,Centimeter:200,Meter:2,Kilometer:.002};var o=new Glodon$1.Bimface.UI.Panel.PanelConfig;o.title=BimfaceLanguage.bf_panel_clashDetective_clashDetective,o.className="bf-panel clash-detective-panel-wrapper",o.id="clashDetective";let s=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();o.css=s?{right:"10px",top:"10px",width:"300px",height:"416px"}:{left:0,top:0,width:"100%",height:"100%"};var r=new Glodon$1.Bimface.UI.Panel.Panel(o);let a,l;r.addEventListener("Hide",(()=>{this.clearIsolation();let e=document.querySelector(`#itemId_${this.currentIndex}`);e&&e.setAttribute("class","cd-r-list-item"),this.currentIndex=0})),this.clashDetectivePanel=r,this.viewer.clashDetectivePanel=r,this.makeOthersTranslucent=Glodon$1.Bimface.Viewer.IsolateOption.MakeOthersTranslucent,i._updateModelName=function(e){l=i.viewer.getModels().find((e=>e._data.modelId==i.modelIdA)),!l||e!=i.modelIdA&&e!=l.modelId||(i.modelUnit="m"===l._manifest.Metadata.Unit?"Meter":"Millimeter",i.hasModelA=!0,a=document.getElementById("cdModelAName"),a&&(a.setAttribute("class","active"),a.removeAttribute("title"),a.innerText=`${l._data.name}${i.isIntegrateA?"(集成模型)":""}`)),l=i.viewer.getModels().find((e=>e._data.modelId==i.modelIdB)),!l||e!=i.modelIdB&&e!=l.modelId||(i.modelUnit="m"===l._manifest.Metadata.Unit?"Meter":"Millimeter",i.hasModelB=!0,a&&(a=document.getElementById("cdModelBName"),a.setAttribute("class","active"),a.removeAttribute("title"),a.innerText=`${l._data.name}${i.isIntegrateB?"(集成模型)":""}`))},this.viewer.addEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.ModelAdded,this._updateModelName)}setActiveItem(e,t=!1){if(e<=0||this.clashResult&&this.clashResult.results.length&&e>this.clashResult.results.length)return;if(!t){let e=document.querySelector(`#itemId_${this.currentIndex}`);e&&e.setAttribute("class","cd-r-list-item")}let i=this.clashResult.results[e-1],n=document.querySelector(`#itemId_${e}`);n&&n.setAttribute("class","cd-r-list-item active"),this.currentIndex=e,(this.hasModelA||this.hasModelB)&&(this.isolateComponentsById(i),this.zoomToBoundingBox(i.position,this.unitType,this.modelUnit))}zoomToBoundingBox(e,t,i){let n=this.transformToBoundingBox(e,t,i);this.viewer.zoomToBoundingBox(n)}transformToBoundingBox(e,t,i){const n=this.viewer.getGlobalUnit()?1:this.transMultiplyingMap[`${i}-${t}`],o=this.bBoxBorderMap[t];return{max:{x:e.x*n+o,y:e.y*n+o,z:e.z*n+o},min:{x:e.x*n-o,y:e.y*n-o,z:e.z*n-o}}}destroy(){this.clashDetectivePanel.close(),this.clearIsolation(),this.viewer.removeEventListener(Glodon$1.Bimface.Viewer.Viewer3DEvent.ModelAdded,this._updateModelName)}show(){this.clashDetectivePanel.show()}hide(){this.clashDetectivePanel.hide(),this.clearIsolation();let e=document.querySelector(`#itemId_${this.currentIndex}`);e&&e.setAttribute("class","cd-r-list-item"),this.currentIndex=0}setData(e){let t=this;this.clashDetectivePanel.clear(),this.clashResult=e,this.modelIdA=e.selectionA.fileId||e.selectionA.integrateId,this.modelIdB=e.selectionB.fileId||e.selectionB.integrateId,e.selectionA.integrateId&&(this.isIntegrateA=!0),e.selectionB.integrateId&&(this.isIntegrateB=!0);let i=[],n="";e.results.forEach(((e,t)=>{n=`\n <li class="cd-r-list-item" id="itemId_${t+1}">\n <span class="cd-r-list-item-left">${BimfaceLanguage.bf_panel_clashDetective_clash_num}${t+1}:</span>\n <div class="cd-r-list-item-right">\n <p><span>${BimfaceLanguage.bf_panel_clashDetective_componentA}:</span><span>${e.objectIdA}</span></p>\n <p><span>${BimfaceLanguage.bf_panel_clashDetective_componentB}:</span><span>${e.objectIdB}</span></p>\n </div>\n </li>`,i.push(n)}));let o=this.modelIdA,s=this.modelIdB,r=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdA)),a=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdB));r&&(this.hasModelA=!0,o=r._data.name),a&&(this.hasModelB=!0,s=a._data.name);let l=`\n <section class="cd-r-title-wrapper">\n <div class="cd-r-title-item">\n <span>${BimfaceLanguage.bf_panel_clashDetective_modelA}:</span>\n <span id="cdModelAName" class="${this.hasModelA?"active":""}" title="${this.hasModelA?"":"模型未加载"}">\n ${o}${this.isIntegrateA?"(集成模型)":""}\n </span>\n </div>\n <div class="cd-r-title-item">\n <span>${BimfaceLanguage.bf_panel_clashDetective_modelB}:</span>\n <span id="cdModelBName" class="${this.hasModelB?"active":""}" title="${this.hasModelB?"":"模型未加载"}">\n ${s}${this.isIntegrateB?"(集成模型)":""}\n </span>\n </div>\n </section>\n <ul class="cd-r-list-wrapper">\n ${i.join("")}\n </ul>\n `;this.clashDetectivePanel.setHtml(l),this.viewer._opt.domElement.appendChild(this.clashDetectivePanel.element);document.querySelectorAll(".cd-r-list-item").forEach(((e,i)=>{let n=i+1;e.addEventListener("click",(function(){0===t.currentIndex?t.setActiveItem(n,!0):t.currentIndex!==n&&t.setActiveItem(n,!1)}))}))}isolateComponentsById(e){this.clearIsolation();let t=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdA));t&&(t.isolateComponentsById([e.objectIdA,e.objectIdB],this.makeOthersTranslucent),t.overrideComponentsColorById([e.objectIdA],new Glodon$1.Web.Graphics.Color(229,120,115,1)),t.overrideComponentsFrameColor({ids:[[e.objectIdA]]},new Glodon$1.Web.Graphics.Color(255,96,88,1)));let i=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdB));i&&(i.isolateComponentsById([e.objectIdA,e.objectIdB],this.makeOthersTranslucent),i.overrideComponentsColorById([e.objectIdB],new Glodon$1.Web.Graphics.Color(105,205,112,1)),i.overrideComponentsFrameColor({ids:[[e.objectIdB]]},new Glodon$1.Web.Graphics.Color(75,217,82,1))),this.viewer.render()}clearIsolation(){let e=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdA));e&&(e.clearOverrideColorComponents(),e.restoreComponentsFrameColor({all:!0}),e.clearIsolation());let t=this.viewer.getModels().find((e=>e._data.modelId==this.modelIdB));t&&(t.clearOverrideColorComponents(),t.restoreComponentsFrameColor({all:!0}),t.clearIsolation()),this.viewer.render()}}}(),function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance(),t=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ClashDetective");let i=Glodon$1.Web.Lang.Utility.HttpRequest;t.ClashDetectiveManager=class{constructor(t){e.send("Bimface.Plugins.ClashDetective.ClashDetectiveManager","bf_c_clashDetectiveMng_new"),this.viewer=t,this._console=new Glodon$1.Web.Common.Console,skipVueObserver(this)}loadClashDetectiveResult(e,t){let n=this;function o(e){n._console.error(e.message)}i.ajax({url:`${n.viewer._opt.APIHost}/inside/databag?viewToken=${e}`,async:!0,success:function(s){const r=JSON.parse(s);if("success"==r.code){let s=r.data&&r.data.modelId;s&&i.ajax({url:`${n.viewer._opt.APIHost}/data/clashDetective/${s}/result?view_token=${e}`,async:!0,success:function(e){var i=JSON.parse(e);"success"==i.code?t&&t(n.viewer.globalUnitUtil.revertTranslate(i.data,["x","y","z"])):o(i)},failure:e=>{o(JSON.parse(e))}})}else o(r)},failure:e=>{o(JSON.parse(e))}})}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ClearanceHeightCheck");e.ClearanceHeightCheckPanelConfig=class{constructor(){this.clearanceHeightCheckResult=null,this.viewer=null}}}(),function(){var e=Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();let t=Glodon$1.Web.Lang.Utility.HttpRequest;var i=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.ClearanceHeightCheck");i.ClearanceHeightCheckPanel=class{constructor(t){if(e.send("Bimface.Plugins.ClearanceHeightCheck.ClearanceHeightCheckPanel","bf_clearanceHeightCheckPanel_new"),this._console=new Glodon$1.Web.Common.Console,skipVueObserver(this),!t)return void this._console.error("clearanceHeightCheckPanelConfig must not be empty.");if(!t.viewer||"Viewer3D"===!t.viewer.viewerType)return void this._console.error("viewer must not be empty or viewer3d.");this.clearanceHeightCheckPanelConfig=t,this.viewer=t.viewer,this.checkResultData=t.clearanceHeightCheckResult,this.unitType=this.viewer.getUnit(),this.model=this.viewer.getModel(),this.clearanceComponentsList=[],this.clearanceHeightId="",this.nodeData=null;var i=new Glodon$1.Bimface.UI.Panel.PanelConfig;i.title="净空分析",i.className="bf-panel clearance-heightcheck-panel-wrapper",i.id="ClearanceHeightCheck";let n=Glodon$1.Web.Lang.Utility.ClientHelper.getIsDesktop();i.css=n?{right:"10px",top:"10px",width:"440px",height:"530px"}:{left:0,top:0,width:"100%",height:"100%"};var o=new Glodon$1.Bimface.UI.Panel.Panel(i);o.addEventListener("Hide",(()=>{let e=this.getElement().querySelector(`#clrhcItemId_${this.currentIndex}`);e&&e.setAttribute("class","bf-clrhc-list-item"),this.nodeData&&this.nodeData.deselect(),this.clearAllRooms(),this.clearAll(),this.clearSection()})),this.clearanceHeightCheckPanel=o,this.viewer.clearanceHeightCheckPanel=o,this.checkResultData&&this.setData(this.checkResultData),this.defaultComponentsDisplayMode={mode:"default",option:{unqualifiedObjectColor:new Glodon$1.Web.Graphics.Color(255,96,88,.6),qualifiedObjectColor:new Glodon$1.Web.Graphics.Color(75,217,82,.6)}},this.currentComponentsDisplayMode=this.defaultComponentsDisplayMode,this.defaultRoomDisplayMode={mode:"default",option:{qualifiedRoomColor:new Glodon$1.Web.Graphics.Color(255,184,0,.6),qualifiedRoomFrameColor:new Glodon$1.Web.Graphics.Color(255,184,0,1),unqualifiedRoomColor:new Glodon$1.Web.Graphics.Color(88,135,255,.6),unqualifiedRoomFrameColor:new Glodon$1.Web.Graphics.Color(88,135,255,1)}},this.currentRoomDisplayMode=this.defaultRoomDisplayMode,this.roomManager=this.viewer.getRoomManager(),this.componentsUnit="mm"}clearSection(){this._sectionPlane&&this._sectionPlane.exit(),this._sectionPlane=null}zoomToBoundingBox(e){this.viewer.getViewer().zoomToBBox(e,.5,void 0,void 0,1e3)}zoomToArea(e,t,i,n=!1,o){this.clearSection();let s=new THREE.Vector3,r=new THREE.Vector3,a=this.viewer;if(t){let t;var l=1600,h=10;"m"===a.globalUnitUtil.getDefaultUnit()&&(l/=1e3,h/=1e3);const c=(()=>"mm"===a.globalUnitUtil.getDefaultUnit()&&!0===a.getViewer().hasBimtilesModel()?.001:"m"!==a.globalUnitUtil.getDefaultUnit()||a.getViewer().hasBimtilesModel()?1:1e3)();t=i/c+l+h,l*=c;var d=a.getCameraAnimation();a.setCameraAnimation(!1),a.setView(Glodon$1.Bimface.Viewer.ViewOption.Top);let u=a.getViewer().getBoundingBoxWorld();n?this.zoomToBoundingBox(u):this.zoomToBoundingBox(e),a.setCameraAnimation(d);let p=this._sectionPlane=this.makeSectionPlane(a),g=a.getViewer().getScene().getExpandScalar(),m=(new THREE.Box3).setFromCenterAndSize(u.getCenter(s),u.getSize(r).multiplyScalar(g)),f=m.min.z,w=m.max.z;const v=a.getDefaultModel().modelId;let y=100-(t-f)/(w-f)*100;if(o){let e=CLOUD.ExtrudeBodyManager.getInstance(a.getViewer()).getNode(o);if(e){y=100-(t+e.geometry.boundingBox.clone().applyMatrix4(a.getViewer().getModelManager().getModel(v).transformMatrix).min.z-f)/(w-f)*100}}p.setPlane("Z"),p.setDirection("Forward"),p.setProgress(y),p.hidePlane(),CLOUD.GlobalData.ClippingCaps=!0,a.render()}else this.roomManager.hideAllRooms(),a.getModels().forEach((e=>{e.clearIsolation()})),this.clearSection(),a.render()}makeSectionPlane(e){let t=new Glodon$1.Bimface.Plugins.Section.SectionPlaneConfig;return t.viewer=e,t.id="SectionPlane",t.plane=Glodon$1.Bimface.Plugins.Section.SectionPlanePlane.Z,t.direction=Glodon$1.Bimface.Plugins.Section.SectionPlaneDirection.Forward,t.exitSectionBox=!1,new Glodon$1.Bimface.Plugins.Section.SectionPlane(t)}setComponentsDisplayMode(e,t){this.currentComponentsDisplayMode={mode:e,option:t}}getComponentsDisplayMode(){return this.currentComponentsDisplayMode}setRoomsDisplayMode(e,t){this.currentRoomDisplayMode={mode:e,option:t}}getRoomsDisplayMode(){return this.currentRoomDisplayMode}setActiveItem(e,t){if(e<0||this.clearanceComponentsList&&this.clearanceComponentsList.length&&e>this.clearanceComponentsList.length)return;if(this.currentIndex!==e){let e=this.getElement().querySelector(`#clrhcItemId_${this.currentIndex}`);e&&e.setAttribute("class","bf-clrhc-list-item")}let i=this.getElement().querySelector(`#clrhcItemId_${e}`);i&&i.setAttribute("class","bf-clrhc-list-item active"),this.currentIndex=e,this.zoomToObjectById(t)}zoomToObjectById(e){this.viewer.clearSelectedComponents(),this.viewer.setSelectedComponentsById([e]),this.viewer.zoomToSelectedComponents(),this.viewer.render()}isolateComponentsById(e){this.model.isolateComponentsById(e,Glodon$1.Bimface.Viewer.IsolateOption.MakeOthersTranslucent),this.viewer.render()}clearIsolateComponents(){this.model.clearOverrideColorComponents(),this.model.restoreComponentsFrameColor({all:!0}),this.model.clearIsolation(),this.viewer.render()}getElement(){return this.clearanceHeightCheckPanel.element}destroy(){this.clearAll(),this.clearAllRooms(),this.clearanceHeightCheckPanel.close(),this.clearSection()}show(){this.clearanceHeightCheckPanel.show()}hide(){this.clearanceHeightCheckPanel.hide();let e=this.getElement().querySelector(`#clrhcItemId_${this.currentIndex}`);e&&e.setAttribute("class","bf-clrhc-list-item"),this.currentIndex=0}buildSpaceList(e){const t=[];return e.forEach((e=>t.push(...e.space))),t}getSpaceInfoBySpaceId(e){return this.spaceList.find((t=>t.spaceId===e))}setData(e){let t=[];this.clearanceHeightCheckPanel.clear(),this.checkResultData=e,this.clearanceHeightId=e.clearanceHeightId,e.results&&e.results.length&&(t=e.results,this.spaceList=this.buildSpaceList(t));this.clearanceHeightCheckPanel.setHtml('\n <artical class="cleanrance-body-wrapper">\n <section id="cleanranceTreeId" class="cleanrance-body-left bf-scroll-bar">\n </section>\n <section id="cleanranceRoomId" class="cleanrance-body-right">\n </section>\n </artical>\n '),this.viewer._opt.domElement.appendChild(this.getElement()),this.viewer.getFloors((e=>{let i=this.mergeData(t,e),n=this.createTree(i);this.getElement().querySelector("#cleanranceTreeId").appendChild(n.element)})),this.clearAll()}mergeData(e,t){return e.forEach((e=>{let i=t.find((t=>e.levelId===t.id));e.name=i&&i.name||"其它",e.elevation=i.elevation})),e}getDataByPath(e,i,n,o=(()=>{})){t.ajax({url:`${this.viewer._opt.APIHost}/${e}`,type:"POST",data:JSON.stringify(i||{}),headers:{"Content-Type":"application/json"},async:!0,success:e=>{var t=JSON.parse(e);"success"==t.code||"bimfaceservice-0000"===t.code?n&&n(t.data):o(t)},failure:e=>{var t=JSON.parse(e);o(t)}})}setCleanranceRoomData(e){let t=this.viewer._data.viewToken;const i=this.model.getMetaData();let n={fileId:this.viewer._data.modelId};"integrateModel"===i.modelType&&(n={integrateId:this.viewer._data.modelId}),this.getDataByPath(`data/v1/feature-management/spaces/${e.id}/properties?view_token=${t}`,n,(i=>{this.clearAllRooms(),i&&(this.createRoomBySpacesProperties(i),this.viewer.render(),this.zoomToBoundingBox({max:i.bboxMax,min:i.bboxMin})),n={clearanceHeightId:this.clearanceHeightId,spaceId:e.id},this.getDataByPath(`data/v1/feature-management/spaces/clearance-height-check/components-results?view_token=${t}`,n,(e=>{e&&e.object&&e.object.length?(this.clearanceComponentsList=e.object,this.componentsUnit=e.unit||"mm"):this.clearanceComponentsList=[],this.showComponentsByOption(1)}))}))}showComponentsByOption(e){let t=[],i="",n="",o=this.clearanceComponentsList;e&&(o=this.clearanceComponentsList.filter((t=>2===e?t.isQualified:!t.isQualified))),this.overrideColorForComponents(o),o.forEach(((e,n)=>{i=`\n <li class="bf-clrhc-list-item" id="clrhcItemId_${n}">\n <div class="bf-clrhc-list-item-left">\n <p><span>构件ID</span><span>${e.objectId}</span></p>\n <p><span>净高</span><span>${e.clearanceHeight} ${this.nodeData.extData.unit}</span></p>\n </div>\n <span class="bf-clrhc-list-item-right ${e.isQualified?"bf-qlf-yes":"bf-qlf-no"}">\n <span></span>${e.isQualified?"符合":"不符合"}\n </span>\n </li>\n `,t.push(i)})),this.currentComponentsList=o;let s=0,r=0;this.nodeData.extData.clearanceHeight&&(s=this.nodeData.extData.clearanceHeight.toFixed&&this.nodeData.extData.clearanceHeight.toFixed(3)-0),this.nodeData.extData.targetHeight&&(r=this.nodeData.extData.targetHeight.toFixed&&this.nodeData.extData.targetHeight.toFixed(3)-0),n=`\n <div class="cleanrance-body-right-info">\n <span class="cleanrance-title">${this.nodeData.extData.name}</span>\n <div class="cleanrance-value-wrapper">\n <div class="cleanrance-real-hight">\n <span>实际净高 (${this.nodeData.extData.unit})</span>\n <span>${s}</span>\n </div>\n <div class="cleanrance-real-hight">\n <span>目标净高 (${this.nodeData.extData.unit})</span>\n <span>${r}</span>\n </div>\n </div>\n </div>\n <div class="cleanrance-body-right-select-wrapper">\n <span>净高结果</span>\n <div id="cleanranceSelectId" class="select"></div>\n </div>\n <ul class="bf-clrhc-list-wrapper bf-scroll-bar">\n ${t.join("")}\n </ul>\n `,this.getElement().querySelector("#cleanranceRoomId").innerHTML=n,this.createSelect(0===this.currentSelectOption?0:this.currentSelectOption||1);this.getElement().querySelectorAll(".bf-clrhc-list-item").forEach(((e,t)=>{e.addEventListener("click",(()=>{this.setActiveItem(t,o[t].objectId)}))}))}overrideColorForComponents(e){e.forEach((e=>{let t=this.getComponentColorsByCondition({height:e.clearanceHeight,status:e.isQualified,spaceUnit:this.componentsUnit});this.overrideColor(e.objectId,t,t)})),this.viewer.render()}overrideColor(e,t,i){this.model.overrideComponentsColorById([e],t),this.model.overrideComponentsFrameColor({ids:[e]},i)}createSelect(e){var t=new Glodon$1.Bimface.UI.Select.SelectConfig;t.className="bf-select bf-select-clearance",t.options=[{id:0,name:"全部"},{id:1,name:"不符合"},{id:2,name:"符合"}];let i=new Glodon$1.Bimface.UI.Select.Select(t);i.setCurrentOption(e),i.addEventListener("Change",(e=>{this.selectChange(e)})),this.getElement().querySelector("#cleanranceSelectId").appendChild(i.element)}selectChange(e){this.clearAll(),this.currentSelectOption=e.id,this.showComponentsByOption(e.id)}createTreeNode(e){if(e){var t=new Glodon$1.Bimface.UI.Tree.TreeNodeConfig;if(t.isChecked=!1,t.hasCheckbox=!1,t.selection="root"!==e.type,"spaceId"===e.type){var i=new Glodon$1.Bimface.UI.Button.ButtonConfig;i.className="bf-tree-icon bf-qlf-no",e.isQualified&&(i.className="bf-tree-icon bf-qlf-yes"),i.title=BimfaceLanguage.bf_panel_modelTree_transparent;var n=new Glodon$1.Bimface.UI.Button.Button(i);t.icon=n}var o=new Glodon$1.Bimface.UI.Tree.TreeNode(t);return o.type=e.type,o.status=e.status,o.filter=e.type,o.elevation=e.elevation,o.extData=e.space||e.spaceInfo,o.setData(`${e.id}`,e.name),o}}createTree(e){if(!e||0==e.length)return;var t=this.createTreeNode({type:"root",id:"all",name:"全部"});t.expand();var i=new Glodon$1.Bimface.UI.Tree.Tree(t);let n,o;for(let i=0,s=e.length;i<s;i++){n=e[i],n.type="levelId",n.id=n.levelId,n.status=n.isQualified;let s=this.createTreeNode(n);if(t.addChildNode(s),n.space&&n.space.length)for(let e=0,t=n.space.length;e<t;e++)o=n.space[e],o.type="spaceId",o.id=o.spaceId,o.status=o.isQualified,o.name=o.spaceName,o.spaceInfo=o,s.addChildNode(this.createTreeNode(o))}return i.addEventListener("SelectionChanged",((e,t)=>{this.nodeData=e,this.clearAll(!1),this.clearAllRooms(),this.clearSection(),"levelId"===e.type?(this.clearRightContent(),t&&this.createRoomForLevelId(e.id)):"spaceId"===e.type&&(this.currentSelectOption=1,t?this.setCleanranceRoomData(e):this.clearRightContent())})),i}clearAllRooms(){this.roomManager.clearAllRooms(),this.viewer.render()}createRoomForLevelId(e){let t=this.viewer._data.viewToken,i=this.buildSpaceIdListByLevelId(e);const n=this.model.getMetaData();let o={fileId:this.viewer._data.modelId,spaceIdList:i};"integrateModel"===n.modelType&&(o={integrateId:this.viewer._data.modelId,spaceIdList:i}),this.clearAll(),this.getDataByPath(`data/v1/feature-management/spaces/properties?view_token=${t}`,o,(e=>{e&&e.length&&(this.zoomToArea(null,!0,e[0].bboxMax.z,!0,null),e.forEach((e=>{this.createRoomBySpacesProperties(e)})))}))}enableDepthTest(e,t=!1){this.rooms.enableDepthTest([e],t),viewer3D.render()}clearAll(e=!0){this.clearOverrideColor(),this.currentIndex=0,e&&this.clearRightContent()}createRoomBySpacesProperties(e){let t,i,n;t=e.boundary;try{i={outer:t.outer,inner:t.inner};const o=this.getSpaceInfoBySpaceId(e.spaceId);let{roomColor:s,roomFrameColor:r}=this.getRoomColorsByCondition({height:o.clearanceHeight,status:o.isQualified,spaceUnit:o.unit});n={boundary:i,height:e.height,unit:e.unit};let a=new Glodon$1.Bimface.Plugins.Rooms.RoomConfig;a.viewer=this.viewer,a.roomId=e.spaceId,a.geometry=n,a.roomColor=s,a.frameColor=r;const l=new Glodon$1.Bimface.Plugins.Rooms.Room(a);this.roomManager.addRoom(l),this.viewer.render()}catch(t){console.warn(`Invalid room boundary [spaceId: ${e.spaceId}]!`)}}getComponentColorsByCondition(e){let{height:t,status:i,spaceUnit:n}=e;const o=this.getComponentsDisplayMode(),{mode:s}=o;let r;if("byStatus"===s||"default"===s)r=i?o.option.qualifiedObjectColor:o.option.unqualifiedObjectColor;else if("byHeight"===s){const e=o.option.unit;let i=o.option.colorList;t=this.viewer.globalUnitUtil.excute(t,n,e);const s=i.find((e=>t>=e.heightRange[0]&&t<e.heightRange[1]));s&&(r=s.color)}return r||(r=this.defaultComponentsDisplayMode.option.unqualifiedObjectColor),r}getRoomColorsByCondition(e){let{height:t,status:i,spaceUnit:n}=e;const o=this.getRoomsDisplayMode(),{mode:s}=o;let r,a;if("byStatus"===s||"default"===s)i?(r=o.option.qualifiedRoomColor,a=o.option.qualifiedRoomFrameColor):(r=o.option.unqualifiedRoomColor,a=o.option.unqualifiedRoomFrameColor);else if("byHeight"===s){const e=o.option.unit;let i=o.option.colorList;t=this.viewer.globalUnitUtil.excute(t,n,e);const s=i.find((e=>t>=e.heightRange[0]&&t<e.heightRange[1]));s&&(r=s.roomColor,a=s.roomFrameColor)}return r&&a||(r=this.defaultRoomDisplayMode.option.unqualifiedRoomColor,a=this.defaultRoomDisplayMode.option.unqualifiedRoomFrameColor),{roomColor:r,roomFrameColor:a}}transferBoundary(e,t=!1){const i=[];return e?(t?e.forEach((e=>{let t=[];e.forEach((e=>t.push([e.x-0,e.y-0,e.z-0]))),i.push(t)})):e.forEach((e=>i.push([e.x-0,e.y-0,e.z-0]))),i):i}buildSpaceIdListByLevelId(e){let t=[],i=this.checkResultData.results.find((t=>t.levelId===e));return i&&i.space&&i.space.forEach((e=>{t.push(e.spaceId)})),t}clearRightContent(){this.getElement().querySelector("#cleanranceRoomId").innerHTML='<span class="gld-bimface gld-bf-information"><span>请选择对应空间</span></span>'}clearOverrideColor(){this.viewer.clearSelectedComponents(),this.model.clearOverrideColorComponents(),this.model.restoreComponentsFrameColor({all:!0}),this.viewer.render()}}}(),function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");e.Room=class{constructor(e){this.viewer=e.viewer,this.roomId=e.roomId,this.modelId=e.modelId,this.geometry=e.geometry,this.roomColor=e.roomColor,this.frameColor=e.frameColor,this.enableSelected=e.enableSelected,this.console=this.viewer.console,this.isValid=!0,this.unit=null,e.geometry.unit?this.unit="m"==e.geometry.unit||"Meter"==e.geometry.unit?"m":"mm":this.unit=this.viewer.globalUnitUtil.getGlobalUnit(),skipVueObserver(this),this.toleranceType={STRICT:"STRICT",ORDINARY:"ORDINARY",LENIENT:"LENIENT"},this.tolerence=.25;let t=this.geometry.boundary,i=this.geometry.grid,n=this.geometry.height,o=this.geometry.offset;if(t){if("String"===Object.prototype.toString.call(t).slice(8,-1)&&(t=JSON.parse(t)),t.outer){let e=[];if(t.outer.map((t=>{e.push([Number(t.x),Number(t.y),Number(t.z)])})),t.inner&&t.inner.length>0){let i=[];t.inner.map((e=>{let t=[];e.map((e=>{t.push([Number(e.x),Number(e.y),Number(e.z)])})),i.push(t)})),t=this.viewer.createBoundary(e,i)}else t=this.viewer.createBoundary(e)}}else if(i){let e=i.ids,n=i.fileId;const o=this.viewer.getViewer().getScene(),s=this.modelId||this.viewer.getDefaultModel().modelId;n&&n!=s||(n="default");const r=CLOUD.AxisGridManager.getInstance(o,s);if(!r.mapFileIdGridjson[n])return this.console.warn("createRoomByAxisGrids - 请先加载对应轴网,再调用接口."),void(this.isValid=!1);let a=r.getPartitionByAxisGrids(n,e),l=[],h=(new THREE.Matrix4).fromArray(this.viewer.getModel(s)._getModelTransformation()).invert();for(let e=0;e<a.length;e++)l.push(a[e].clone().applyMatrix4(h));a=l;let d=[];if(!(a&&a.length>0))return this.console.warn("createRoomByAxisGrids - 所选轴线未形成闭合区域,或传入了多余轴线."),void(this.isValid=!1);{a.forEach((e=>{d.push([e.x,e.y,e.z])}));let e=this.viewer.createBoundary(d),i=this.viewer.globalUnitUtil.getDefaultUnit(),n=this.unit;t=this.viewer.globalUnitUtil.excute(e,i,n,["offsetZ","x","y","z"])}}if(n)n=n;else if(o&&o.length>=2){var s=o[0];n=o[1]-o[0];var r=t.clone?t.clone():JSON.parse(JSON.stringify(t));if(t.roomInnerBoundary&&(r.roomInnerBoundary=JSON.parse(JSON.stringify(t.roomInnerBoundary))),r.loops&&r.loops.length>0)for(var a=r.loops[0],l=a.length,h=0;h<l;++h)for(var d=a[h].length,c=0;c<d;++c)a[h][c].z+=s;else r.offsetZ+=s;t=r}t=this.translateForUnit(t,["offsetZ","x","y","z"]),n=this.translateForUnit(n);var u=this.roomId||Glodon$1.Web.Lang.Utility.UUID.createUUID();this.roomId=u;var p=this.roomColor||new Glodon$1.Web.Graphics.Color(3,71,177,.4),g=this.frameColor||new Glodon$1.Web.Graphics.Color(3,71,177,1);this.roomInfo={faceColor:p,frameColor:g,id:u,boundary:t,offset:[t.offsetZ||0,(t.offsetZ||0)+n],height:n,enableSelected:this.enableSelected}}bindRoomByModelId(e){if(!e||!this.viewer.getModel(e))return void this.console.warn(`Invalid modelId [${e}]`);const t=this.viewer.getViewer(),i=CLOUD.ExtrudeBodyManager.getInstance(t);if(!i.getNode(this.roomId))return void this.console.warn(`Invalid roomId [${this.roomId}]`);let n=i.getBindedModelId(this.roomId);n&&i.unbindModel(this.roomId,n),i.bindModel(this.roomId,e),this.modelId=e,this.viewer.render()}enableDepthTest(e){const t=this.viewer.getViewer();CLOUD.ExtrudeBodyManager.getInstance(t).enableDepthTest([this.roomId],e),this.viewer.render()}getArea(){let e={id:this.roomId,unit:"m2",value:null},t=this.getCustomizedRoom().roomBoundary,i=this.viewer._opt.unit||this.viewer.getDefaultUnit();return e.value=Math.abs(THREE.ShapeUtils.area(t)),"Meter"!==this.viewer.globalUnitUtil.unitMap[i]&&(e.unit="mm2"),e}getOldBoundary(){let e=new Array,t=this.getCustomizedRoom().roomBoundary,i=this.getCustomizedRoom().offsetZ;for(let n=0,o=t.length;n<o;n++){let o=new Array;o.push(t[n].x),o.push(t[n].y),o.push(i),e.push(o)}return e}getBoundary(){let e={},t=this.getCustomizedRoom().roomBoundary,i=this.getCustomizedRoom().offsetZ,n=[];for(let e=0,o=t.length;e<o-1;e++)n.push({x:t[e].x,y:t[e].y,z:i});e.outer=n;let o=this.getCustomizedRoom().roomInnerBoundary;if(o&&o.length>0){let t=[];o.map((e=>{let n=[];for(let t=0;t<e.length-1;t++)n.push({x:e[t].x,y:e[t].y,z:i});t.push(n)})),e.inner=t}return e}getComponents(e,t,i){null==e&&(e=this.toleranceType.ORDINARY),null==t&&(t=this.toleranceType.STRICT);let n=[],o=this.getAllComponentIds();for(const i in o)for(const s of o[i]){let o=this.viewer.globalUnitUtil.revertBBox(this.viewer.getViewer().getComponentInfoByUserId(s,i).boundingBox);this.roomContains(o,e,t)&&n.push(s)}return i&&i(n),n}getHeight(){return this.roomInfo.height}getRoomColor(){var e=this.viewer.getViewer(),t=CLOUD.ExtrudeBodyManager.getInstance(e).getNodeColorById(this.roomId);return new Glodon$1.Web.Graphics.Color(t.red,t.green,t.blue,t.alpha)}getRoomFrameColor(){var e=this.viewer.getViewer(),t=CLOUD.ExtrudeBodyManager.getInstance(e).getWireframeColorById(this.roomId);return new Glodon$1.Web.Graphics.Color(t.red,t.green,t.blue,t.alpha)}getProperty(e){let t=this.modelId||this.viewer.getDefaultModel().modelId;this.viewer.getModel(t)._getMetaDataManager().getRoomProperty(this.roomId,(t=>{t?(t.boundary&&(t.boundary=JSON.parse(t.boundary)),t=this.viewer.globalUnitUtil.revertTranslate(t,["area","x","y","z","perimeter"]),(t=this.viewer.globalUnitUtil.revertTranslate(t,["area"])).boundary=JSON.stringify(t.boundary),e&&e(t)):e&&e(t)}))}isPointInside(e,t){!1!==t&&(t=!0);let{roomBoundary:i,roomInnerBoundary:n}=this.getCustomizedRoom(),o=[],s=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).getBindedModelId(this.roomId),r=this.viewer.getViewer().getModelManager().getModel(s).transformMatrix.clone(),a=new THREE.Vector3,l=new THREE.Quaternion,h=new THREE.Vector3;r.decompose(a,l,h),a=this.viewer.globalUnitUtil.revertVector(a),r.compose(a,l,h);for(let e=0;e<i.length;e++){let t=new THREE.Vector3(i[e].x,i[e].y,0).clone().applyMatrix4(r);o.push({x:t.x,y:t.y})}if(i=o,n&&newInnerBoundary.length>0){let e=[];for(let t=0;t<n.length;t++){let i=[];for(let e=0;e<n[t].length;e++){let o=new THREE.Vector3(n[t][e].x,n[t][e].y,0).clone().applyMatrix4(r);i.push({x:o.x,y:o.y})}e.push(i)}n=e}if(!this.containsInBoundary(e,i,t))return!1;if(n&&n.find((i=>this.containsInBoundary(e,i,t))))return!1;let d=Number(e.z.toFixed(10)),c=this.getRoomBoundingBox(),u=Number(c.min.z.toFixed(10)),p=Number(c.max.z.toFixed(10));return t?d>u&&d<p:d>=u&&d<=p}setBoundary(e,t){if(!this.roomManager)return;this.roomManager.clearRoomsById([this.roomId],!1);if("String"===Object.prototype.toString.call(e).slice(8,-1)&&(e=JSON.parse(e)),e.outer){let t=[];if(e.outer.map((e=>{t.push([e.x,e.y,e.z])})),e.inner&&e.inner.length>0){let i=[];e.inner.map((e=>{let t=[];e.map((e=>{t.push([e.x,e.y,e.z])})),i.push(t)})),e=this.viewer.createBoundary(t,i)}else e=this.viewer.createBoundary(t)}t&&(this.unit="m"==t?"m":"mm",e=this.translateForUnit(e,["offsetZ","x","y","z"])),this.roomInfo.boundary=e,this.roomInfo.offset=[e.offsetZ||0,(e.offsetZ||0)+this.roomInfo.height],this.roomManager.addRoom(this),CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).applySelection(),this.viewer.render(),this.roomModelManager&&this.updateSolidInfo()}setHeight(e,t){if(!this.roomManager)return;this.roomManager.clearRoomsById([this.roomId],!1),t&&(this.unit="m"==t?"m":"mm",e=this.translateForUnit(e));let i=this.roomInfo.boundary.offsetZ;this.roomInfo.height=e,this.roomInfo.offset=[i||0,(i||0)+e],this.roomManager.addRoom(this),CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).applySelection(),this.viewer.render(),this.roomModelManager&&this.updateSolidInfo()}setRoomColor(e){var t=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()),i=t.createMaterial({color:parseInt(e.getHEX(),16),transparent:!0,opacity:e.getAlpha()});this.roomInfo.faceColor=e;var n=t.createMaterial({color:parseInt(this.roomInfo.frameColor.getHEX(),16),opacity:this.roomInfo.frameColor.getAlpha()});t.setNodeMaterial(this.roomId,i,n),this.viewer.render(),this.roomModelManager&&this.updateSolidInfo()}setRoomFrameColor(e){var t=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()),i=t.createMaterial({color:parseInt(this.roomInfo.faceColor.getHEX(),16),transparent:!0,opacity:this.roomInfo.faceColor.getAlpha()}),n=t.createMaterial({color:parseInt(e.getHEX(),16),opacity:e.getAlpha()});this.roomInfo.frameColor=e,t.setNodeMaterial(this.roomId,i,n),this.viewer.render(),this.roomModelManager&&this.updateSolidInfo()}updateSolidInfo(e){const t=e?"Meter"==e.unit||"m"==e.unit?"m":"mm":this.unit?"Meter"==this.unit||"m"==this.unit?"m":"mm":"Meter"==this.viewer.globalUnitUtil.getGlobalUnit()||"m"==this.viewer.globalUnitUtil.getGlobalUnit()?"m":"mm",i={modelId:this.modelId,modelType:this.viewer.getModel(this.modelId)._data.modelType,sectionId:this.roomId,conditions:e?e.conditions:this.conditions,section:{id:this.roomId,name:e?e.name:this.name,unit:t,color:e?e.color:this.getRoomColor(),frameColor:e?e.frameColor:this.getRoomFrameColor(),geometry:{type:"extrusion",height:e?e.height:this.getHeight(),boundary:e?e.boundary:[{lineType:"Line",points:this.getBoundary().outer}]}}};this._solidInfo=i}translateForUnit(e,t){if(this.unit){let i=this.viewer.globalUnitUtil.getGlobalUnit();return this.viewer.globalUnitUtil.excute(e,this.unit,i,t)}return e}getAllComponentIds(){return this.viewer.getViewer().getAllModelUserIds()}getCustomizedRoom(){let e=this.roomInfo;if(e.boundary&&"user"!=e.boundary.belong){let t=[],i=[],n=e.boundary;for(let e=0;e<n.loops.length;e++){let o=n.loops[e],s=[];for(const e of o)s.push([e[0].x,e[0].y,e[0].z]);0==e?t=s:s.length>2&&i.push(s)}let o=this.viewer.createBoundary(t,i);return o.offset=[o.offsetZ,o.offsetZ+e.height],o}return e.boundary.offset=e.offset,e.boundary}isContainsObjectId(e,t,i){null==t&&(t=this.toleranceType.ORDINARY),null==i&&(i=this.toleranceType.STRICT);let n=this.viewer.globalUnitUtil.revertBBox(this.viewer.getViewer().getComponentInfoByUserId(e).boundingBox);return this.roomContains(n,t,i)}roomContains(e,t,i){let n=this.isRoomContainBoundingBoxByZ(e,i);if(0==n)return n;let o=this.isRoomBoundingBoxContainBoundingBoxByXY(e,t);if(0==o)return o;let s=this.isRoomBoundaryContainBoundingBoxByXY(e,t);return 0!=s||s}isRoomContainBoundingBoxByZ(e,t){let i=this.getRoomBoundingBox(),n=i.min.z,o=i.max.z,s=e.max.z,r=e.min.z,a=this.tolerence,l=this.viewer._opt.unit||this.viewer.getDefaultUnit();if("Meter"===this.viewer.globalUnitUtil.unitMap[l]&&(a/=1e3),t==this.toleranceType.STRICT)return r>=n-a&&s<=o+a;if(t==this.toleranceType.ORDINARY){let e=(r+s)/2;return this.isBetween(e,n,o)&&(this.isBetween(r,n,o)||this.isBetween(s,n,o))}return t==this.toleranceType.LENIENT?r<=o+a&&s>=n-a:void 0}isRoomBoundingBoxContainBoundingBoxByXY(e,t){let i=this.getRoomBoundingBox(),n=i.min.x,o=i.max.x,s=i.min.y,r=i.max.y,a=e.min.x,l=e.max.x,h=e.min.y,d=e.max.y,c=this.tolerence,u=this.viewer._opt.unit||this.viewer.getDefaultUnit();return"Meter"===this.viewer.globalUnitUtil.unitMap[u]&&(c/=1e3),t==this.toleranceType.STRICT?a>=n-c&&l<=o+c&&h>=s-c&&d<=r+c:t==this.toleranceType.ORDINARY||t==this.toleranceType.LENIENT?a<=o+c&&l>=n-c&&h<=r+c&&d>=s-c:void 0}isRoomBoundaryContainBoundingBoxByXY(e,t){let i=this.toFivePos(e),n=this.getCustomizedRoom().roomBoundary,o=[],s=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).getBindedModelId(this.roomId);for(let e=0;e<n.length;e++){let t=this.viewer.getViewer().getModelManager().getModel(s).transformMatrix.clone(),i=new THREE.Vector3,r=new THREE.Quaternion,a=new THREE.Vector3;t.decompose(i,r,a),i=this.viewer.globalUnitUtil.revertVector(i),t.compose(i,r,a);let l=new THREE.Vector3(n[e].x,n[e].y,0).clone().applyMatrix4(t);o.push({x:l.x,y:l.y})}n=o;let r=0;for(let e=0;e<i.length;e++){const t=i[e];this.containsInBoundary(t,n)&&r++}let a=!1;return t==this.toleranceType.STRICT?a=5==r:t==this.toleranceType.ORDINARY?a=r>=3:t==this.toleranceType.LENIENT&&(a=r>=1),a}getRoomBoundingBox(){let e=this.getCustomizedRoom(),t=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).getBindedModelId(this.roomId),i=e.boundingBox,n=e.offset;i.min.z=n[0],i.max.z=n[1];let o=this.viewer.getViewer().getModelManager().getModel(t).transformMatrix.clone(),s=new THREE.Vector3,r=new THREE.Quaternion,a=new THREE.Vector3;return o.decompose(s,r,a),s=this.viewer.globalUnitUtil.revertVector(s),o.compose(s,r,a),(new THREE.Box3).setFromPoints([new THREE.Vector3(i.min.x,i.min.y,i.min.z),new THREE.Vector3(i.max.x,i.max.y,i.max.z)]).clone().applyMatrix4(o)}toFivePos(e){let t=[];return t.push(new THREE.Vector2(e.min.x,e.min.y)),t.push(new THREE.Vector2(e.max.x,e.min.y)),t.push(new THREE.Vector2(e.max.x,e.max.y)),t.push(new THREE.Vector2(e.min.x,e.max.y)),t.push(new THREE.Vector2((e.min.x+e.max.x)/2,(e.min.y+e.max.y)/2)),t}containsInBoundary(e,t,i){let n=!1;for(let i=0;i<t.length-1;i++)if(this.isOnSegment(e,t[i],t[i+1])){n=!0;break}if(n)return!i;for(var o=e.x,s=e.y,r=!1,a=0,l=t.length-1;a<t.length;l=a++){var h=t[a].x||t[a][0],d=t[a].y||t[a][1],c=t[l].x||t[l][0],u=t[l].y||t[l][1];d>s!=u>s&&o<(c-h)*(s-d)/(u-d)+h&&(r=!r)}return r}isOnSegment(e,t,i){if(e.x>Math.max(t.x,i.x)||e.x<Math.min(t.x,i.x))return!1;if(e.y>Math.max(t.y,i.y)||e.y<Math.min(t.y,i.y))return!1;if(t.x!=i.x){let n=(i.y-t.y)/(i.x-t.x),o=i.y-n*i.x;if(n*e.x+o==e.y)return!0}else if(e.x==t.x)return!0;return!1}isBetween(e,t,i){let n=this.tolerence;return e<=i+n&&e>=t-n}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");e.RoomConfig=class{constructor(){this.viewer=null,this.roomId=null,this.modelId=null,this.geometry=null,this.roomColor=null,this.frameColor=null,this.enableSelected=!0}}}(),function(){Glodon$1.Bimface.Data.StatisticsDataManager.getInstance();var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");e.RoomManager=class{constructor(e){if(this.viewer=e.viewer,this.viewer.roomManager&&!e.modelMode)return this.viewer.roomManager;this.rooms=[],!e.modelMode&&(this.viewer.roomManager=this),skipVueObserver(this)}addRoom(e){let t=!1;for(let i=0;i<this.rooms.length;i++)if(this.rooms[i].roomId==e.roomId){t=!0;break}if(t)return;if(!e.isValid)return;var i=CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer());let{id:n,boundary:o,height:s,faceColor:r,frameColor:a,enableSelected:l}={...e.roomInfo};this.setRoomSelectableById([n],l);var h=i.createMaterial({color:parseInt(r.getHEX(),16),transparent:!0,opacity:r.getAlpha()}),d=i.createMaterial({color:parseInt(a.getHEX(),16),opacity:a.getAlpha()});let c=this.viewer.globalUnitUtil.translate(o,["offsetZ","x","y","z"]),u=this.viewer.globalUnitUtil.translate(s);i.addNode(n,c,u,h,d),c.offsetZ&&(o.offsetZ=this.viewer.globalUnitUtil.revertTranslate(c.offsetZ));let p=e.modelId||this.viewer.getDefaultModel().modelId;i.bindModel(n,p),this.viewer.getViewer().modelManager.updateSceneBoundingBox(),this.viewer.updateSceneBoundingBox(!1),this.rooms.push(e),e.roomManager=this}clearAllRooms(){var e=this.viewer.getViewer();CLOUD.ExtrudeBodyManager.getInstance(e).clearNodes(),this.rooms=[]}clearRoomsById(e,t=!0){var i=this.viewer.getViewer(),n=CLOUD.ExtrudeBodyManager.getInstance(i);if(e&&e.length>0)for(var o=0;o<e.length;o++){if(t){const t=this.getRoomById(e[o]);t&&t.drawTool&&(t.solidToolbar&&t.solidToolbar.getEventManager()&&t.solidToolbar.getEventManager().fireEvent("Deleted",t),t.drawTool.exit())}n.removeNodeById(e[o]);for(let t=0;t<this.rooms.length;t++)if(e[o]==this.rooms[t].roomId){this.rooms.splice(t,1);break}}}getAllRooms(){return[].concat(this.rooms)}getRoomById(e){let t=null;for(let i=0;i<this.rooms.length;i++)if(this.rooms[i].roomId==e){t=this.rooms[i];break}return t}getRoomsByComponentId(e,t,i,n){let o=[],s=this.rooms;for(let n=0;n<s.length;n++)s[n].isContainsObjectId(e,t,i)&&o.push(s[n]);return n&&n(o),o}hideAllRooms(){var e=this.viewer.getViewer();CLOUD.ExtrudeBodyManager.getInstance(e).hideAllNodes()}hideRoomsById(e){var t=this.viewer.getViewer(),i=CLOUD.ExtrudeBodyManager.getInstance(t);if(e&&e.length>0)for(var n=0;n<e.length;n++){i.setNodeVisibleById(e[n],!1);const t=this.getRoomById(e[n]);t&&t.drawTool&&t.drawTool.hide()}}showAllRooms(){var e=this.viewer.getViewer();CLOUD.ExtrudeBodyManager.getInstance(e).showAllNodes()}showRoomsById(e){var t=this.viewer.getViewer(),i=CLOUD.ExtrudeBodyManager.getInstance(t);if(e&&e.length>0)for(var n=0;n<e.length;n++){i.setNodeVisibleById(e[n],!0);const t=this.getRoomById(e[n]);t&&t.drawTool&&t.drawTool.show()}}setRoomSelectableById(e,t){if(!Array.isArray(e))return;CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).setRoomSelectableById(e,t)}getRoomSelectableById(e){return CLOUD.ExtrudeBodyManager.getInstance(this.viewer.getViewer()).getRoomSelectableById(e)}update(){}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");e.RoomManagerConfig=class{constructor(){this.viewer=null}}}(),function(){var e=Glodon$1.Web.Lang.Utility.Namespace.ensureNamespace(Glodon$1,"Bimface.Plugins.Rooms");class t extends Glodon$1.Bimface.Plugins.Rooms.RoomManager{constructor(e){super(e),this.modelRooms=[],this.modelId=e.modelId,this.config=e,this.viewer=e.viewer,this.viewerManager=e.viewer.getRoomManager(),skipVueObserver(this)}initRooms(e){if(!e)return;const t=this;e.map((e=>{e.modelId==t.modelId&&e.sections.map((i=>{const n=t.modelRooms.find((e=>e.roomId==i.id));if(n)return delete n.roomModelManager,n.setBoundary({outer:i.geometry.boundary[0].points}),n.setHeight(i.geometry.height),n.setRoomColor(new Glodon$1.Web.Graphics.Color(i.color.red,i.color.green,i.color.blue,i.color.alpha)),n.setRoomFrameColor(new Glodon$1.Web.Graphics.Color(i.frameColor.red,i.frameColor.green,i.frameColor.blue,i.frameColor.alpha)),void(n.roomModelManager=t);const o=new Glodon$1.Bimface.Plugins.Rooms.RoomConfig;o.viewer=t.viewer,o.roomId=i.id,o.modelId=t.modelId,o.geometry={type:"extrusion",boundary:{outer:i.geometry.boundary[0].points},height:i.geometry.height,unit:i.unit},o.roomColor=new Glodon$1.Web.Graphics.Color(i.color.red,i.color.green,i.color.blue,i.color.alpha),o.frameColor=new Glodon$1.Web.Graphics.Color(i.frameColor.red,i.frameColor.green,i.frameColor.blue,i.frameColor.alpha);const s=new Glodon$1.Bimface.Plugins.Rooms.Room(o);s.name=i.name,s.conditions=e.conditions,t.addRoom(s),s.roomModelManager=t}))}))}addRoom(e){this.modelRooms.push(e),this.viewerManager.addRoom(e),e.bindRoomByModelId(this.modelId)}getAllRoomIds(){return this.modelRooms.map((e=>e.roomId))}getAllRooms(){return this.modelRooms}hideAllRooms(){const e=this.getAllRoomIds();this.viewerManager.hideRoomsById(e)}showAllRooms(){const e=this.getAllRoomIds();this.viewerManager.showRoomsById(e)}clearAllRooms(){const e=this.getAllRoomIds();this.viewerManager.clearRoomsById(e)}clearRoomsById(e){this.viewerManager.clearRoomsById(e)}getRoomById(e){return this.viewerManager.getRoomById(e)}getRoomsByComponentId(e,t,i,n){return this.viewerManager.getRoomsByComponentId(e,t,i,n)}hideRoomsById(e){this.viewerManager.hideRoomsById(e)}showRoomsById(e){this.viewerManager.showRoomsById(e)}convertToClipperData(e){const t="Meter"==this.viewer.getGlobalUnit();return e.map((e=>{e.X=t?1e3*e.x:e.x,e.Y=t?1e3*e.y:e.y})),e}reConvertClipperData(e,t){const i="Meter"==this.viewer.getGlobalUnit();return e.map((e=>{e.x=i?e.X/1e3:e.X,e.y=i?e.Y/1e3:e.Y,e.z=t.getBoundary().outer[0].z})),e}loadAndCalculateOverLap(e,t){this.calculateOverlapArea(e,t)}calculateOverlapArea(e,t="plus"){const i=this.viewerManager.getRoomById(e);this.modelRooms.filter((e=>Math.abs(e.getBoundary().outer[0].z-i.getBoundary().outer[0].z)<1e-4)).map((n=>{if(n.roomId!==e){let e,o,s=new ClipperLib.Paths;"minus"==t?(e=this.convertToClipperData(n.getBoundary().outer),o=this.convertToClipperData(i.getBoundary().outer)):(o=this.convertToClipperData(n.getBoundary().outer),e=this.convertToClipperData(i.getBoundary().outer));const r=new ClipperLib.Clipper;r.AddPath(e,ClipperLib.PolyType.ptSubject,!0),r.AddPath(o,ClipperLib.PolyType.ptClip,!0),r.Execute(ClipperLib.ClipType.ctDifference,s,ClipperLib.PolyFillType.pftNonZero,ClipperLib.PolyFillType.pftNonZero),"minus"==t?n.setBoundary({outer:this.reConvertClipperData(s[0],n)},this.config.unit):i.setBoundary({outer:this.reConvertClipperData(s[0],n)},this.config.unit)}}))}}e.RoomModelManager=t}(),window.Glodon=Glodon$1;