UNPKG

cbim-render-webgl-sdk

Version:

渲染SDK-WebGL版本

2 lines 22.7 kB
/*! For license information please see tree.worker.js.LICENSE.txt */ !function(){var e=function(){function e(e,n,r){return(n=function(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(){"use strict";n=function(){return r};var e,r={},a=Object.prototype,o=a.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var a=t&&t.prototype instanceof b?t:b,o=Object.create(a.prototype),u=new k(r||[]);return i(o,"_invoke",{value:R(e,n,u)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=d;var v="suspendedStart",y="suspendedYield",h="executing",m="completed",g={};function b(){}function x(){}function I(){}var N={};f(N,s,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(M([])));E&&E!==a&&o.call(E,s)&&(N=E);var j=I.prototype=b.prototype=Object.create(N);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,n){function r(a,i,u,s){var l=p(e[a],e,i);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==t(f)&&o.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,u,s)}),(function(e){r("throw",e,u,s)})):n.resolve(f).then((function(e){c.value=e,u(c)}),(function(e){return r("throw",e,u,s)}))}s(l.arg)}var a;i(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,a){r(e,t,n,a)}))}return a=a?a.then(o,o):o()}})}function R(t,n,r){var a=v;return function(o,i){if(a===h)throw Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var s=D(u,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===v)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var l=p(t,n,r);if("normal"===l.type){if(a=r.done?m:y,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(a=m,r.method="throw",r.arg=l.arg)}}}function D(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,D(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=p(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function U(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function M(n){if(n||""===n){var r=n[s];if(r)return r.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var a=-1,i=function t(){for(;++a<n.length;)if(o.call(n,a))return t.value=n[a],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(t(n)+" is not iterable")}return x.prototype=I,i(j,"constructor",{value:I,configurable:!0}),i(I,"constructor",{value:x,configurable:!0}),x.displayName=f(I,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,I):(e.__proto__=I,f(e,c,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},L(P.prototype),f(P.prototype,l,(function(){return this})),r.AsyncIterator=P,r.async=function(e,t,n,a,o){void 0===o&&(o=Promise);var i=new P(d(e,t,n,a),o);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},L(j),f(j,c,"Generator"),f(j,s,(function(){return this})),f(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},r.values=M,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(U),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,a){return u.type="throw",u.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),l=o.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),U(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;U(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},r}function r(e,t,n,r,a,o,i){try{var u=e[o](i),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,a)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var i=e.apply(t,n);function u(e){r(i,a,o,u,s,"next",e)}function s(e){r(i,a,o,u,s,"throw",e)}u(void 0)}))}}var o,i,u,s=4186316022,l=[s,781010003,2655215786,3242617779,919958153,1307041759],c=function(){var e=a(n().mark((function e(t){var r,a,s=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]&&s[1],a={tree:{elementId:!0,uuid:!0,name:!0,familyName:!0,majorParentUuid:!0,floorParentUuid:!0,typeParentUuid:!0,systemUuid:!0},attrs:{name:!0,uuid:!0}},o=new self.zango.Db(t,1,a),e.next=6,o.collection("tree");case 6:return i=e.sent,e.next=9,o.collection("attrs");case 9:if(u=e.sent,!r){e.next=13;break}return e.next=13,o.drop();case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),f=function(){o.close(),self.close()},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=[];try{if("其他"in e){var a=e["其他"];delete e["其他"],e["其他"]=a}if("其它"in e){var o=e["其它"];delete e["其它"],e["其它"]=o}return p(e,r,t,n,0),r}catch(t){return console.error("属性解析失败",t,e),{}}},p=function(e,n,r,a){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(var i in e)if("object"!=t(e[i])||"value"in e[i]){var u=void 0;u="object"===t(e[i])?{name:e[i].name||i,value:e[i].value,type:e[i].type||"NORMAL"}:{name:i,value:e[i],type:a?"CATEGORY":"NORMAL"},"revit_id"===i&&(u.value=r),o>0?n.push(u):n.push({name:i,children:[u]})}else{var s=[];p(e[i],s,r,a,o+1),Object.keys(s).length&&n.push({name:i,children:s}),"revit_id"===i&&s.forEach((function(e){e.value=r}))}},v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];for(var a in e)r.push(e[a]);var i=h(r);return new Promise((function(e){u.insert({uuid:"ifcAttr",data:r}).finally((function(){console.log("ifc属性保存完成"),o.close();var a=[];n?(r.filter((function(e){return 3124254112===e.type})).forEach((function(e){var n,o;a.push({floorParentUuid:"root",uuid:e.expressID,name:(null===(n=e.Name)||void 0===n?void 0:n.value)||"",modelId:t,isIFC:!0,attributes:{familyName:(null===(o=e.Name)||void 0===o?void 0:o.value)||""}});var i=r.find((function(t){return t.RelatingStructure&&t.RelatingStructure.value==e.expressID}));i&&i.RelatedElements.forEach((function(n){var o=r.find((function(e){return e.expressID==n.value}));if(o){var i,u,s=r.find((function(e){return e.RelatingObject&&e.RelatingObject.value==o.expressID}));a.push({floorParentUuid:e.expressID,uuid:s?"".concat(e.expressID,";").concat(o.expressID):o.expressID,expressId:o.expressID,featureId:o.expressID,name:(null===(i=o.Name)||void 0===i?void 0:i.value)||"",modelId:t,attributes:{familyName:(null===(u=o.Name)||void 0===u?void 0:u.value)||""},isIFC:!0,isLeaf:!s}),s&&s.RelatedObjects.forEach((function(n){var i,u,s=r.find((function(e){return e.expressID==n.value}));a.push({floorParentUuid:"".concat(e.expressID,";").concat(o.expressID),uuid:s.expressID,expressId:s.expressID,featureId:s.expressID,name:(null===(i=s.Name)||void 0===i?void 0:i.value)||"",modelId:t,attributes:{familyName:(null===(u=s.Name)||void 0===u?void 0:u.value)||""},isIFC:!0,isLeaf:!0})}))}}))})),e({res:a,project:i})):e({res:a,project:i})}))}))},y=function(e,t){var n,r,a,o=e.find((function(e){return e.expressID==t})),i={uuid:o.expressID,type:"ifc",properties:{"Element Specific":{Guid:{value:null===(n=o.GlobalId)||void 0===n?void 0:n.value},IfcEntity:{value:self.IFCTypes?self.IFCTypes[o.type]:o.type},Name:{value:null===(r=o.Name)||void 0===r?void 0:r.value},ObjectType:{value:null===(a=o.ObjectType)||void 0===a?void 0:a.value},Tag:{value:o.Tag?o.Tag.value:""}}}};return l.forEach((function(t){e.filter((function(e){return e.type==t&&e.RelatedObjects&&e.RelatedObjects.find((function(e){return e.value==o.expressID}))})).forEach((function(t){var n=Object.keys(t).find((function(e){return e.startsWith("Relating")}));if(n){var r=t[n].value,a=e.find((function(e){return e.expressID==r}));a&&a.Name&&a.HasProperties&&(i.properties[a.Name.value]={},a.HasProperties.forEach((function(t){var n=e.find((function(e){return e.expressID==t.value}));n.Unit&&console.log(JSON.stringify(n.Unit)),i.properties[a.Name.value][n.Name.value]={value:n.NominalValue?n.NominalValue.value:"",unit:n.Unit||""}})))}}))})),i},h=function(e){var t,n,r,a,o,i,u,s=e.find((function(e){return 103090709==e.type})),l=e.find((function(e){var t;return 1451395588==e.type&&"XC_DrawingInfo"==(null==e||null===(t=e.Name)||void 0===t?void 0:t.value)})),c={};null!=l&&l.HasProperties&&(null==l||l.HasProperties.forEach((function(t){var n=e.find((function(e){return e.expressID==t.value}));n&&(c[null==n?void 0:n.Name.value]=null==n?void 0:n.NominalValue.value)})));var f=(null==s||null===(t=s.RepresentationContexts)||void 0===t||null===(n=t.WorldCoordinateSystem)||void 0===n?void 0:n.Location.Coordinates)||[];return{name:(null==s||null===(r=s.Name)||void 0===r?void 0:r.value)||"未知",guid:null==s||null===(a=s.GlobalId)||void 0===a?void 0:a.value,location:{x:(null===(o=f[0])||void 0===o?void 0:o.value)||0,y:(null===(i=f[1])||void 0===i?void 0:i.value)||0,z:(null===(u=f[2])||void 0===u?void 0:u.value)||0},xcDrawingInfo:c}},m=function(e,t){var n={},r=e.filter((function(e){return t.includes(""+e.expressID)})),a=e.find((function(e){return 639542469==e.type})),o={};return r.forEach((function(t){var r,i,u;if(o[t.expressID]={uuid:t.expressID,Guid:null===(r=t.GlobalId)||void 0===r?void 0:r.value,IfcEntity:self.IFCTypes?self.IFCTypes[t.type]:t.type,Name:null===(i=t.Name)||void 0===i?void 0:i.value,ObjectType:null===(u=t.ObjectType)||void 0===u?void 0:u.value,tzProperties:{}},"Revit"!==a.ApplicationIdentifier.value){var l,c,f,d,p,v;n[(null===(l=t.ObjectType)||void 0===l?void 0:l.value)||(null===(c=t.Name)||void 0===c?void 0:c.value)]=n[(null===(f=t.ObjectType)||void 0===f?void 0:f.value)||(null===(d=t.Name)||void 0===d?void 0:d.value)]||{};var y=n[(null===(p=t.ObjectType)||void 0===p?void 0:p.value)||(null===(v=t.Name)||void 0===v?void 0:v.value)];e.filter((function(e){return e.type==s&&e.RelatedObjects&&e.RelatedObjects.find((function(e){return e.value==t.expressID}))})).forEach((function(n){var r=Object.keys(n).find((function(e){return e.startsWith("Relating")}));if(r){var a=n[r].value,i=e.find((function(e){return e.expressID==a&&"天正属性"==e.Name.value}));i&&i.Name&&i.HasProperties&&(o[t.expressID].tzProperties={},i.HasProperties.forEach((function(n){var r=e.find((function(e){return e.expressID==n.value}));r.Unit&&console.log(JSON.stringify(r.Unit)),o[t.expressID].tzProperties[r.Name.value]={value:r.NominalValue?r.NominalValue.value:"",unit:r.Unit||""},r&&r.NominalValue&&void 0!==r.NominalValue.value&&(y[r.Name.value]=y[r.Name.value]||{values:new Set},y[r.Name.value].type=y[r.Name.value].type||Object.prototype.toString.call(r.NominalValue.value).slice(8,-1),y[r.Name.value].values.add(r.NominalValue.value))})))}}))}})),{res:o,filters:n}};self.onmessage=function(){var t=a(n().mark((function t(r){var a,o,s,l,p,g,b,x,I,N,w,E,j,L,P,R,D,O,U,k,M,T,A,S,_,$,G,B,C,F;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=r.data,o=a.type,s=a.data,l=a.libPath;try{!self.zango&&importScripts(l+"/zangodb.min.js")}catch(e){self.postMessage({type:"error",message:"zangoDB 库引入失败,请检查decoderPath: ".concat(l+"/zangodb.min.js")}),self.close()}t.t0=o,t.next="createDB"===t.t0?5:"saveTree"===t.t0?17:"getAttributeData"===t.t0?22:"getFeatureIdByGuid"===t.t0?28:"getIfcProjectInfo"===t.t0?32:"getAttributeDatas"===t.t0?37:"getNodeListByUuid"===t.t0?44:"getComponentByUuid"===t.t0?49:"getNodeListByParentUuid"===t.t0?57:"isExistWithKeyword"===t.t0?62:68;break;case 5:return t.prev=5,t.next=8,c(s,!0);case 8:self.postMessage({type:"createDBResult",data:s.length}),f(),t.next=16;break;case 12:t.prev=12,t.t1=t.catch(5),self.postMessage({type:"error",message:t.t1}),f();case 16:return t.abrupt("break",68);case 17:return t.next=19,c(s.dbName);case 19:if(console.time("保存构件树时间"),"ifc"==s.modelType)try{v(s.data,s.modelId,s.ifcTree).then((function(e){var t=e.res,n=e.project;t.length>0?i.insert(t).then((function(e){self.postMessage({type:"saveTreeResult",data:{num:t.length,project:n}})})).finally((function(){console.timeEnd("保存构件树时间"),f()})):(self.postMessage({type:"saveTreeResult",data:{num:t.length,project:n}}),console.timeEnd("保存构件树时间"),f())}))}catch(e){console.timeEnd("保存构件树失败"),f()}else null!==(p=s.data)&&void 0!==p&&p.length?i.insert(s.data).then((function(e){self.postMessage({type:"saveTreeResult",data:s.data.length})})).finally((function(){var e;s.extra&&(e=s.extra)?fetch(e).then((function(t){t.json().then((function(t){var n=t.objects,r=t.categoryProperties;n.components.forEach((function(e){var t="".concat(e.typec,"_").concat(e.typename).replace(/\s/g,""),n=null==r?void 0:r.find((function(e){return e.categoryName.replace(/\s/g,"")==t}));n&&(e.groupedProperties=n.groupedProperties||{},e.construction=n.construction||{})})),u.insert(t.objects.components).then((function(){f()})).finally((function(){window.URL.revokeObjectURL(e)}))}))})).catch((function(t){window.URL.revokeObjectURL(e),f()})):f(),console.timeEnd("保存构件树时间")})):(self.postMessage({type:"saveTreeResult",data:0}),f());return t.abrupt("break",68);case 22:return t.next=24,c(s.dbName);case 24:return((g=s.uuid)+"").length>45&&(g=g.slice(0,45)),u.findOne({$or:[{uuid:g},{uuid:"ifcAttr"}]}).then((function(e){var t,n;if(e)if("ifcAttr"!=e.uuid){var r="";if(null!=e&&null!==(t=e.construction)&&void 0!==t&&t.totalThickness&&null!=e&&e.groupedProperties["构造"])for(var a in null==e?void 0:e.groupedProperties["构造"])if(a.match(/厚度/)){var o,i=Math.round((null==e?void 0:e.groupedProperties["构造"][a])/(null==e||null===(o=e.construction)||void 0===o?void 0:o.totalThickness));r=1e3===i?"m":1===i?"mm":""}var u=(null==e||null===(n=e.construction)||void 0===n?void 0:n.constructionLayers)||[],s=e.groupedUserData,c=e.groupedProperties,f=d(s,e.revitId),p=d(c,e.revitId,!0);f.forEach((function(e){var t=p.find((function(t){return t.name==e.name}));t&&t.children.forEach((function(t){e.children.find((function(e){return e.name==t.name}))||e.children.push(t)}))})),self.postMessage({type:"getAttributeDataResult",data:{name:e.name,revitId:e.revitId,property:f,tableProperties:u,unit:r}})}else{try{!self.IFCTypes&&importScripts(l+"/ifc/ifc-types.js")}catch(e){console.warn("获取ifc类型文件失败")}var v=y(e.data,g);self.postMessage({type:"getAttributeDataResult",data:v})}else self.postMessage({type:"getAttributeDataResult",data:null})})).finally((function(){f()})).catch((function(e){self.postMessage({type:"error",message:e})})),t.abrupt("break",68);case 28:return t.next=30,c(s.dbName);case 30:return u.findOne({uuid:"ifcAttr"}).then((function(e){var t="";if(e){var n=e.data.find((function(e){var t;return(null===(t=e.GlobalId)||void 0===t?void 0:t.value)==s.guid}));t=n?n.expressID:""}self.postMessage({type:"getFeatureIdByGuidResult",data:t})})).finally((function(){f()})).catch((function(e){self.postMessage({type:"error",message:e})})),t.abrupt("break",68);case 32:return t.next=34,c(s.dbName);case 34:return b={},u.find({uuid:{$eq:"ifcAttr"}}).toArray().then((function(e){e&&(b=h(e[0].data),self.postMessage({type:"getIfcProjectInfoResult",data:b}))})).finally((function(){f()})).catch((function(e){self.postMessage({type:"error",message:e})})),t.abrupt("break",68);case 37:return t.next=39,c(s.dbName);case 39:return x=s.uuids,I=[],N={},u.find({$or:[{uuid:{$in:x}},{uuid:"ifcAttr"}]}).toArray().then((function(e){if(e[0])if("ifcAttr"==e[0].uuid){try{!self.IFCTypes&&importScripts(l+"/ifc/ifc-types.js")}catch(e){console.warn("获取ifc类型文件失败")}var t=m(e[0].data,x);I=t.res,N=t.filters}else e.forEach((function(e){I[e.uuid]=e}));else I={};self.postMessage({type:"getAttributeDatasResult",data:{attrs:I,filters:N}})})).finally((function(){f()})).catch((function(e){self.postMessage({type:"error",message:e})})),t.abrupt("break",68);case 44:return w=s.dbName,E=s.uuid,j=s.modelId,L=s.keyword,P=s.type,t.next=47,c(w);case 47:return L?(R=new RegExp(L),i.find({$or:[e({},"".concat(P,"ParentUuid"),{$regex:R}),{name:{$regex:R}},{familyName:{$regex:R}}],isLeaf:!0}).toArray().then((function(t){0==t.length&&(self.postMessage({type:"getNodeListByUuidResult",data:[]}),f());var n=[];t.forEach((function(e){e["".concat(P,"ParentUuid")]&&n.push(e["".concat(P,"ParentUuid")].split(";")),e.id="".concat(j,"_").concat(e._id)})),0==n.length&&(self.postMessage({type:"getNodeListByUuidResult",data:[]}),f());var r;if((r="root"==E?1:E.split(";").length+1)==n[0].length+1)t.forEach((function(e){e.modelId=j})),self.postMessage({type:"getNodeListByUuidResult",data:t}),f();else{var a=new Set;n.forEach((function(e){a.add(e.splice(0,r).join(";"))})),i.find(e(e({},"".concat(P,"ParentUuid"),E),"uuid",{$in:Array.from(a)})).toArray().then((function(e){e.forEach((function(e){e.modelId=j,e.id="".concat(j,"_").concat(e._id)})),self.postMessage({type:"getNodeListByUuidResult",data:e})}),(function(e){self.postMessage({type:"error",message:e.message})})).finally((function(){f()}))}}))):i.find(e({},"".concat(P,"ParentUuid"),{$eq:E})).toArray().then((function(e){e.forEach((function(e){e.id="".concat(j,"_").concat(e._id),e.modelId=j})),self.postMessage({type:"getNodeListByUuidResult",data:e})}),(function(e){self.postMessage({type:"error",message:e.message})})).finally((function(){f()})),t.abrupt("break",68);case 49:return D=s.dbName,O=s.uuid,U=s.isLeaf,k=s.type,t.next=52,c(D);case 52:return M={},(M=U?{uuid:{$eq:O}}:e({},"".concat(k,"ParentUuid"),{$regex:new RegExp("^".concat(String(O).replace("(","\\(").replace(")","\\)"),"(;|$)"))})).isLeaf=!0,i.find(M).toArray().then((function(e){self.postMessage({type:"getComponentByUuidResult",data:e})}),(function(e){self.postMessage({type:"error",message:e.message})})).finally((function(){f()})),t.abrupt("break",68);case 57:return T=s.dbName,A=s.uuid,S=s.type,_=s.keyword,t.next=60,c(T);case 60:return null!=_&&_.trim()?($=new RegExp(_),i.find({$or:[e({},"".concat(S,"ParentUuid"),{$regex:$}),{name:{$regex:$}},{familyName:{$regex:$}}],isLeaf:!0}).toArray().then((function(e){var t=e.map((function(e){return e.uuid}));self.postMessage({type:"getNodeListByParentUuidResult",data:t})})).finally((function(){f()}))):i.find(e(e({},"".concat(S,"ParentUuid"),{$regex:new RegExp("^".concat(String(A).replace("(","\\(").replace(")","\\)"),"(;|$)"))}),"isLeaf",!0)).toArray().then((function(e){var t=e.map((function(e){return e.uuid}));self.postMessage({type:"getNodeListByParentUuidResult",data:t})})).finally((function(){f()})),t.abrupt("break",68);case 62:return G=s.dbName,B=s.keyword,C=s.type,t.next=65,c(G);case 65:return F=RegExp(B),i.findOne({$or:[e({},"".concat(C,"ParentUuid"),{$regex:F}),{name:{$regex:F}},{familyName:{$regex:F}}]}).then((function(e){self.postMessage({type:"isExistWithKeywordResult",data:e})}),(function(e){self.postMessage({type:"error",message:e.message})})).finally((function(){f()})),t.abrupt("break",68);case 68:case"end":return t.stop()}}),t,null,[[5,12]])})));return function(e){return t.apply(this,arguments)}}()};e()}();